Example #1
0
        public async Task <BookTicker> GetBookTickerAsync(TraidingPair traidingPair)
        {
            HttpRequestMessage message = HttpBuilder.MakeRequest(APIEndPoint + "/bookTicker", new[] {
                new KeyValuePair <string, string>("symbol", traidingPair.ToString())
            });

            return(await Client.SendRequestAsync <BookTicker>(message));
        }
        public async Task <Leverage> SetLeverageAsync(TraidingPair traidingPair, int value)
        {
            HttpRequestMessage message = HttpBuilder.MakeRequest(HttpMethod.Post, $"{APIEndPoint}/leverage", new[] {
                new KeyValuePair <string, string>("symbol", traidingPair.ToString()),
                new KeyValuePair <string, string>("leverage", value.ToString()),
            });

            return(await Client.SendRequestAsync <Leverage>(message));
        }
        public async Task <Order> CancelAsync(TraidingPair traidingPair, long orderId)
        {
            HttpRequestMessage message = HttpBuilder.MakeRequest(HttpMethod.Delete, $"{APIEndPoint}/order", new[] {
                new KeyValuePair <string, string>("symbol", traidingPair.ToString()),
                new KeyValuePair <string, string>("orderId", orderId.ToString()),
            });

            return(await Client.SendRequestAsync <Order>(message));
        }
        public async Task <bool> SetMarginTypeAsync(TraidingPair traidingPair, MarginType marginType)
        {
            HttpRequestMessage message = HttpBuilder.MakeRequest(HttpMethod.Post, $"{APIEndPoint}/marginType", new[] {
                new KeyValuePair <string, string>("symbol", traidingPair.ToString()),
                new KeyValuePair <string, string>("marginType", marginType.ToString()),
            });

            ResponseStatus response = await Client.SendRequestAsync <ResponseStatus>(message);

            return(response is { } && response.Code == 200 && response.Msg == "success");
        public async Task <bool> CancelAsync(TraidingPair traidingPair)
        {
            HttpRequestMessage message = HttpBuilder.MakeRequest(HttpMethod.Delete, $"{APIEndPoint}/allOpenOrders", new[] {
                new KeyValuePair <string, string>("symbol", traidingPair.ToString())
            });

            ResponseStatus response = await Client.SendRequestAsync <ResponseStatus>(message);

            return(response.Code == 200);
        }