private static void WriteResult(decimal percentOfProfit, StrategyPlayer strategyPlayer, decimal deposit, string currency) { Console.WriteLine( $"PercentOfProfit for period {strategyPlayer.PlayedPositions.First().OpenTimestamp} - {strategyPlayer.PlayedPositions.Last().CloseTimestamp} : {percentOfProfit}%");; Console.WriteLine($"Deposit after this period : {Math.Round(deposit, 2)} {currency}"); Console.WriteLine(); }
private static void CalculateCurrentDeposit(StrategyPlayer strategyPlayer, ref decimal deposit, decimal fee) { foreach (var position in strategyPlayer.PlayedPositions) { if (position.Direction == PositionDirection.Long) { deposit += (deposit * (position.ClosePrice - position.OpenPrice) / position.OpenPrice) - position.OpenPrice * fee; } else if (position.Direction == PositionDirection.Short) { deposit += deposit * (position.OpenPrice - position.ClosePrice) / position.OpenPrice - position.OpenPrice * fee; } } }