Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        // [InlineData("usdt", null, null)]
        // [InlineData("husd", null, "husd")]
        // [InlineData("husd", null, "all")]
        public void AccountsTest(string marginAccount, string cid, string tradePartition)
        {
            bool   has_data = false;
            string tp       = null;

            if (tradePartition == null || tradePartition.ToLower() == "usdt")
            {
                tp = "USDT";
            }
            else
            {
                tp = "HUSD";
            }
            client.CrossSubAcounts(marginAccount, delegate(CrossSubAccountsResponse data)
            {
                Console.WriteLine(JsonConvert.SerializeObject(data));
                if (marginAccount != "*")
                {
                    foreach (var d in data.data)
                    {
                        foreach (var item in d.contractDetail)
                        {
                            Assert.Equal(tp, item.tradePartition);
                        }
                        foreach (var item in d.futuresContractDetail)
                        {
                            Assert.Equal(tp, item.tradePartition);
                        }
                    }
                }
                has_data = true;
            }, cid, tradePartition);
            System.Threading.Thread.Sleep(1000 * 20);
            Assert.Equal(true, has_data);
            client.CrossUnsubAccounts(marginAccount);
            System.Threading.Thread.Sleep(1000 * 5);
        }