-
Notifications
You must be signed in to change notification settings - Fork 241
Open
Description
A crash happens when the first order is made and the portfolio is updated:
lumibot/strategies/_strategy.py
def _update_portfolio_value(self):
price = self.broker.data_source.get_last_price(asset.symbol) <- crashes because asset is a tuple for the crypto asset
This is a possible patch to fix it:
diff lumibot/lumibot/strategies/_strategy.py /opt/homebrew/anaconda3/envs/traidingbot/lib/python3.12/site-packages/lumibot/strategies/_strategy.py
60d59
< LOG_ERRORS_TO_CSV,
668d666
< asset_is_option = False
671,674c669,671
< elif asset.asset_type == "option":
< asset_is_option = True
<
< if self.broker.option_source is not None and asset_is_option:
---
> price = self.broker.data_source.get_last_price(asset)
> prices[asset] = price
> elif asset.asset_type == "option" and self.broker.option_source is not None:
678c675
< price = self.broker.data_source.get_last_price(asset)
---
> price = self.broker.data_source.get_last_price(asset.symbol)Metadata
Metadata
Assignees
Labels
No labels