v0.0.4¶
Yahoo crypto history and crypto portfolios: a daily backfill pairs coins with Yahoo and fills missing bars, CoinGecko and Yahoo bars line up by session, and Users can record trades and read positions and portfolio value as Datasets.
New¶
- History backfill (
cointoss.backfill):cointoss backfill [--days N]and abackfillnode fill every date with no stored bar, from CoinGecko'smarket_chart(up to 365 days) and from Yahoo (full history) for coins paired with Yahoo. Existing bars are never overwritten. A coin is paired by itsYAHOO_PAIRSentry, then{SYMBOL}-USD, then Yahoo search for suffixed tickers such asUNI7083-USD; a ticker is accepted only when its closes are within 3% median of CoinGecko's over the last 30 shared sessions. Unpaired coins are retried on the next run. Runs on its own trigger,daily_backfill, suggested at0 1 * * *, taking the sweep lock only for each write. - Portfolios (
cointoss.portfolio, ADR-0001 amendment): a Portfolio is owned by one User and holds single-leg Trades in UTC with a signed quantity and optional USD cost. Trades are voided, never edited or deleted. Positions are derived on read, with average cost reset when a position closes and none while short. - Portfolio writes: JSON-RPC
create_portfolio,add_trade,void_trade, and CLIcointoss portfolio create,cointoss trade add,cointoss trade void, which work against a remote instance through--url/$COINTOSS_URLand--token/$COINTOSS_TOKEN. They need the newportfolioRole (call cointoss.portfolio). A traded coin joins theportfolio-helduniverse, so the sweep prices it even outside the top 100. - Portfolio Datasets (
cointoss.datasets, ADR-0010 amendment):trades,positionsandportfolio_value, each showing only the caller's own portfolios. A position with no close on a date is valued null. - Automatic copy before migrating (
cointoss.store): opening a database at an older schema version first copies it tocointoss.db.v<old>-<UTC time>.bakbeside itself.
Changed¶
- Session Offset (
cointoss.store, ADR-0009 amendment): resolved bars are dated by the session they close. CoinGecko's bar stamped D+1 is now read as the close of D, so thebarsandreturnsDatasets and every resolved read shift CoinGecko-sourced dates back one day. Stored bars are unchanged. - Schema version 2: adds the
PortfolioandTradetables. The first open by v0.0.4 migrates the file, after the automatic copy above. - Existing
woodglue.yaml: add thedaily_backfilltrigger and theportfolioRole by hand;cointoss initprints the snippets when they are missing. portfolio-heldis a reserved universe name; declaring it incointoss.yamlis refused.- The sweep fetches universe Inclusions missing from CoinGecko's
marketslisting by id.
Fixes¶
- A negative CoinGecko volume or market cap is read as absent instead of failing the bar.
- An unknown Yahoo ticker is reported as
no such tickerinstead of a pandas error.
Documentation¶
- README: a new Upgrade section on schema versions, migration and the automatic copy.
- Glossary: Session Offset, Void, Portfolio-held. Road map: steps 6 and 7 done; stocks deferred to step 8.
Decisions and tickets¶
Amended ADRs:
- 0001 Unified Instrument abstraction and Trade as System of Record: amended with the portfolio model: owned by a User, single-leg trades without a cash leg, void instead of delete, average cost, USD only, no Snapshot yet.
- 0008 Rows, Not Blobs: amended so a store copies an older database aside before migrating it.
- 0009 Price Storage: Source-Keyed Bars, Adjustment As Fetched: amended with the Session Offset (Yahoo 0, CoinGecko 1) and Yahoo pairing by price agreement, at a 3% tolerance.
- 0010 Datasets: a Generic, Long, FrameData Read API: amended with owned Datasets filtered to the caller, and null value without a close.
Closed:
-
26 History backfill: CoinGecko market_chart and Yahoo crypto history, filling dates with no stored bar¶
-
31 Session Offset: align CoinGecko and Yahoo crypto bars on read¶
-
32 Portfolio storage: Portfolio and Trade tables, positions on read¶
-
33 Portfolio writes: JSON-RPC methods and CLI, portfolio-held universe¶
-
34 Portfolio datasets: trades, positions, portfolio_value¶
-
35 Yahoo: report an unknown ticker as 'no such ticker'¶
-
36 Yahoo pairing: find suffixed tickers (UNI7083-USD) and look at SHIB¶