When I change the input parameters to AMD for example it does find AMD news. However, it does not create a comparison graph with AMD. The comparison graphs only work with SPY.
I changed the code like this:
start_date = datetime(2023,6,30)
end_date = datetime(2024,1,29)
inputParameters = {"symbol":"AMD",
"cash_at_risk":.5}
broker = Alpaca(ALPACA_CREDS)
strategy = MLTrader(name='mlstrat', broker=broker,
parameters=inputParameters)
strategy.backtest(
YahooDataBacktesting,
start_date,
end_date,
parameters=inputParameters
)
And in the class like this:
class MLTrader(Strategy):
def initialize(self, symbol:str="AMD", cash_at_risk:float=.5):
self.symbol = symbol
self.sleeptime = "24H"
self.last_trade = None
self.cash_at_risk = cash_at_risk
self.api = REST(base_url=BASE_URL, key_id=API_KEY, secret_key=API_SECRET)
When I change the input parameters to AMD for example it does find AMD news. However, it does not create a comparison graph with AMD. The comparison graphs only work with SPY.
I changed the code like this: start_date = datetime(2023,6,30) end_date = datetime(2024,1,29) inputParameters = {"symbol":"AMD", "cash_at_risk":.5} broker = Alpaca(ALPACA_CREDS) strategy = MLTrader(name='mlstrat', broker=broker, parameters=inputParameters) strategy.backtest( YahooDataBacktesting, start_date, end_date, parameters=inputParameters )
And in the class like this: class MLTrader(Strategy): def initialize(self, symbol:str="AMD", cash_at_risk:float=.5): self.symbol = symbol self.sleeptime = "24H" self.last_trade = None self.cash_at_risk = cash_at_risk self.api = REST(base_url=BASE_URL, key_id=API_KEY, secret_key=API_SECRET)