Compare commits
1 Commits
00406028ea
...
53148b453d
Author | SHA1 | Date |
---|---|---|
|
53148b453d |
|
@ -170,7 +170,6 @@ 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,
|
||||||
|
@ -237,10 +236,16 @@ 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().get('deribit', {})
|
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']
|
||||||
|
|
||||||
self._key_id = config.get('key_id')
|
else:
|
||||||
self._key_secret = config.get('key_secret')
|
self._key_id = None
|
||||||
|
self._key_secret = None
|
||||||
|
|
||||||
self.json_rpc = json_rpc
|
self.json_rpc = json_rpc
|
||||||
|
|
||||||
|
@ -413,13 +418,20 @@ class Client:
|
||||||
new_bars: list[tuple] = []
|
new_bars: list[tuple] = []
|
||||||
for i in range(len(result.close)):
|
for i in range(len(result.close)):
|
||||||
|
|
||||||
row = [
|
timestamp = (start_time + (i * (60 * 1000))) / 1000.0
|
||||||
(start_time + (i * (60 * 1000))) / 1000.0, # time
|
_open = result.open[i]
|
||||||
result.open[i],
|
high = result.high[i]
|
||||||
result.high[i],
|
low = result.low[i]
|
||||||
result.low[i],
|
close = result.close[i]
|
||||||
result.close[i],
|
volume = result.volume[i]
|
||||||
result.volume[i]
|
|
||||||
|
row = [
|
||||||
|
timestamp, # time
|
||||||
|
_open,
|
||||||
|
high,
|
||||||
|
low,
|
||||||
|
close,
|
||||||
|
volume
|
||||||
]
|
]
|
||||||
|
|
||||||
new_bars.append((i,) + tuple(row))
|
new_bars.append((i,) + tuple(row))
|
||||||
|
|
|
@ -34,10 +34,7 @@ import numpy as np
|
||||||
import tractor
|
import tractor
|
||||||
|
|
||||||
from piker.accounting import MktPair
|
from piker.accounting import MktPair
|
||||||
from piker.brokers import (
|
from piker.brokers import open_cached_client
|
||||||
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 (
|
||||||
|
@ -84,8 +81,6 @@ 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,
|
||||||
|
|
Loading…
Reference in New Issue