When requesting get_portfolio_history intraday equity appears to be calculated by profit_loss added to base_value. When requesting more than one day, intraday profit_loss returns are relative to their respective day base_value, however equity appears to be calculated by adding profit_loss to the initial day base_value. The result is incorrect equity values when requesting timeframes <1 day on periods >1 day.
To Reproduce
Crude client side fix example below. Not sure if this comes from the raw api output or is isolated to the python rest api, but in either case there are probably more efficient ways to do it.
data = api.get_portfolio_history(period='4D', timeframe='1Min')
history = np.array(data.equity)
When requesting get_portfolio_history intraday equity appears to be calculated by profit_loss added to base_value. When requesting more than one day, intraday profit_loss returns are relative to their respective day base_value, however equity appears to be calculated by adding profit_loss to the initial day base_value. The result is incorrect equity values when requesting timeframes <1 day on periods >1 day.
To Reproduce
Crude client side fix example below. Not sure if this comes from the raw api output or is isolated to the python rest api, but in either case there are probably more efficient ways to do it.