From 2f195e7f14e57e07ec291e8bfeee6da54ef35575 Mon Sep 17 00:00:00 2001 From: loit Date: Thu, 31 Jul 2025 13:20:08 -0400 Subject: attemp using the alpaca api for history data --- simulate.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'simulate.py') 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 -- cgit v1.2.3-70-g09d2