public void BuildParams_TwoParam_ReturnOrderedTwoPairs() { var request = new GetRequest(); string result = request .AddParam("id", "123") .AddParam("Year", "2019") .BuildParams(); Assert.Equal("Year=2019&id=123", result); }
public void GetAccountLedgerAsyncTest(string account_id) { GetRequest request = new GetRequest(); request.AddParam("accountId", account_id); var result = client.GetAccountLedgerAsync(request).Result; string strret = JsonConvert.SerializeObject(result, Formatting.Indented); Console.WriteLine(strret); Assert.Equal(200, result.code); }
public void GetAccountHistoryTest(string account_id) { GetRequest request = new GetRequest(); request.AddParam("account-id", account_id); var result = client.GetAccountHistoryAsync(request).Result; string strret = JsonConvert.SerializeObject(result, Formatting.Indented); Console.WriteLine(strret); Assert.Equal("ok", result.status); }
public void GetDepositWithdrawHistoryTest(string type) { GetRequest request = new GetRequest(); request.AddParam("type", type); GetDepositWithdrawHistoryResponse result = client.GetDepositWithdrawHistoryAsync(request).Result; string strret = JsonConvert.SerializeObject(result, Formatting.Indented); Console.WriteLine(strret); Assert.Equal("ok", result.status); }
public void GetWithdrawAddressTest(string currency) { GetRequest request = new GetRequest(); request.AddParam("currency", currency); GetDepositAddressResponse result = client.GetWithdrawAddressAsync(request).Result; string strret = JsonConvert.SerializeObject(result, Formatting.Indented); Console.WriteLine(strret); Assert.Equal(200, result.code); }
/// <summary> /// Returns loan interest rates and quota applied on the user /// </summary> /// <param name="symbols">Trading symbol (multiple selections acceptable, separated by comma)</param> /// <returns>GetLoanInfoResponse</returns> public async Task <IsolatedGetLoanInfoResponse> IsolatedGetLoanInfoAsync(string symbols) { var request = new GetRequest(); if (!string.IsNullOrEmpty(symbols)) { request.AddParam("symbols", symbols); } string url = _urlBuilder.Build(GET_METHOD, "/v1/margin/loan-info", request); return(await HttpRequest.GetAsync <IsolatedGetLoanInfoResponse>(url)); }
/// <summary> /// Returns the point balance of specified user /// </summary> /// <param name="subUid"></param> /// <returns>GetPointBalanceResponse</returns> public async Task <GetPointBalanceResponse> GetPointBalanceAsync(string subUid = null) { GetRequest request = null; if (!string.IsNullOrEmpty(subUid)) { request = new GetRequest(); request.AddParam("subUid", subUid); } string url = _urlBuilder.Build(GET_METHOD, $"/v2/point/account", request); return(await HttpRequest.GetAsync <GetPointBalanceResponse>(url)); }
/// <summary> /// Returns the point balance of specified user /// <para>Data data</para> /// <para>int code //Status code</para> /// <para>string message //Error message (if any)</para> /// </summary> /// <param name="subUid"></param> /// <returns>GetPointBalanceResponse</returns> public void GetPointBalanceAsync(string subUid = null, System.Action <GetPointBalanceResponse.Data, int, string> action = null) { GetRequest request = null; if (!string.IsNullOrEmpty(subUid)) { request = new GetRequest(); request.AddParam("subUid", subUid); } string url = _urlBuilder.Build(GET_METHOD, "/v2/point/account", request); HttpRequest.GetAsync <GetPointBalanceResponse>(url).ContinueWith((task) => { if (action != null) { var res = task.Result; action(res.data, res.code, res.message); } }); }