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

View File

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