public async Task <WithdrawHistory> GetWithdrawHistory(DateTime startDate) { var toReturn = new WithdrawHistory { Success = true, WithdrawList = new List <Withdraw>() }; while (true) { if (startDate > DateTime.Today) { break; } DateTime endDate = startDate.AddDays(90); var parameters = $"startTime={startDate.ToUnixDateTime()}&endTime={endDate.ToUnixDateTime()}"; parameters = _restClient.AddTimestampAndSign(parameters); var result = await _restClient.CallAsync(HttpMethod.Get, "/wapi/v3/withdrawHistory.html", parameters); var resultTyped = JsonConvert.DeserializeObject <WithdrawHistory>(result); if (!resultTyped.Success) { throw new Exception(); } toReturn.WithdrawList.AddRange(resultTyped.WithdrawList ?? Enumerable.Empty <Withdraw>()); startDate = endDate.AddDays(1); } return(toReturn); }
public async Task <IList <Trade> > GetMyTrades(string symbol, int id) { var parameters = $"symbol={symbol}&limit=1000&fromId={id}"; parameters = _restClient.AddTimestampAndSign(parameters); var reply = await _restClient.CallAsync(HttpMethod.Get, "/api/v3/myTrades", parameters); return(JsonConvert.DeserializeObject <IList <Trade> >(reply)); }
public async Task <AccountInfo> GetAccountInfo() { var parameters = $"recvWindow=60000"; parameters = _restClient.AddTimestampAndSign(parameters); var reply = await _restClient.CallAsync(HttpMethod.Get, "/api/v3/account", parameters); return(JsonConvert.DeserializeObject <AccountInfo>(reply)); }