indices dict and values

This commit is contained in:
Justin 2023-06-12 16:57:05 +08:00 committed by GitHub
parent 016068e393
commit 52df206a4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -187,9 +187,23 @@ def index():
pass pass
f.close() f.close()
dict2 = {'BIST 100 - Istanbul': 'XU100.IS', 'SET - Bangkok': '^SET.BK', 'PSEI - Philippines': 'PSEI.PS', 'JKSE - Jakarta': '^JKSE',
'TAIEX - Taiwan': '^TWII', 'HSI - Hong Kong': '^HSI', 'SENSEX - India': '^BSESN', 'NIFTY 50 - India': '^NSEI', 'Nikkei 225 - Japan': '^N225',
'SZSE - Shenzhen': '399001.SZ', 'SSE - Shanghai': '000001.SS', 'STI - Singapore': '^STI', 'ASX 200 - Australia': '^AXJO',
'NZX 50 - New Zealand': '^NZ50', 'KOSPI - South Korea': '^KS11','Euronext 100 - EU': '^N100', 'STOXX 50 - EU': '^STOXX50E',
'STOXX 600 - EU': '^STOXX', 'PSI 20 - Lisbon': 'PSI20.LS', 'FTSE MIB - Italy': 'FTSEMIB.MI', 'OMXH25 - Helsinki': '^OMXH25',
'OMXS30 - Stockholm': '^OMX', 'AEX - Amsterdam': '^AEX', 'ATX - Austria': '^ATX', 'BEL 20 - Brussels': '^BFX',
'SSMI - Switzerland': '^SSMI', 'CAC 40 - France': '^FCHI', 'IBEX 35 - Spain': '^IBEX', 'FTSE 100 - UK': '^FTSE', 'Dax - Germany': '^GDAXI',
'Bovespa - Brazil': '^BVSP', 'IPC - Mexico': '^MXX', 'S&P/TSX - Canada': '^GSPTSE', 'VIX - USA': '^VIX', 'Russell 2000 - USA': '^RUT',
'Nasdaq Composite - USA': '^IXIC', 'Nasdaq 100 - USA': '^NDX', 'S&P 500 - USA': '^GSPC', 'Dow Jones - USA': '^DJI'}
f = open('csv/indices_settings.json', 'r') f = open('csv/indices_settings.json', 'r')
indices_settings = json.load(f) indices_settings = json.load(f)
f.close() try:
reversed_dict2 = {value: key for key, value in dict2.items()}
indices_settings['symbols'] = [reversed_dict2[value] for value in indices_settings['symbols']]
except:
pass
f.close()
f= open('csv/crypto_settings.json', 'r') f= open('csv/crypto_settings.json', 'r')
crypto_settings = json.load(f) crypto_settings = json.load(f)
@ -1015,7 +1029,17 @@ def save_trade_settings(input_settings):
"WTI Crude Oil": "WTIOIL", "Ethanol": "ETHANOL", "Crude Palm Oil": "CPO", "Natural Gas": "NG", "Cocoa": "COCOA", "Robusta": "ROBUSTA", "WTI Crude Oil": "WTIOIL", "Ethanol": "ETHANOL", "Crude Palm Oil": "CPO", "Natural Gas": "NG", "Cocoa": "COCOA", "Robusta": "ROBUSTA",
"Lumber": "LUMBER", "Rubber": "RUBBER", "Live Cattle": "CATTLE", "Lean Hog": "HOG" "Lumber": "LUMBER", "Rubber": "RUBBER", "Live Cattle": "CATTLE", "Lean Hog": "HOG"
} }
indices_dict = {'BIST 100 - Istanbul': 'XU100.IS', 'SET - Bangkok': '^SET.BK', 'PSEI - Philippines': 'PSEI.PS', 'JKSE - Jakarta': '^JKSE',
'TAIEX - Taiwan': '^TWII', 'HSI - Hong Kong': '^HSI', 'SENSEX - India': '^BSESN', 'NIFTY 50 - India': '^NSEI', 'Nikkei 225 - Japan': '^N225',
'SZSE - Shenzhen': '399001.SZ', 'SSE - Shanghai': '000001.SS', 'STI - Singapore': '^STI', 'ASX 200 - Australia': '^AXJO',
'NZX 50 - New Zealand': '^NZ50', 'KOSPI - South Korea': '^KS11','Euronext 100 - EU': '^N100', 'STOXX 50 - EU': '^STOXX50E',
'STOXX 600 - EU': '^STOXX', 'PSI 20 - Lisbon': 'PSI20.LS', 'FTSE MIB - Italy': 'FTSEMIB.MI', 'OMXH25 - Helsinki': '^OMXH25',
'OMXS30 - Stockholm': '^OMX', 'AEX - Amsterdam': '^AEX', 'ATX - Austria': '^ATX', 'BEL 20 - Brussels': '^BFX',
'SSMI - Switzerland': '^SSMI', 'CAC 40 - France': '^FCHI', 'IBEX 35 - Spain': '^IBEX', 'FTSE 100 - UK': '^FTSE', 'Dax - Germany': '^GDAXI',
'Bovespa - Brazil': '^BVSP', 'IPC - Mexico': '^MXX', 'S&P/TSX - Canada': '^GSPTSE', 'VIX - USA': '^VIX', 'Russell 2000 - USA': '^RUT',
'Nasdaq Composite - USA': '^IXIC', 'Nasdaq 100 - USA': '^NDX', 'S&P 500 - USA': '^GSPC', 'Dow Jones - USA': '^DJI'
}
filename = input_settings['feature'].lower() + '_settings.json' filename = input_settings['feature'].lower() + '_settings.json'
f = open('csv/' + filename, 'r') f = open('csv/' + filename, 'r')
current_settings = json.load(f) current_settings = json.load(f)
@ -1038,6 +1062,11 @@ def save_trade_settings(input_settings):
input_settings['symbols'] = [commodities_dict[symbol] for symbol in input_settings['symbols']] input_settings['symbols'] = [commodities_dict[symbol] for symbol in input_settings['symbols']]
except: except:
pass pass
if input_settings['feature'] == 'Indices':
try:
input_settings['symbols'] = [indices_dict[symbol] for symbol in input_settings['symbols']]
except:
pass
current_settings = combine_dict(current_settings, input_settings['symbols'], 'symbols') current_settings = combine_dict(current_settings, input_settings['symbols'], 'symbols')