Beispiel #1
0
        public async Task <string> GetPositionAsync(string contract_code)
        {
            string  url = _urlBuilder.Build(Constants.POST_METHOD, "/swap-api/v1/swap_position_info");
            JObject jo  = new JObject();

            jo.Add("contract_code", contract_code);
            var response = await PostAsync(url, jo.ToString());

            return(response);
        }
Beispiel #2
0
        public async Task <string> PlaceOrderAsync(string contract_code, double price, long volume, string direction, string offset, int lever_rate, string order_price_type)
        {
            string  url = _urlBuilder.Build(Constants.POST_METHOD, "/swap-api/v1/swap_order");
            JObject jo  = new JObject();

            jo.Add("contract_code", contract_code);
            if (!(order_price_type.StartsWith("opponent") || order_price_type.StartsWith("optimal")))
            {
                jo.Add("price", price);
            }
            jo.Add("volume", volume);
            jo.Add("direction", direction);
            jo.Add("offset", offset);
            jo.Add("lever_rate", lever_rate);
            jo.Add("order_price_type", order_price_type);
            var response = await PostAsync(url, jo.ToString());

            return(response);
        }