Closed AlexTheLion123 closed 1 year ago
@Mikko Ohtamaa#5448 Can you help me understand why we rebuild the asset_histories
in build_trade_analysis
, causing us to kind of duplicate TradingPosition
with the TradePosition
class and also introduce SpotTrade
class?
Because in calculate_summary_statistics, we could loop through self.portfolio.get_all_positions
instead of using rebuilt self.get_all_positions
, unless I'm missing something.
The only thing I can see is the rebuilding filters out failed trades and does this:
if trade.planned_mid_price not in (0, None):
price = trade.planned_mid_price
else:
# TODO: Legacy trades.
# mid_price is filled to all latest trades
price = trade.executed_price
bad_data_issues = True
which could maybe be done without rebuilding?
Have opened #259 to move to non-rebuilding approach and remove duplicates
Currently blocked until #259 is merged
Now unblocked, having a look again
Doesn't appear to be an issue anymore, returns appear to now be showing correct value
See this Discord message
The curve suggests 30-35% return %. Different total profit/value at the end