northwesternfintech / Desk-Alpha

1 stars 3 forks source link

Ms_gmr_strat Backtest Issue #27

Closed kliu3638 closed 1 year ago

kliu3638 commented 1 year ago

Ran the following code:

import testStrat

s = Strategy(
    algo=None,
    transaction_cost=0.0001,
    start_balance=10000,
    name='test'
)

a = testStrat.Ms_gmr_strat()
s.set_algo(a)

s.back_testing()

Outputs the following error:

kevin@kevins-mbp-2 backtesting % /opt/home brew/bin/python3 /Users/kevin/Documents/Gi tHub/Core/core/backtesting/strategy.py [['buy', 'test', 1050, 1], ['sell', 'test', 1040, 1]]

Started Traceback (most recent call last): File "/Users/kevin/Documents/GitHub/Core/core/backtesting/strategy.py", line 484, in s.back_testing() File "/Users/kevin/Documents/GitHub/Core/core/backtesting/strategy.py", line 181, in back_testing tickOrders = self.algo.update(ticker_data_dict) TypeError: Ms_gmr_strat.update() takes 1 positional argument but 2 were given

Not sure if helpful, but the backtester calls update() on a dictionary with the tickers as dictionary keys and open values as dictionary values.

jiale0402 commented 1 year ago

please be informed that a dict of prices will be feed to the algo every tick, so account for it when writing your update function

kliu3638 commented 1 year ago

also need to init using kwargs

echavemann commented 1 year ago

deprecating, gj