ExchangeSharp/API/Exchanges/Binance/ExchangeBinanceAPI.cs
/// <summary>Gets the deposit history for a symbol</summary>
/// <param name="currency">The currency to check. Null for all symbols.</param>
/// <returns>Collection of ExchangeCoinTransfers</returns>
Gets the deposit history for a symbol
Gets the deposit history for a symbol
protected override async Task<IEnumerable<ExchangeTransaction>> OnGetDepositHistoryAsync(string currency)
        {
            Dictionary<string, object> payload = await GetNoncePayloadAsync();
            if (currency.Length != 0)
            {
                payload["asset"] = currency;
            }
            JToken response = await MakeJsonRequestAsync<JToken>("/depositHistory.html", WithdrawalUrlPrivate, payload);
            var transactions = new List<ExchangeTransaction>();
            foreach (JToken token in response["depositList"])
            {
                var transaction = new ExchangeTransaction
                {
                    Timestamp = token["insertTime"].ConvertInvariant<double>().UnixTimeStampToDateTimeMilliseconds(),
                    Amount = token["amount"].ConvertInvariant<decimal>(),
                    Currency = token["asset"].ToStringUpperInvariant(),
                    Address = token["address"].ToStringInvariant(),
                    AddressTag = token["addressTag"].ToStringInvariant(),
                    BlockchainTxId = token["txId"].ToStringInvariant()
                };
                int status = token["status"].ConvertInvariant<int>();
                switch (status)
                {
                    case 0:
                        transaction.Status = TransactionStatus.Processing;
                        break;
                    case 1:
                        transaction.Status = TransactionStatus.Complete;
                        break;
                    default:
                        transaction.Status = TransactionStatus.Unknown;
                        transaction.Notes = "Unknown transaction status: " + status;
                        break;
                }
                transactions.Add(transaction);
            }
            return transactions;
        }
protected override async Task < IEnumerable < ExchangeTransaction > > OnGetDepositHistoryAsync ( string currency ) { Dictionary < string , object > payload = await GetNoncePayloadAsync ( ) ; if ( currency . Length != 0 ) { payload [ " " ] = currency ; } JToken response = await MakeJsonRequestAsync < JToken > ( " " , WithdrawalUrlPrivate , payload ) ; var transactions = new List < ExchangeTransaction > ( ) ; foreach ( JToken token in response [ " " ] ) { var transaction = new ExchangeTransaction { Timestamp = token [ " " ] . ConvertInvariant < double > ( ) . UnixTimeStampToDateTimeMilliseconds ( ) , Amount = token [ " " ] . ConvertInvariant < decimal > ( ) , Currency = token [ " " ] . ToStringUpperInvariant ( ) , Address = token [ " " ] . ToStringInvariant ( ) , AddressTag = token [ " " ] . ToStringInvariant ( ) , BlockchainTxId = token [ " " ] . ToStringInvariant ( ) } ; int status = token [ " " ] . ConvertInvariant < int > ( ) ; switch ( status ) { case 0 : transaction . Status = TransactionStatus . Processing ; break ; case 1 : transaction . Status = TransactionStatus . Complete ; break ; default : transaction . Status = TransactionStatus . Unknown ; transaction . Notes = " " + status ; break ; } transactions . Add ( transaction ) ; } return transactions ; }
Gets the deposit history for a symbol
Gets the deposit history for a symbol
// TODO: API supports searching on status, startTime, endTime // If new states are added, see https://github.com/binance-exchange/binance-official-api-docs/blob/master/wapi-api.md
Collection of ExchangeCoinTransfers
Collection of ExchangeCoinTransfers
currency
string
The currency to check. Null for all symbols.
The currency to check . Null for all symbols .