Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kraken.trades_dialogue() doesn't handle reconnects, assert fails on trades ledger msg.. #311

Closed
goodboy opened this issue May 10, 2022 · 0 comments
Labels
bug guille broke it prolly clearing auction and mm tech: EMS, OMS, algo-trading

Comments

@goodboy
Copy link
Contributor

goodboy commented May 10, 2022

The following pikerd logging before this issue happens:

May 10 10:52:56 (brokerd.kraken, 56732, trades_dialogue)) [INFO] piker.data._web_bs _web_bs.py:97 Connection success: wss://ws-auth.kraken.com/
May 10 10:52:56 (brokerd.kraken, 56732, piker.brokers.kraken.stream_quotes)) [INFO] piker.data._web_bs _web_bs.py:97 Connection success: wss://ws.kraken.com/
May 10 10:52:56 (brokerd.kraken, 56732, trades_dialogue)) [INFO] piker.data._web_bs _web_bs.py:97 Connection success: wss://ws-auth.kraken.com/

UNHANDLED MSG: 
[
[{'TCF6H2-WERBY-JNXCDU': {'cost': '124.96468', 'fee': '0.32491', 
'margin': '0.00000', 'ordertxid': 'OAH2LZ-IKTGB-5XUK6H', 'ordertype': 'limit',
 'pair': 'XBT/EUR', 'postxid': 'TKH2SE-M7IF5-CFI7LT', 'price': '29818.60000', 'time': '1652118788.621332', 
'type': 'buy', 'vol': '<redacted>'}},

{'TFWDAS-3SL2R-4VVQBX': {'cost': '<redacted>', 'fee': '0.48000000', 'margin': '0.00000000',
 'ordertxid': 'OJ66JV-D62X4-TVPB2K', 'ordertype': 'limit', 'pair': 'XMR/EUR', 'postxid': 'TKH2SE-M7IF5-CFI7LT', 
'price': '153.59000000', 'time': '1646354770.950569', 'type': 'buy', 'vol': '<redacted>'}}, 

{'TDKMPS-OYQHN-5IEM3U': {'cost': '<redacted>', 'fee': '0.80533956', 'margin': '0.00000000', 'ordertxid': 'OT2TN3-7YNCO-5EFWKZ', 'ordertype': 'limit', 'pair': 'XMR/EUR', 'postxid': 'TKH2SE-M7IF5-CFI7LT', 'price': '120.66000000', 'time': '1643033234.045000', 'type': 'buy', 'vol': '<redacted>'}}],
 'ownTrades', {'sequence': 1}]

The unhandled message appears to be the trade ledger as a single list.
-> this makes sense since that's what the ownTrades endpoint delivers on startup

Clearly we need to handle this case 😂 via an ownTrades msg parser..
Probably pertains to work needed in #290 ..

@goodboy goodboy added bug guille broke it prolly clearing auction and mm tech: EMS, OMS, algo-trading labels May 10, 2022
goodboy added a commit that referenced this issue Jun 29, 2022
Just ignore them for now using new `match:` syntax B)
but we'll do incremental update sooon!

Resolves #311
goodboy added a commit that referenced this issue Jul 3, 2022
Moves to using the new `piker.pp` apis to both store real-time trade
events in a ledger file as well emit position update msgs (which were
not in this backend at all prior) when new orders clear (aka fill).

In terms of outstanding issues,
- solves the pp update part of the bugs reported in #310
- starts a msg case block in prep for #293

Details of rework:
- move the `subscribe()` ws fixture to module level and `partial()` in
  the client token instead of passing it to the instance; in prep for
  removal of the `.token` attr from the `NoBsWs` wrapper.
- drop `make_auth_sub()` since it was too thin and we can just
  do it all succinctly in `subscribe()`
- filter trade update msgs to those not yet stored int the toml ledger
- much better kraken api msg unpacking using new `match:` synax B)

Resolves #311
@goodboy goodboy closed this as completed in fcd7e0f Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug guille broke it prolly clearing auction and mm tech: EMS, OMS, algo-trading
Projects
None yet
Development

No branches or pull requests

1 participant