예제 #1
0
        // [InlineData(null, null,  42000, 1, "buy", "open", 5, "limit", "swap", "btc-usdt")]
        // [InlineData(null, null,  42000, 1, "buy", "open", 5, "limit", "quarter", "btc-usdt")]
        // [InlineData("btc-usdt-220121", null,  42000, 1, "buy", "open", 5, "limit", "quarter", "btc-usdt")]
        // [InlineData("btc-husd", null, 42000, 1, "buy", "open", 5, "limit", null, null)]
        // [InlineData(null, null,  42000, 1, "buy", "open", 5, "limit", "swap", "btc-husd")]
        // [InlineData(null, null,  42000, 1, "buy", "open", 5, "limit", "quarter", "btc-husd")]
        // [InlineData("btc-husd-220121", null,  42000, 1, "buy", "open", 5, "limit", "quarter", "btc-husd")]
        public void CrossPlaceOrderTest(string contractCode, long?clientOrderId, double price, long volume,
                                        string direction, string offset, int leverRate, string orderPriceType,
                                        string contractType, string pair, int?reduceOnly)
        {
            Order.PlaceOrderRequest request2 = new Order.PlaceOrderRequest
            {
                contractCode   = contractCode,
                clientOrderId  = clientOrderId,
                price          = price,
                volume         = volume,
                direction      = direction,
                offset         = offset,
                leverRate      = leverRate,
                orderPriceType = orderPriceType,
                contractType   = contractType,
                pair           = pair,
                // tpTriggerPrice = price + 200,
                // tpOrderPrice = price + 200,
                // tpOrderPriceType = orderPriceType,
                // slTriggerPrice = price - 200,
                // slOrderPrice = price - 200,
                // slOrderPriceType = orderPriceType,
                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("------------");
        }
예제 #2
0
        public void PlaceOrderTest(string contractCode, long?clientOrderId, double price, long volume,
                                   string direction, string offset, int leverRate, string orderPriceType)
        {
            Order.PlaceOrderRequest request = new Order.PlaceOrderRequest
            {
                contractCode   = contractCode,
                clientOrderId  = clientOrderId,
                price          = price,
                volume         = volume,
                direction      = direction,
                offset         = offset,
                leverRate      = leverRate,
                orderPriceType = orderPriceType
            };
            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);
        }