예제 #1
0
        private void OrderFilledHandler(OrderFilledData data)
        {
            TraderInfo traderInfo = TraderStatistic.Find(x => x.Symbol.Equals(data.Symbol));

            if (traderInfo != null)
            {
                traderInfo.Update(data);
                TraderInfoChanged?.Invoke(traderInfo);
            }

            // Code below is usefull?
            List <Trade> updatedPositions = new List <Trade>();
            List <Trade> allTrades        = new List <Trade>();

            foreach (Trade trade in data.Trades)
            {
                trade.Symbol = data.Symbol;
                updatedPositions.Add(trade);
            }

            foreach (Trade trade in data.RawTrades)
            {
                trade.Symbol = data.Symbol;
                allTrades.Add(trade);
            }
            NewTrades?.Invoke(updatedPositions, allTrades);

            _receiver.OrderFilledHandle(data);
        }
예제 #2
0
        private void FundingHandler(FundingData data)
        {
            TraderInfo traderInfo = TraderStatistic.Find(x => x.Symbol.Equals(data.Symbol));

            if (traderInfo != null)
            {
                traderInfo.Update(data);
                TraderInfoChanged?.Invoke(traderInfo);
            }

            // Code below is usefull?
            List <Trade> allTrades = new List <Trade>();

            foreach (Trade trade in data.Trades)
            {
                trade.Symbol = data.Symbol; allTrades.Add(trade);
            }
            NewTrades?.Invoke(new List <Trade>(), allTrades);
        }
예제 #3
0
 private void RaiseNewTrade(Trade trade)
 {
     NewTrade?.Invoke(trade);
     NewTrades?.Invoke(new[] { trade });
 }
예제 #4
0
 private void RealTraderOnNewTrades(IEnumerable <Trade> trades)
 {
     NewTrades?.Invoke(this, new TradesEventArgs(trades));
 }