deribit: options fqmes with a single digit "day" in the expiry token fail to parse #11

Open
opened 2024-11-19 23:01:03 +00:00 by goodboy · 0 comments

A valid .bs_fqme: str (since we haven’t finished a piker style yet..) such as,

piker -l cancel --pdb chart btc-6dec24-90000-c.option.deribit

will crash with,

File "/home/goodboy/repos/piker/piker/brokers/deribit/feed.py", line 258, in stream_quotes
    nsym = piker_sym_to_cb_sym(sym)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/goodboy/repos/piker/piker/brokers/deribit/api.py", line 142, in piker_sym_to_cb_sym
    return Symbol(
           ^^^^^^^
  File "/home/goodboy/repos/piker/.venv/lib/python3.12/site-packages/cryptofeed/symbols.py", line 32, in __init__
    self.expiry_date = self.date_format(expiry_date)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/goodboy/repos/piker/.venv/lib/python3.12/site-packages/cryptofeed/symbols.py", line 60, in date_format
    month = Symbol.month_code(date[2:4])
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/goodboy/repos/piker/.venv/lib/python3.12/site-packages/cryptofeed/symbols.py", line 43, in month_code
    return ret[int(month) - 1]
               ^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'EC'
Underlying issue

if you put instead a 06dec24 in btc-6dec24-90000-c.option.deribit it will then parse (since a valid date format says pendulum…), BUT of course since the Client._pairs: ChainMap table is indexed using their symbology-set no such pair will match in,

 File "/home/goodboy/repos/piker/piker/brokers/deribit/feed.py", line 207, in get_mkt_info
    pair: Pair = await client.exch_info(
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/goodboy/repos/piker/piker/brokers/deribit/api.py", line 381, in exch_info
    raise ValueError(
ValueError: No contract found for 'btc-06dec24-90000-c'

Closest 5 available contracts:

['btc-6dec24-90000-c',
 'btc-6dec24-70000-c',
 'btc-6dec24-80000-c',
 'btc-6dec24-89000-c',
 'btc-6dec24-90000-p']

(you’re welcome for the better error report thanks to #10 Bp)

A valid `.bs_fqme: str` (since we haven't finished a piker style yet..) such as, ```sh piker -l cancel --pdb chart btc-6dec24-90000-c.option.deribit ``` will crash with, ```python File "/home/goodboy/repos/piker/piker/brokers/deribit/feed.py", line 258, in stream_quotes nsym = piker_sym_to_cb_sym(sym) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/goodboy/repos/piker/piker/brokers/deribit/api.py", line 142, in piker_sym_to_cb_sym return Symbol( ^^^^^^^ File "/home/goodboy/repos/piker/.venv/lib/python3.12/site-packages/cryptofeed/symbols.py", line 32, in __init__ self.expiry_date = self.date_format(expiry_date) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/goodboy/repos/piker/.venv/lib/python3.12/site-packages/cryptofeed/symbols.py", line 60, in date_format month = Symbol.month_code(date[2:4]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/goodboy/repos/piker/.venv/lib/python3.12/site-packages/cryptofeed/symbols.py", line 43, in month_code return ret[int(month) - 1] ^^^^^^^^^^ ValueError: invalid literal for int() with base 10: 'EC' ``` ##### Underlying issue if you put instead a `06dec24` in `btc-6dec24-90000-c.option.deribit` it will then parse (since a valid date format says `pendulum`...), BUT of course since the `Client._pairs: ChainMap` table is indexed using their symbology-set no such pair will match in, ```python File "/home/goodboy/repos/piker/piker/brokers/deribit/feed.py", line 207, in get_mkt_info pair: Pair = await client.exch_info( ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/goodboy/repos/piker/piker/brokers/deribit/api.py", line 381, in exch_info raise ValueError( ValueError: No contract found for 'btc-06dec24-90000-c' Closest 5 available contracts: ['btc-6dec24-90000-c', 'btc-6dec24-70000-c', 'btc-6dec24-80000-c', 'btc-6dec24-89000-c', 'btc-6dec24-90000-p'] ``` (you're welcome for the better error report thanks to #10 Bp)
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: pikers/piker#11
There is no content yet.