コード例 #1
0
 // Parent orders
 public void Insert(BfProductCode productCode, BfParentOrderRequest req, BfParentOrderResponse resp)
 {
     ParentOrders.Add(new DbParentOrder(productCode, req, resp));
     for (int childOrderIndex = 0; childOrderIndex < req.Parameters.Count; childOrderIndex++)
     {
         ChildOrders.Add(new DbChildOrder(req, resp, childOrderIndex));
     }
 }
コード例 #2
0
        public BfxParentOrder(BfParentOrderRequest request)
        {
            Request     = request;
            ProductCode = request.Paremters[0].ProductCode;

            foreach (var childRequest in request.Paremters)
            {
                ChildOrders.Add(new BfxChildOrder(childRequest));
            }
        }
コード例 #3
0
        public void Upsert(BfProductCode productCode, BfaChildOrder order)
        {
            var rec = GetChildOrders().Where(e => e.ProductCode == productCode && e.AcceptanceId == order.ChildOrderAcceptanceId).FirstOrDefault();

            if (rec == default)
            {
                ChildOrders.Add(new DbChildOrder(productCode, order));
            }
            else
            {
                rec.Update(order);
            }
        }
コード例 #4
0
        public void Upsert(BfProductCode productCode, BfaChildOrder order, BfaParentOrderDetail detail, int childOrderIndex)
        {
            var rec = GetChildOrders().Where(e => e.ProductCode == productCode && e.AcceptanceId == order.ChildOrderAcceptanceId).FirstOrDefault();

            if (rec == default)
            {
                rec = new DbChildOrder(productCode, detail, childOrderIndex);
                rec.Update(order);
                ChildOrders.Add(rec);
            }
            else
            {
                rec.Update(detail, childOrderIndex);
                rec.Update(order);
            }
        }
        private void BitFlyer_ChildOrdersReceived(object sender, CollectionReceivedEventArgs <BitFlyerChildOrder> e)
        {
            var i = Instruments.FirstOrDefault(m => m.Id == e.Data[0].InstrumentId);

            if (i != null)
            {
                i.LastError = null;

                lock (ChildOrders)
                {
                    foreach (var m in e.Data)
                    {
                        ChildOrders.Add(new ChildOrderEntry(e.Action, i, m));
                    }

                    const int MAX = 100;
                    while (ChildOrders.Count > 100)
                    {
                        ChildOrders.RemoveAt(ChildOrders.Count - 1 - MAX);
                    }
                }
            }
        }
コード例 #6
0
 // Child orders
 public void Insert(BfChildOrderRequest req, BfChildOrderResponse resp)
 {
     ChildOrders.Add(new DbChildOrder(req, resp.ChildOrderAcceptanceId));
 }