Example #1
0
        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);
        }
Example #2
0
        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));
        }
Example #3
0
        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));
        }