Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public void WSLiquidationOrdersTest(string contractCode, string businessType, string tradePartition)
        {
            string tp = null;

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

            client.SubLiquidationOrders(contractCode, delegate(SubLiquidationOrdersResponse data)
            {
                Console.WriteLine(JsonConvert.SerializeObject(data));
                foreach (var item in data.data)
                {
                    Assert.Equal(tp, item.tradePartition);
                }
            }, null, businessType, tradePartition);
            System.Threading.Thread.Sleep(1000 * 10);
            client.UnsubLiquidationOrders(contractCode, null, businessType, tradePartition);
            System.Threading.Thread.Sleep(1000 * 5);

            Console.WriteLine("------------");
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
0
        //[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);
        }
Ejemplo n.º 6
0
        //[InlineData("*")]
        public void WSLiquidationOrdersTest(string symbol)
        {
            WSNotifyClient client = new WSNotifyClient();

            client.SubLiquidationOrders(symbol, delegate(SubLiquidationOrdersResponse data)
            {
                Console.WriteLine(JsonConvert.SerializeObject(data));
            });
            System.Threading.Thread.Sleep(1000 * 1200);
            client.UnsubLiquidationOrders(symbol);
            System.Threading.Thread.Sleep(1000 * 5);
        }
Ejemplo n.º 7
0
        public void PositionsTest(string symbol)
        {
            WSNotifyClient client = new WSNotifyClient(config["AccessKey"], config["SecretKey"]);

            client.SubPositions(symbol, delegate(SubPositionsResponse data)
            {
                Console.WriteLine(JsonConvert.SerializeObject(data));
            });
            System.Threading.Thread.Sleep(1000 * 60);
            client.UnsubPositions(symbol);
            System.Threading.Thread.Sleep(1000 * 60);
        }
Ejemplo n.º 8
0
        public void MatchOrdersTest(string contractCode)
        {
            WSNotifyClient client = new WSNotifyClient(config["AccessKey"], config["SecretKey"]);

            client.SubMatchOrders(contractCode, delegate(SubOrdersResponse data)
            {
                Console.WriteLine(JsonConvert.SerializeObject(data));
            });
            System.Threading.Thread.Sleep(1000 * 60 * 1);
            client.UnsubMathOrders(contractCode);
            System.Threading.Thread.Sleep(1000 * 60);
        }
Ejemplo n.º 9
0
        //[InlineData("*")]
        public void WSLiquidationOrdersTest(string contractCode, string businessType)
        {
            WSNotifyClient client = new WSNotifyClient();

            client.SubLiquidationOrders(contractCode, delegate(SubLiquidationOrdersResponse data)
            {
                Console.WriteLine(JsonConvert.SerializeObject(data));
            }, null, businessType);
            System.Threading.Thread.Sleep(1000 * 60);
            client.UnsubLiquidationOrders(contractCode, null, businessType);
            System.Threading.Thread.Sleep(1000 * 5);

            Console.WriteLine("------------");
        }
Ejemplo n.º 10
0
        public void PositionsTest(string contractCode)
        {
            WSNotifyClient client = new WSNotifyClient(config["AccessKey"], config["SecretKey"]);

            client.IsolatedSubPositions(contractCode, delegate(SubPositionsResponse data)
            {
                Console.WriteLine(JsonConvert.SerializeObject(data));
            });
            System.Threading.Thread.Sleep(1000 * 15);
            client.IsolatedUnsubPositions(contractCode);
            System.Threading.Thread.Sleep(1000 * 5);

            client.CrossSubPositions(contractCode, delegate(SubPositionsResponse data)
            {
                Console.WriteLine(JsonConvert.SerializeObject(data));
            });
            System.Threading.Thread.Sleep(1000 * 15);
            client.CrossUnsubPositions(contractCode);
            System.Threading.Thread.Sleep(1000 * 5);
        }
Ejemplo n.º 11
0
        public void AccountsTest(string contractCode, string marginAccount)
        {
            WSNotifyClient client = new WSNotifyClient(config["AccessKey"], config["SecretKey"]);

            client.IsolatedSubAcounts(contractCode, delegate(IsolatedSubAccountsResponse data)
            {
                Console.WriteLine(JsonConvert.SerializeObject(data));
            });
            System.Threading.Thread.Sleep(1000 * 20);
            client.IsolatedUnsubAccounts(contractCode);
            System.Threading.Thread.Sleep(1000 * 5);

            client.CrossSubAcounts(marginAccount, delegate(CrossSubAccountsResponse data)
            {
                Console.WriteLine(JsonConvert.SerializeObject(data));
            });
            System.Threading.Thread.Sleep(1000 * 20);
            client.CrossUnsubAccounts(marginAccount);
            System.Threading.Thread.Sleep(1000 * 5);
        }