Exemple #1
0
        public void PlaceOrderTest(string contractCode, string triggerType, double triggerPrice, string direction, string offset, long volume,
                                   double orderPrice, string orderPriceType, int?leverRate)
        {
            TriggerOrder.PlaceOrderRequest request = new TriggerOrder.PlaceOrderRequest
            {
                contractCode   = contractCode,
                triggerType    = triggerType,
                triggerPrice   = triggerPrice,
                volume         = volume,
                direction      = direction,
                offset         = offset,
                orderPrice     = orderPrice,
                orderPriceType = orderPriceType,
                leverRate      = leverRate
            };
            var    result = client.IsolatedPlaceOrderAsync(request).Result;
            string strret = JsonConvert.SerializeObject(result, Formatting.Indented);

            Console.WriteLine(strret);
            Assert.Equal("ok", result.status);

            result = client.CrossPlaceOrderAsync(request).Result;
            strret = JsonConvert.SerializeObject(result, Formatting.Indented);
            Console.WriteLine(strret);
            Assert.Equal("ok", result.status);
        }
        // [InlineData("le", 43000, "buy", "open", 1, 43000, "limit", 5, null, "swap", "btc-usdt")]
        // [InlineData("le", 43000, "buy", "open", 1, 43000, "limit", 5, "BTC-HUSD", null, null)]
        // [InlineData("le", 43000, "buy", "open", 1, 43000, "limit", 5, null, "swap", "btc-husd")]
        public void CrossPlaceOrderTest(string triggerType, double triggerPrice, string direction, string offset, long volume,
                                        double orderPrice, string orderPriceType, int?leverRate,
                                        string contractCode, string contractType, string pair,
                                        int?reduceOnly)
        {
            TriggerOrder.PlaceOrderRequest request2 = new TriggerOrder.PlaceOrderRequest
            {
                triggerType    = triggerType,
                triggerPrice   = triggerPrice,
                volume         = volume,
                direction      = direction,
                offset         = offset,
                orderPrice     = orderPrice,
                orderPriceType = orderPriceType,
                leverRate      = leverRate,
                contractCode   = contractCode,
                contractType   = contractType,
                pair           = pair,
                reduceOnly     = reduceOnly
            };
            var result = client.CrossPlaceOrderAsync(request2).Result;
            var strret = JsonConvert.SerializeObject(result, Formatting.Indented);

            Console.WriteLine(strret);
            Assert.Equal("ok", result.status);
            Console.WriteLine("------------");
        }