Skip to content

Commit

Permalink
Tweak exchange+region handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ValueRaider committed Jan 12, 2025
1 parent 0cf54a6 commit 6c0bdfd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
8 changes: 3 additions & 5 deletions yfinance/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,6 @@ def merge_two_level_dicts(dict1, dict2):
return result

EQUITY_SCREENER_EQ_MAP = {
"region": {
"ar","at","au","be","br","ca","ch","cl","cn","cz","de","dk","ee","eg","es","fi","fr","gb","gr",
"hk","hu","id","ie","il","in","is","it","jp","kr","kw","lk","lt","lv","mx","my","nl","no","nz",
"pe","ph","pk","pl","pt","qa","ro","ru","sa","se","sg","sr","th","tr","tw","us","ve","vn","za"
},
"exchange": {
'ar': {'BUE'},
'at': {'VIE'},
Expand Down Expand Up @@ -502,6 +497,9 @@ def merge_two_level_dicts(dict1, dict2):
"Banks"
}
}
EQUITY_SCREENER_EQ_MAP['region'] = EQUITY_SCREENER_EQ_MAP['exchange'].keys()
ordered_keys = ['region'] + [k for k in EQUITY_SCREENER_EQ_MAP.keys() if k != 'region']
EQUITY_SCREENER_EQ_MAP = {k:EQUITY_SCREENER_EQ_MAP[k] for k in ordered_keys}
FUND_SCREENER_EQ_MAP = {
"exchange": {
'us': {'NAS'}
Expand Down
5 changes: 2 additions & 3 deletions yfinance/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ def generate_list_table_from_dict_universal(data: dict, bullets: bool=True, titl
# Don't draw bullet points:
current_line += '| '
else:
current_line += ', '
current_line += '. '
current_line += f"{k2}: " + k2_values_str
else:
table_add += ' '*5
Expand All @@ -1064,7 +1064,6 @@ def generate_list_table_from_dict_universal(data: dict, bullets: bool=True, titl
if j < len(k2_values_str_lines)-1:
table_add += "\n"
else:
# table_add += '* '
if block_format:
table_add += '| '
else:
Expand All @@ -1089,4 +1088,4 @@ def generate_list_table_from_dict_universal(data: dict, bullets: bool=True, titl
value_str = ', '.join(sorted(values))
table += ' '*5 + f"- {value_str}\n"

return table
return table

0 comments on commit 6c0bdfd

Please sign in to comment.