Fix roi with fees
This commit is contained in:
@@ -722,10 +722,10 @@ public class LiveTradingBotGrain : Grain, ILiveTradingBotGrain, IRemindable
|
||||
var fees = _tradingBot.GetTotalFees();
|
||||
var volume = TradingBox.GetTotalVolumeTraded(_tradingBot.Positions);
|
||||
|
||||
// Calculate ROI based on total investment
|
||||
// Calculate ROI based on total investment (PnL minus fees)
|
||||
var totalInvestment = _tradingBot.Positions.Values
|
||||
.Sum(p => p.Open.Quantity * p.Open.Price);
|
||||
var roi = totalInvestment > 0 ? (pnl / totalInvestment) * 100 : 0;
|
||||
var roi = totalInvestment > 0 ? ((pnl - fees) / totalInvestment) * 100 : 0;
|
||||
|
||||
// Calculate long and short position counts
|
||||
var longPositionCount = _tradingBot.Positions.Values
|
||||
|
||||
Reference in New Issue
Block a user