v1 working switch symbols w volume filter

This commit is contained in:
2026-05-01 20:45:26 +00:00
parent 7d579faa82
commit b05f389e49
40 changed files with 12837 additions and 28654 deletions

View File

@@ -5,10 +5,10 @@ import os
load_dotenv()
def upsert_list_of_dicts_by_id(list_of_dicts, new_dict, id='id', seq_check_field: str | None = None) -> list[dict]:
def upsert_list_of_dicts_by_id(list_of_dicts, new_dict, id='id', seq_check_field: str | None = None, reset_seq_id: bool = False) -> list[dict]:
for index, item in enumerate(list_of_dicts):
if item.get(id) == new_dict.get(id):
if seq_check_field is not None:
if ( seq_check_field is not None ) and ( not(reset_seq_id) ):
if item.get(seq_check_field) > new_dict.get(seq_check_field):
logging.info('Skipping out of sequence msg')
return list_of_dicts
@@ -40,4 +40,10 @@ def rec_set_dict(orig_dict, new_dict, allow_new_fields: bool = False) -> dict:
else:
logging.warning(msg=f'rec_set_dict: encountered nonexistent key: "{k}"; skipping')
return orig_dict
return orig_dict
def symbol_to_aster_fmt(symbol: str) -> str:
return (symbol+'T' if symbol[-1].upper()!='T' else symbol).replace('-','').upper()
def symbol_to_extend_fmt(symbol: str) -> str:
return (symbol[0:-1] if symbol[-1].upper()=='T' else symbol).replace('-','').upper().split('USD')[0]+'-'+'USD'