Пример #1
0
        public void IsolatedAccountsTest(string contractCode)
        {
            bool   has_data = false;
            string tp       = null;

            if (contractCode != "*")
            {
                tp = contractCode.Split("-")[1].ToUpper();
            }
            client.IsolatedSubAcounts(contractCode, delegate(IsolatedSubAccountsResponse 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.IsolatedUnsubAccounts(contractCode);
            System.Threading.Thread.Sleep(1000 * 5);
        }
Пример #2
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);
        }