From f31d868a55affe2ad56fed846176a69093a8dbf3 Mon Sep 17 00:00:00 2001 From: Nelson Torres Date: Sat, 7 Dec 2024 10:37:34 -0300 Subject: [PATCH] get_config refactor --- piker/brokers/deribit/api.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/piker/brokers/deribit/api.py b/piker/brokers/deribit/api.py index e05f86a5..82cb8d8f 100644 --- a/piker/brokers/deribit/api.py +++ b/piker/brokers/deribit/api.py @@ -234,17 +234,18 @@ def get_config() -> dict[str, Any]: ) conf_option = section.get('option', {}) - section = {} # 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' - section['log']['disabled'] = True - - return section + return { + 'deribit': { + 'key_id': conf_option.get('api_key'), + 'key_secret': conf_option.get('api_secret'), + }, + 'log': { + 'filename': 'feedhandler.log', + 'level': 'DEBUG', + 'disabled': True, + } + } class Client: @@ -912,7 +913,7 @@ async def maybe_open_oi_feed( kwargs={ 'instruments': instruments }, - key=f'{instruments[0]}', + key=f'{instruments[0].base}', ) as (cache_hit, feed): if cache_hit: