Compare commits
2 Commits
2bdbe0f20e
...
6555ccfbba
Author | SHA1 | Date |
---|---|---|
Nelson Torres | 6555ccfbba | |
Nelson Torres | 75d1d007fb |
|
@ -58,6 +58,7 @@ from cryptofeed.symbols import Symbol
|
|||
# types for managing the cb callbacks.
|
||||
# from cryptofeed.types import L1Book
|
||||
from .venues import (
|
||||
_ws_url,
|
||||
MarketType,
|
||||
PAIRTYPES,
|
||||
Pair,
|
||||
|
@ -95,11 +96,6 @@ _spawn_kwargs = {
|
|||
}
|
||||
|
||||
|
||||
_url = 'https://www.deribit.com'
|
||||
_ws_url = 'wss://www.deribit.com/ws/api/v2'
|
||||
_testnet_ws_url = 'wss://test.deribit.com/ws/api/v2'
|
||||
|
||||
|
||||
# convert datetime obj timestamp to unixtime in milliseconds
|
||||
def deribit_timestamp(when):
|
||||
return int((when.timestamp() * 1000) + (when.microsecond / 1000))
|
||||
|
@ -190,34 +186,22 @@ def get_config() -> dict[str, Any]:
|
|||
)
|
||||
section: dict = {}
|
||||
section = conf.get('deribit')
|
||||
|
||||
section['log'] = {}
|
||||
section['log']['filename'] = 'feedhandler.log'
|
||||
section['log']['level'] = 'DEBUG'
|
||||
section['log']['disabled'] = True
|
||||
|
||||
if section is None:
|
||||
log.warning(f'No config section found for deribit in {path}')
|
||||
return {}
|
||||
|
||||
conf_option = section.get('option', {})
|
||||
section.clear # clear the dict to reuse it
|
||||
section['deribit'] = {}
|
||||
section['deribit']['key_id'] = conf_option.get('api_key')
|
||||
section['deribit']['key_secret'] = conf_option.get('api_secret')
|
||||
|
||||
section['log'] = {}
|
||||
section['log']['filename'] = 'feedhandler.log'
|
||||
section['log']['level'] = 'DEBUG'
|
||||
|
||||
return section
|
||||
|
||||
def get_fh_config() -> dict[str, Any]:
|
||||
conf_option = get_config().get('option', {})
|
||||
conf_log = get_config().get('log', {})
|
||||
|
||||
return {
|
||||
'log': {
|
||||
'filename': conf_log.get('filename'),
|
||||
'level': conf_log.get('level'),
|
||||
'disabled': conf_log.get('disabled')
|
||||
},
|
||||
'deribit': {
|
||||
'key_id': conf_option.get('api_key'),
|
||||
'key_secret': conf_option.get('api_secret')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Client:
|
||||
|
||||
|
@ -229,10 +213,10 @@ class Client:
|
|||
) -> None:
|
||||
self._pairs: ChainMap[str, Pair] = ChainMap()
|
||||
|
||||
config = get_config().get('option', {})
|
||||
config = get_config().get('deribit', {})
|
||||
|
||||
self._key_id = config.get('api_key')
|
||||
self._key_secret = config.get('api_secret')
|
||||
self._key_id = config.get('key_id')
|
||||
self._key_secret = config.get('key_secret')
|
||||
|
||||
self.json_rpc = json_rpc
|
||||
|
||||
|
@ -571,7 +555,7 @@ async def get_client(
|
|||
|
||||
@acm
|
||||
async def open_feed_handler():
|
||||
fh = FeedHandler(config=get_fh_config())
|
||||
fh = FeedHandler(config=get_config())
|
||||
yield fh
|
||||
await to_asyncio.run_task(fh.stop_async)
|
||||
|
||||
|
|
Loading…
Reference in New Issue