private void OnCompleted() { TraderState.Budget.Profit = TraderState.Trades.Sum(t => t.Profit); foreach (var trade in TraderState.Trades) { Log($"{TraderState.Trades.IndexOf(trade)}\t{trade.Status}\t{trade.Profit}"); } Log($"Profit: {TraderState.Budget.Profit}"); Log($"Available: {TraderState.Budget.Available}"); Log($"Invested: {TraderState.Budget.Invested}"); Log($"Earned: {TraderState.Budget.Earned}"); PriceUpdated.OnCompleted(); _taskCompletionSource.SetResult(TraderState.Budget); }
private void OnCompleted() { TraderState.Budget.Profit = TraderState.Trades.Sum(t => t.Profit); foreach (var trade in TraderState.Trades.OrderByDescending(t => t.Profit)) { Log($"{TraderState.Trades.IndexOf(trade)}" + $"\t{trade.Status}" + $"\t{trade.Profit}" + $"\t{trade.BuyReason}" + $"\t{trade.BuyOrder.PricePerUnit}" + $"\t{trade.SellReason}" + $"\t{trade.SellOrder.PricePerUnit}"); } Log($"Profit: {TraderState.Budget.Profit}"); Log($"Available: {TraderState.Budget.Available}"); Log($"Invested: {TraderState.Budget.Invested}"); Log($"Earned: {TraderState.Budget.Earned}"); PriceUpdated.OnCompleted(); _taskCompletionSource.SetResult(TraderState.Budget); }