pikers / piker

(e2e) foss trading for non-tinas
GNU Affero General Public License v3.0
103 stars 17 forks source link

Deribit backend & minimal broker check tool #331

Closed guilledk closed 2 years ago

guilledk commented 2 years ago

This PR started as just adding deribit backend, but as a way to test that backend (and all backends), I also added a new brokercheck command in piker.brokers.cli.

Example command:

TODO:


EDIT: Futures support and trade_dialogue implementation are gonna be left for a future PR, we got crypto option feeds going!

goodboy commented 2 years ago

soo soo lit. thanks for doing this.

@guilledk what do you think about a simple test that iterates all the backends and runs this (if you haven't done this alread, they wrote before they looked)...

goodboy commented 2 years ago

Also, what do i need to try out a feed here? An api key of some sort yah? Can we get some basic instructions in a readme going maybe?

I know this would be handy for any backend that has extra steps beyond public endpoints, so even for trading endpoints.

goodboy commented 2 years ago

Even though you know about it the lingering issue where we get a crash because a contract hasn't traded:

tractor._exceptions.RemoteActorError: ('brokerd.deribit', 'e17aca9c-a635-450b-8dd7-1110609f1e9a')
Traceback (most recent call last):
  File "/home/goodboy/.virtualenvs/xonsh310/src/tractor/tractor/_actor.py", line 194, in _invoke
    res = await coro
  File "/home/goodboy/repos/piker/piker/data/feed.py", line 1054, in open_feed_bus
    await bus.nursery.start(
  File "/home/goodboy/.virtualenvs/xonsh310/lib/python3.10/site-packages/trio/_core/_run.py", line 1036, in start
    async with open_nursery() as old_nursery:
  File "/home/goodboy/.virtualenvs/xonsh310/lib/python3.10/site-packages/trio/_core/_run.py", line 813, in __aexit__
    raise combined_error_from_nursery
  File "/home/goodboy/repos/piker/piker/data/feed.py", line 902, in allocate_persistent_feed
    init_msg, first_quote = await bus.nursery.start(
  File "/home/goodboy/.virtualenvs/xonsh310/lib/python3.10/site-packages/trio/_core/_run.py", line 1036, in start
    async with open_nursery() as old_nursery:
  File "/home/goodboy/.virtualenvs/xonsh310/lib/python3.10/site-packages/trio/_core/_run.py", line 813, in __aexit__
    raise combined_error_from_nursery
  File "/home/goodboy/repos/piker/piker/brokers/deribit/feed.py", line 287, in stream_quotes
    last_trade = Trade(**(await client.last_trades(
IndexError: list index out of range