コード例 #1
0
        private void ReadOrderUpdateData(byte[] data, ref int offset)
        {
            string orderUpdateJsonPacket = Encoding.UTF8.GetString(data.SubArray(5, data.Length - 5));

            var deserializedPacket = JsonConvert.DeserializeObject <Dictionary <string, object> >(orderUpdateJsonPacket);

            OrderUpdate order = new OrderUpdate();

            order.AverageTradePrice = Convert.ToDouble(deserializedPacket["average_price"]);
            order.ClientId          = deserializedPacket["client_id"].ToString();
            order.DisclosedQuantity = Convert.ToInt32(deserializedPacket["disclosed_quantity"]);
            order.Exchange          = deserializedPacket["exchange"].ToString();
            order.ExchangeOrderId   = deserializedPacket["exchange_order_id"].ToString();
            order.ExchangeTime      = Convert.ToInt64(deserializedPacket["exchange_time"]);
            order.FilledQuantity    = Convert.ToInt32(deserializedPacket["filled_quantity"]);
            order.InstrumentToken   = Convert.ToInt32(deserializedPacket["instrument_token"]);
            order.LoginId           = deserializedPacket["login_id"].ToString();
            order.OmsOrderId        = deserializedPacket["oms_order_id"].ToString();
            order.OrderEntryTime    = Convert.ToInt64(deserializedPacket["order_entry_time"]);
            order.OrderStatus       = deserializedPacket["order_status"].ToString();
            order.OrderType         = deserializedPacket["order_type"].ToString();
            order.Price             = Convert.ToDouble(deserializedPacket["price"]);
            order.Product           = deserializedPacket["product"].ToString();
            order.Quantity          = Convert.ToInt32(deserializedPacket["quantity"]);
            order.RejectionReason   = deserializedPacket["rejection_reason"].ToString();
            order.RemainingQuantity = Convert.ToInt32(deserializedPacket["remaining_quantity"]);
            order.TradingSymbol     = deserializedPacket["trading_symbol"].ToString();
            order.TriggerPrice      = Convert.ToDouble(deserializedPacket["trigger_price"]);
            order.userOrderId       = deserializedPacket["user_order_id"].ToString();
            order.Validity          = deserializedPacket["validity"].ToString();
            order.OrderSide         = deserializedPacket["order_side"].ToString();
            order.Procli            = deserializedPacket["pro_cli"].ToString();
            order.nnfid             = deserializedPacket["nnfid"].ToString();
            OnOrderUpdateReceive(order);
        }
コード例 #2
0
        private void OnOrderUpdateReceive(OrderUpdate orderUpdate)
        {
            var handler = OrderUpdateEvent;

            handler?.Invoke(orderUpdate);
        }