Account tests
More or less starting the final push to get piker.accounting and friends to a place where we can never get wrong position calcs, implement said calcs using polars.DataFrames, do offline ledger processing for all accounts, and be in a place to start implementing position metrics curves display in the chart UI as mentioned in https://github.com/pikers/piker/issues/515.
Tasks:
-
[ ] implement
Client.get_assets()and.get_mkt_pairs()for all backends to support the new.data._symcachestuff:-
[x] binance
- [x] full symcache support
- [ ] reorg pair types into a
.symbolsmod (rn it's calledvenues)
-
[x] kraken (4c550730)
- [x] put sym stuff in
.symbols.py
- [x] put sym stuff in
-
[x] ib (ALSO, figure out how the cache is going to work here since pulling all contracts is a bit infeasible..)
-
[x] disable
SymbologyCacheloading via_no_symcache = Trueattr. -
[ ] make issue for attempting a soln for
ibsymcaching:- available search tools:
- https://interactivebrokers.github.io/tws-api/basic_contracts.html
- https://misc.interactivebrokers.com/cstools/contract_info/v3.10/index.php
- https://www.interactivebrokers.com/en/index.php?f=products
- forum discussions/potential solutions:
- https://groups.io/g/insync/topic/87564236
- https://groups.io/g/insync/message/7119
- https://stackoverflow.com/questions/29876693/interactive-brokers-symbol-list
- https://www.elitetrader.com/et/threads/ib-api-get-all-expirys-and-strikes-of-a-stock-symbol.279786/
- available search tools:
-
[ ] kucoin
- [ ] at least get data feeds workin again.. requires paper engine patch?
- [ ] re-org into submods including new
symbols.py.. - [ ] add
Client.get_assets()and.get_mkt_pairs()since support should be easy to add.
-
-
[ ] make follow up issue for backends not yet supporting broker mode / order ctl?
- [ ] deribit? (is anyone maintaining this any more tho @guilledk?)
- [ ] questrade.. lol gotta get back to this
-
-
[ ] re-implement
open_account()as async ctx mngr and do ledger loading implicitly as well as provide public interface for updates via probably a.ledgerattr?-
[ ] expose public API to access account-state
polars.DataFrames as well as the ledger df as loaded by.accounting.calc.open_ledger_dfs() -
[ ] implement and document
pl.DataFramebased.bepand.ppu- TURNS OUT, the old
dictimpl was kinda buggy anyway due to our dt-sorting which seems to not be always iterating out correctly? - [ ] definitely document all this in an
.accounting/README.rst
- TURNS OUT, the old
-
Test list:
-
[ ] "offline" ledger test set:
- [ ]
binance.paperinput ledgers (of various sorts) where we verifyAccount.pps: dict[str Positionproperties outputs- [ ] long to zero
- [ ] short to zero
- [ ] long to short (via single clear) and back to zero
- [ ] use an
ib.algopaperactual flex and API ledger and verify at least a (subset) of pps.
- [ ]
-
[ ] symcache tests which verify creation for all backends and reloads when requested?