Skip to content

Instantly share code, notes, and snippets.

@chicago-joe
Last active June 30, 2021 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chicago-joe/447a55c18467c4e82c4c9a02c1238e1e to your computer and use it in GitHub Desktop.
Save chicago-joe/447a55c18467c4e82c4c9a02c1238e1e to your computer and use it in GitHub Desktop.
nested for loop - map of maps exercise
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