コード例 #1
0
 private void RemoveOrder(BookDone removeOrder)
 {
     if (removeOrder.Side == SideType.Buy)
     {
         var offer = Buys.FirstOrDefault(a => a.OrderId == removeOrder.OrderId);
         if (offer != null)
         {
             Buys.Remove(offer);
         }
         else if (!RemoveReceiveOrder(removeOrder.OrderId))
         {
             Api.Log.Warning($"Order not found for {removeOrder.Reason} buy offer : {removeOrder.OrderId}");
         }
     }
     else
     {
         var offer = Sells.FirstOrDefault(b => b.OrderId == removeOrder.OrderId);
         if (offer != null)
         {
             Sells.Remove(offer);
         }
         else if (!RemoveReceiveOrder(removeOrder.OrderId))
         {
             Api.Log.Warning($"Order not found for {removeOrder.Reason} sell offer : {removeOrder.OrderId}");
         }
     }
 }
コード例 #2
0
        public Task <OrderResponse> PutLimitOrder(SideType side, ProductType productType, decimal price, decimal size, Guid?clientId, bool?postOnly)
        {
            var done = new BookDone
            {
                ProductType   = productType,
                OrderId       = Guid.NewGuid(),
                Price         = price,
                Side          = side,
                RemainingSize = size,
                Reason        = OrderReason.Filled
            };
            var reponse = new OrderResponse
            {
                CreatedAt   = DateTime.UtcNow,
                Price       = price,
                Size        = size,
                ProductType = productType,
                Id          = done.OrderId,
                Side        = side
            };

            _waitingOrder.Enqueue(done);
            return(Task.FromResult(reponse));
        }