Skip to content

Commit

Permalink
test runs for backtest
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-abuke committed Jun 22, 2024
1 parent 0c42b2f commit 98bb231
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
9 changes: 5 additions & 4 deletions scripts/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"initial_cash": 20000000,
"start_date": "2023-05-16",
"end_date": "2024-05-30",
"ticker": "NVDA"
"initial_cash": 200,
"start_date": "2023-10-16",
"end_date": "2024-06-16",
"ticker": "TSLA",
"indicator": "RSI"
}
16 changes: 8 additions & 8 deletions scripts/indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,21 +185,21 @@ def run_backtest(config):
}
}
# Save the results to a JSON file
with open(f'results/backtest_results_{ticker}_{start_date}_to_{end_date}_{indicator}.json', 'w') as f:
with open(f'scripts/results/backtest_results_{ticker}_{start_date}_to_{end_date}_{indicator}.json', 'w') as f:
json.dump(backtest_results, f, indent=4)

# Print results
print(json.dumps(backtest_results, indent=4))

if __name__ == '__main__':
with open('config.json', 'r') as f:
with open('scripts/config.json', 'r') as f:
config = json.load(f)

initial_cash, start_date, end_date, ticker, indicator = get_user_input()
config['initial_cash'] = initial_cash
config['start_date'] = start_date
config['end_date'] = end_date
config['ticker'] = ticker
config['indicator'] = indicator
# initial_cash, start_date, end_date, ticker, indicator = get_user_input()
# config['initial_cash'] = initial_cash
# config['start_date'] = start_date
# config['end_date'] = end_date
# config['ticker'] = ticker
# config['indicator'] = indicator

run_backtest(config)

0 comments on commit 98bb231

Please sign in to comment.