예제 #1
0
 public bool TryPickPendingCancel(string id, out OrderRecord record)
 {
     if (_pendingCancel.TryGetValue(id, out record))
     {
         _pendingCancel.Remove(id);
         return(true);
     }
     return(false);
 }
예제 #2
0
        public void AddCancelPending(Order order)
        {
            var key = _orderIds[order.Id];

            if (!_working.TryGetValue(key, out var record))
            {
                record = new OrderRecord(order);
            }
            _pendingCancel[key] = record;
        }
예제 #3
0
 public OrderRecord PendingToWorking(string localId, string orderId)
 {
     if (_pendingNew.TryGetValue(localId, out var order))
     {
         _pendingNew.Remove(localId);
         var record = new OrderRecord(order);
         _working.Add(orderId, record);
         _orderIds[order.Id] = orderId;
         return(record);
     }
     return(null);
 }
예제 #4
0
        private static ExecutionReport CreateReport(OrderRecord record, OrderStatus ordStatus, ExecType execType, string text = "")
        {
            var report = new ExecutionReport(record.Order);

            report.DateTime  = DateTime.Now;
            report.AvgPx     = record.AvgPx;
            report.CumQty    = record.CumQty;
            report.LeavesQty = record.LeavesQty;
            report.OrdStatus = ordStatus;
            report.ExecType  = execType;
            report.Text      = text == "" ? record.Order.Text : text;
            return(report);
        }
예제 #5
0
 private bool TryPickWorking(string orderId, out OrderRecord record, bool remove = true)
 {
     if (_working.TryGetValue(orderId, out record))
     {
         if (remove)
         {
             _working.Remove(orderId);
             _orderIds.Remove(record.Order.Id);
         }
         return(true);
     }
     return(false);
 }
예제 #6
0
 public bool TryPickRejected(string id, out OrderRecord record)
 {
     return(TryPickWorking(id, out record));
 }
예제 #7
0
 public bool TryPeek(string id, out OrderRecord record)
 {
     return(TryPickWorking(id, out record, false));
 }
예제 #8
0
 public bool TryPickCancelled(string id, out OrderRecord record)
 {
     return(TryPickWorking(id, out record));
 }