diff options
author | loit <michael.foiani@gmail.com> | 2025-07-31 13:20:08 -0400 |
---|---|---|
committer | loit <michael.foiani@gmail.com> | 2025-07-31 13:20:08 -0400 |
commit | 2f195e7f14e57e07ec291e8bfeee6da54ef35575 (patch) | |
tree | 572fccc4563c3bfb62f70d86ef271b70aedcf0ec /simulate.py | |
parent | de9b1d2297e02a71e06f386066c106406a9477f3 (diff) |
attemp using the alpaca api for history data
Diffstat (limited to 'simulate.py')
-rw-r--r-- | simulate.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/simulate.py b/simulate.py index 7b01c21..b576c4b 100644 --- a/simulate.py +++ b/simulate.py @@ -1,6 +1,6 @@ from algo import Algo from ema_algo import Ema_Algo -from api import fetch_chart_data, fetch_chart_data_backtest +from api import fetch_chart_data_yahoo, fetch_chart_data_backtest import datetime import json import random @@ -140,20 +140,22 @@ def run_batch(batch_name, algo, num_trials=100): # increment trial num i += 1 -run_batch('test', Ema_Algo(), 5) +# run_batch('test', Ema_Algo(), 5) def test(): print("MAIN simulate.py") ema_algo = Ema_Algo() - ticker = 'ADA-USD' + ticker = 'XRP-USD' period = '5d' interval = '1m' # get data # data = fetch_chart_data(ticker, period, interval) - data = fetch_chart_data_backtest() + # period_end_date = datetime.datetime.now(tz=datetime.timezone.utc) - datetime.timedelta(days=7) + # print(period_end_date) + data = fetch_chart_data_yahoo(ticker) print(data.keys()) url_params = { @@ -175,3 +177,5 @@ def test(): fd = open('bt-recent.json', 'w') fd.write(json.dumps(trial_data)) fd.close() + +test()
\ No newline at end of file |