コード例 #1
0
        public void FundingRateTest(string contractCode, string cid, 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.SubFundingRate(contractCode, delegate(SubFundingRateResponse data)
            {
                Console.WriteLine(JsonConvert.SerializeObject(data));
                foreach (var item in data.data)
                {
                    Assert.Equal(tp, item.tradePartition);
                }
                has_data = true;
            }, cid, tradePartition);
            System.Threading.Thread.Sleep(1000 * 10);
            Assert.Equal(true, has_data);
            client.UnsubFundingRate(contractCode, cid, tradePartition);
            System.Threading.Thread.Sleep(1000 * 5);
        }
コード例 #2
0
        public void FundingRateTest(string contractCode)
        {
            WSNotifyClient client = new WSNotifyClient();

            client.SubFundingRate(contractCode, delegate(SubFundingRateResponse data)
            {
                Console.WriteLine(JsonConvert.SerializeObject(data));
            });
            System.Threading.Thread.Sleep(1000 * 15);
            client.UnsubFundingRate(contractCode);
            System.Threading.Thread.Sleep(1000 * 5);
        }