Example #1
0
        public void ContractInfoTest(string contractCode, string businessType, string tradePartition)
        {
            bool   has_data = false;
            string tp       = null;

            if (tradePartition == null || tradePartition.ToLower() == "usdt")
            {
                tp = "USDT";
            }
            else
            {
                tp = "HUSD";
            }
            WSNotifyClient client = new WSNotifyClient();

            client.SubContractInfo(contractCode, delegate(SubContractInfoResponse data)
            {
                Console.WriteLine(JsonConvert.SerializeObject(data));
                foreach (var item in data.data)
                {
                    Assert.Equal(tp, item.tradePartition);
                }
                has_data = true;
            }, null, businessType, tradePartition);
            System.Threading.Thread.Sleep(1000 * 10);
            Assert.Equal(true, has_data);
            client.UnsubContractInfo(contractCode, null, businessType, tradePartition);
            System.Threading.Thread.Sleep(1000 * 5);
        }
Example #2
0
        public void ContractInfoTest(string contractCode, string businessType)
        {
            WSNotifyClient client = new WSNotifyClient();

            client.SubContractInfo(contractCode, delegate(SubContractInfoResponse data)
            {
                Console.WriteLine(JsonConvert.SerializeObject(data));
            }, null, businessType);
            System.Threading.Thread.Sleep(1000 * 60);
            client.UnsubContractInfo(contractCode, null);
            System.Threading.Thread.Sleep(1000 * 5);
        }
        //[InlineData("*")]
        public void ContractInfoTest(string symbol)
        {
            WSNotifyClient client = new WSNotifyClient();

            client.SubContractInfo(symbol, delegate(SubContractInfoResponse data)
            {
                Console.WriteLine(JsonConvert.SerializeObject(data));
            });
            System.Threading.Thread.Sleep(1000 * 15);
            client.UnsubContractInfo(symbol);
            System.Threading.Thread.Sleep(1000 * 5);
        }