Beispiel #1
0
        static async Task Cancel_WithdrawTest()
        {
            try
            {
                HttpHelp            httpHelp = new HttpHelp();
                string              url      = host + "/api/v1/cancel_withdraw";
                CancelWithdrawInput inputDto = new CancelWithdrawInput
                {
                    Symbol     = "VHKD",
                    WithdrawID = "XXXXXX"
                };
                string input    = JsonConvert.SerializeObject(inputDto);
                var    response = httpHelp.HttpPost <OperateMessage <bool> >(url,
                                                                             ApiKey,
                                                                             input,
                                                                             ApiSign.CreateSign(SecretKey, input)
                                                                             );

                Console.WriteLine($"code:{response.code}");
                Console.WriteLine($"result:{response.result}");
                Console.WriteLine($"data:{response.data.ToString()}");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"{nameof(GetTickerTest)}出错:{ex.Message}");
            }
        }
Beispiel #2
0
        static async Task WithdrawTest()
        {
            try
            {
                HttpHelp      httpHelp = new HttpHelp();
                string        url      = host + "/api/v1/withdraw";
                WithdrawInput inputDto = new WithdrawInput
                {
                    Symbol  = "VHKD",
                    Address = "VBssvPs5ayEzYMfBxVN3Ux2uGzgBBVBR2S",
                    Amount  = 1
                };
                string input    = JsonConvert.SerializeObject(inputDto);
                var    response = httpHelp.HttpPost <OperateMessage <string> >(url,
                                                                               ApiKey,
                                                                               input,
                                                                               ApiSign.CreateSign(SecretKey, input)
                                                                               );

                Console.WriteLine($"code:{response.code}");
                Console.WriteLine($"result:{response.result}");
                Console.WriteLine($"data:{response.data.ToString()}");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"{nameof(GetTickerTest)}出错:{ex.Message}");
            }
        }
Beispiel #3
0
        static async Task TradeTest()
        {
            try
            {
                HttpHelp       httpHelp = new HttpHelp();
                string         url      = host + "/api/v1/trade";
                SendOrderInput inputDto = new SendOrderInput
                {
                    Symbol = "BTC/VHKD",
                    Size   = 1,
                    Side   = TradeSide.BUY,
                    Price  = (decimal)1,
                    Type   = OrderType.Limit
                };
                string input    = JsonConvert.SerializeObject(inputDto);
                var    response = httpHelp.HttpPost <OperateMessage <TradeOutput> >(url,
                                                                                    ApiKey,
                                                                                    input,
                                                                                    ApiSign.CreateSign(SecretKey, input)
                                                                                    );

                Console.WriteLine($"code:{response.code}");
                Console.WriteLine($"result:{response.result}");
                Console.WriteLine($"data:{response.data.ToJson()}");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"{nameof(GetTickerTest)}出错:{ex.Message}");
            }
        }
Beispiel #4
0
        static async Task GetDepthTest()
        {
            try
            {
                HttpHelp      httpHelp = new HttpHelp();
                GetDepthInput inputDto = new GetDepthInput
                {
                    Symbol = "BTC/VHKD"
                };
                string url      = host + "/api/v1/getdepth";
                string input    = JsonConvert.SerializeObject(inputDto);
                var    response = httpHelp.HttpPost <OperateMessage <GetDepthOutput> >(url,
                                                                                       ApiKey,
                                                                                       input,
                                                                                       ApiSign.CreateSign(SecretKey, input)
                                                                                       );

                Console.WriteLine($"code:{response.code}");
                Console.WriteLine($"result:{response.result}");
                Console.WriteLine($"data:{response.ToJson()}");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"{nameof(GetDepthTest)}出错:{ex.Message}");
            }
        }
Beispiel #5
0
        static async Task GetHistoryOrderTest()
        {
            try
            {
                HttpHelp             httpHelp = new HttpHelp();
                string               url      = host + "/api/v1/gethistoryorder";
                GetHistoryOrderInput inputDto = new GetHistoryOrderInput
                {
                    Symbol    = "BTC/VHKD",
                    PageIndex = 1,
                    PageSize  = 10,
                    Status    = OrderStatus.Cancel
                };
                string input    = JsonConvert.SerializeObject(inputDto);
                var    response = httpHelp.HttpPost <OperateMessage <List <GetOrderInfoOutput> > >(url,
                                                                                                   ApiKey,
                                                                                                   input,
                                                                                                   ApiSign.CreateSign(SecretKey, input)
                                                                                                   );

                Console.WriteLine($"code:{response.code}");
                Console.WriteLine($"result:{response.result}");
                Console.WriteLine($"data:{response.data.ToJson()}");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"{nameof(GetTickerTest)}出错:{ex.Message}");
            }
        }
Beispiel #6
0
        static async Task GetUserInfoTest()
        {
            try
            {
                HttpHelp httpHelp = new HttpHelp();
                string   url      = host + "/api/v1/getuserinfo";
                string   input    = "1";
                var      response = httpHelp.HttpPost <OperateMessage <List <GetUserInfoOutput> > >(url,
                                                                                                    ApiKey,
                                                                                                    input,
                                                                                                    ApiSign.CreateSign(SecretKey, input)
                                                                                                    );

                Console.WriteLine($"code:{response.code}");
                Console.WriteLine($"result:{response.result}");
                Console.WriteLine($"data:{response.data.ToJson()}");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"{nameof(GetTickerTest)}出错:{ex.Message}");
            }
        }
Beispiel #7
0
        static async Task GetKLineTest()
        {
            try
            {
                HttpHelp      httpHelp = new HttpHelp();
                GetKLineInput inputDto = new GetKLineInput
                {
                    Symbol = "BTC/VHKD",
                    Since  = 1528359729,
                    Size   = 100,
                    Type   = "5min"
                };
                string url      = host + "/api/v1/getkline";
                string input    = JsonConvert.SerializeObject(inputDto);
                var    response = httpHelp.HttpPost <OperateMessage <IEnumerable <GetKLineOutput> > >(url,
                                                                                                      ApiKey,
                                                                                                      input,
                                                                                                      ApiSign.CreateSign(SecretKey, input)
                                                                                                      );

                Console.WriteLine($"code:{response.code}");
                Console.WriteLine($"result:{response.result}");
                Console.WriteLine($"data:{response.data.ToJson()}");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"{nameof(GetTradesTest)}出错:{ex.Message}");
            }
        }