private void UpdateCurrentTrades(TradeModel trade) { FlatTradeModel flatTrade = _blCurrentTrades.Where(x => object.Equals(x.Trade.CurrencyPair, trade.CurrencyPair)).First(); flatTrade.Trade = trade; dgvCurrentTrades.Refresh(); if (CheckTolerance(trade)) { PerformSell(trade, false); } CalculTotalProfit(); }
private void AddBot(TradeModel trade) { if (!_blCurrentTrades.Select(x => x.CurrencyPair).Contains(trade.CurrencyPair.ToString())) { FlatTradeModel flatTrade = new FlatTradeModel(trade); _blCurrentTrades.Add(flatTrade); Subject <SignalModel> manualSignal = SetManualSignal(); _signal = new Signal(trade.CurrencyPair); _subsSignals.Add(trade.CurrencyPair, _signal.DataSource .Merge(manualSignal) .ObserveOn(WindowsFormsSynchronizationContext.Current) .Subscribe(x => AnalyseSignal(trade, x))); } else { txtLogs.AppendText($"Bot {trade.CurrencyPair} => Already running{Environment.NewLine}"); } }
private void AddClosedTrade(TradeModel trade) { FlatTradeModel flatTrade = new FlatTradeModel(trade); _blClosedTrades.Add(flatTrade); }