Ejemplo n.º 1
0
        // [InlineData("btc-usdt")]
        // [InlineData("btc-husd")]
        public void IsolatedPositionsTest(string contractCode)
        {
            bool   has_data = false;
            string tp       = null;

            if (contractCode != "*")
            {
                tp = contractCode.Split("-")[1].ToUpper();
            }
            client.IsolatedSubPositions(contractCode, delegate(SubPositionsResponse data)
            {
                Console.WriteLine(JsonConvert.SerializeObject(data));
                if (tp != null)
                {
                    foreach (var item in data.data)
                    {
                        Assert.Equal(tp, item.tradePartition);
                    }
                }
                has_data = true;
            });
            System.Threading.Thread.Sleep(1000 * 10);
            Assert.Equal(true, has_data);
            client.IsolatedUnsubPositions(contractCode);
            System.Threading.Thread.Sleep(1000 * 5);
        }
Ejemplo n.º 2
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);
        }