Compare commits

..

1 Commits

Author SHA1 Message Date
Nelson Torres 00406028ea Added cryptofeed and pyarrow necessary for the feed, enable deribit
in the brokers init file, at this point the feed is working, to check
the tables use vd tool.
2024-08-28 18:04:41 +00:00
2 changed files with 17 additions and 24 deletions

View File

@ -170,6 +170,7 @@ def piker_sym_to_cb_sym(name: str) -> Symbol:
option_type = CALL option_type = CALL
else: else:
raise Exception("Couldn\'t parse option type") raise Exception("Couldn\'t parse option type")
return Symbol( return Symbol(
base=base, base=base,
quote=quote, quote=quote,
@ -236,16 +237,10 @@ class Client:
def __init__(self, json_rpc: Callable) -> None: def __init__(self, json_rpc: Callable) -> None:
self._pairs: dict[str, Any] = None self._pairs: dict[str, Any] = None
config = get_config() config = get_config().get('deribit', {})
if ('deribit' in config):
config = config['deribit']
if ('key_id' in config) and ('key_secret' in config):
self._key_id = config['key_id']
self._key_secret = config['key_secret']
else: self._key_id = config.get('key_id')
self._key_id = None self._key_secret = config.get('key_secret')
self._key_secret = None
self.json_rpc = json_rpc self.json_rpc = json_rpc
@ -418,20 +413,13 @@ class Client:
new_bars: list[tuple] = [] new_bars: list[tuple] = []
for i in range(len(result.close)): for i in range(len(result.close)):
timestamp = (start_time + (i * (60 * 1000))) / 1000.0
_open = result.open[i]
high = result.high[i]
low = result.low[i]
close = result.close[i]
volume = result.volume[i]
row = [ row = [
timestamp, # time (start_time + (i * (60 * 1000))) / 1000.0, # time
_open, result.open[i],
high, result.high[i],
low, result.low[i],
close, result.close[i],
volume result.volume[i]
] ]
new_bars.append((i,) + tuple(row)) new_bars.append((i,) + tuple(row))

View File

@ -34,7 +34,10 @@ import numpy as np
import tractor import tractor
from piker.accounting import MktPair from piker.accounting import MktPair
from piker.brokers import open_cached_client from piker.brokers import (
open_cached_client,
NoData,
)
from piker.log import get_logger, get_console_log from piker.log import get_logger, get_console_log
from piker.data import ShmArray from piker.data import ShmArray
from piker.brokers._util import ( from piker.brokers._util import (
@ -81,6 +84,8 @@ async def open_history_client(
datetime, # start datetime, # start
datetime, # end datetime, # end
]: ]:
if timeframe != 60:
raise DataUnavailable('Only 1m bars are supported')
array: np.ndarray = await client.bars( array: np.ndarray = await client.bars(
mkt, mkt,