Exemplo n.º 1
0
        /// <summary>
        /// sub orders
        /// </summary>
        /// <param name="symbol"></param>
        /// <param name="callbackFun"></param>
        /// <param name="cid"></param>
        public void SubOrders(string symbol, _OnSubOrdersResponse callbackFun, string cid = _DEFAULT_CID)
        {
            string   ch     = $"orders.{symbol}";
            WSOpData opData = new WSOpData {
                op = "sub", topic = ch
            };

            Sub(JsonConvert.SerializeObject(opData), ch, callbackFun, typeof(SubOrdersResponse));
        }
        /// <summary>
        /// cross margin sub orders
        /// </summary>
        /// <param name="contractCode"></param>
        /// <param name="callbackFun"></param>
        /// <param name="cid"></param>
        public void CrossSubOrders(string contractCode, _OnSubOrdersResponse callbackFun, string cid = _DEFAULT_CID)
        {
            string   ch     = $"orders_cross.{contractCode}";
            WSOpData opData = new WSOpData {
                op = "sub", topic = ch
            };

            Sub(JsonConvert.SerializeObject(opData), ch, callbackFun, typeof(SubOrdersResponse));
        }
        /// <summary>
        /// sub orders
        /// </summary>
        /// <param name="symbol"></param>
        /// <param name="callbackFun"></param>
        public void SubOrders(string symbol, _OnSubOrdersResponse callbackFun)
        {
            string       ch         = $"orders#{symbol}";
            WSActionData actionData = new WSActionData {
                action = "sub", ch = ch
            };
            string sub_str = JsonConvert.SerializeObject(actionData);

            WebSocketOp wsop = new WebSocketOp(this.path, sub_str, callbackFun, typeof(SubOrdersResponse), true, this.host,
                                               this.accessKey, this.secretKey, true);

            wsop.Connect();
        }
Exemplo n.º 4
0
        /// <summary>
        /// cross margin sub orders
        /// </summary>
        /// <param name="contractCode"></param>
        /// <param name="callbackFun"></param>
        /// <param name="cid"></param>
        public void CrossSubOrders(string contractCode, _OnSubOrdersResponse callbackFun, string cid = WebSocketOp.DEFAULT_ID)
        {
            string   ch     = $"orders_cross.{contractCode}";
            WSOpData opData = new WSOpData {
                op = "sub", topic = ch
            };
            string sub_str = JsonConvert.SerializeObject(opData);

            WebSocketOp wsop = new WebSocketOp(this.path, sub_str, callbackFun, typeof(SubOrdersResponse), true, this.host,
                                               this.accessKey, this.secretKey);

            wsop.Connect();
            if (!allWsop.ContainsKey(ch))
            {
                allWsop.Add(ch, wsop);
            }
        }