Last active
June 30, 2021 16:19
-
-
Save chicago-joe/447a55c18467c4e82c4c9a02c1238e1e to your computer and use it in GitHub Desktop.
nested for loop - map of maps exercise
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
strategies = ['strategy_1', 'strategy_2', 'strategy_3', 'strategy_4'] | |
aggregation_types = | |
[ | |
['account', 'ticker'], | |
['account', 'strategy', 'ticker'], | |
['account', 'strategy', 'strategyLevel', 'ticker'] | |
] | |
if __name__ == '__main__': | |
dfTotal = pd.DataFrame() | |
for strat in strategies: | |
account_list = get_accounts(strat) | |
for agg in aggregation_types: | |
df = run_risk_model(accounts = account_list, | |
strategy = strat, | |
aggregation = agg, | |
benchmark = 'SPY' | |
) | |
dfTotal = dfTotal.append(df, ignore_index = True) | |
# finally upload all data to mysql database | |
uploadToDatabase(dfTotal) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment