trade-executor
trade-executor copied to clipboard
incorrect profit on frontend 2
When a position 'loses' tokens, possibly due to the repair command being broken, the profit reported on the frontend strategy page is wrong.
E.g. see this strategy and these positions. In both those two positions, the opening trade has a much higher quantity than the closing trade. So different methods of working out profit are giving different results.
- https://tradingstrategy.ai/strategies/enzyme-polygon-eth-usdc/closed-positions/22
- https://tradingstrategy.ai/strategies/enzyme-polygon-eth-usdc/closed-positions/21
2 possible fixes (ideally both applied):
- [ ] make sure profit calculation can account for missing tokens
- [ ] make sure missing tokens never occurs
Or alternatively, have safety check that get_realised_profit_percent() == get_total_profit_percent()
for a closed position
See related Discord thread