Ejemplo n.º 1
0
        public LendingType GetGoodType_DRToModelDTToList(DataRow dr)
        {
            LendingType model = new LendingType();

            if (dr != null)
            {
                model.nID                = ObjectConvertClass.static_ext_int(dr["nID"]);
                model.nLendingTypeID     = ObjectConvertClass.static_ext_int(dr["nLendingTypeID"]);
                model.strLendingTypeName = ObjectConvertClass.static_ext_string(dr["strLendingTypeName"]);
                model.strAlias           = ObjectConvertClass.static_ext_string(dr["strAlias"]);
            }
            return(model);
        }
 /// <summary>
 /// Get interest history
 /// </summary>
 /// <param name="lendingType">Lending type</param>
 /// <param name="asset">Asset</param>
 /// <param name="page">Results page</param>
 /// <param name="startTime">Filter by startTime from</param>
 /// <param name="endTime">Filter by endTime from</param>
 /// <param name="limit">Limit of the amount of results</param>
 /// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
 /// <param name="ct">Cancellation token</param>
 /// <returns>The interest history</returns>
 public WebCallResult <IEnumerable <BinanceLendingInterestHistory> > GetLendingInterestHistory(LendingType lendingType,
                                                                                               string?asset       = null, DateTime?startTime   = null, DateTime?endTime = null, int?page = 1, int?limit = 10,
                                                                                               long?receiveWindow = null, CancellationToken ct = default)
 => GetLendingInterestHistoryAsync(lendingType, asset, startTime, endTime, page, limit, receiveWindow, ct).Result;
        /// <summary>
        /// Get interest history
        /// </summary>
        /// <param name="lendingType">Lending type</param>
        /// <param name="asset">Asset</param>
        /// <param name="page">Results page</param>
        /// <param name="startTime">Filter by startTime from</param>
        /// <param name="endTime">Filter by endTime from</param>
        /// <param name="limit">Limit of the amount of results</param>
        /// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
        /// <param name="ct">Cancellation token</param>
        /// <returns>The interest history</returns>
        public async Task <WebCallResult <IEnumerable <BinanceLendingInterestHistory> > > GetLendingInterestHistoryAsync(LendingType lendingType, string?asset = null, DateTime?startTime = null, DateTime?endTime = null, int?page = 1, int?limit = 10, long?receiveWindow = null, CancellationToken ct = default)
        {
            var timestampResult = await _baseClient.CheckAutoTimestamp(ct).ConfigureAwait(false);

            if (!timestampResult)
            {
                return(new WebCallResult <IEnumerable <BinanceLendingInterestHistory> >(timestampResult.ResponseStatusCode, timestampResult.ResponseHeaders, null, timestampResult.Error));
            }

            var parameters = new Dictionary <string, object>
            {
                { "timestamp", _baseClient.GetTimestamp() },
                { "lendingType", JsonConvert.SerializeObject(lendingType, new LendingTypeConverter(false)) }
            };

            parameters.AddOptionalParameter("asset", asset);
            parameters.AddOptionalParameter("size", limit?.ToString(CultureInfo.InvariantCulture));
            parameters.AddOptionalParameter("current", page?.ToString(CultureInfo.InvariantCulture));
            parameters.AddOptionalParameter("startTime", startTime.HasValue ? JsonConvert.SerializeObject(startTime.Value, new TimestampConverter()) : null);
            parameters.AddOptionalParameter("endTime", endTime.HasValue ? JsonConvert.SerializeObject(endTime.Value, new TimestampConverter()) : null);
            parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture) ?? _baseClient.DefaultReceiveWindow.TotalMilliseconds.ToString(CultureInfo.InvariantCulture));

            return(await _baseClient.SendRequestInternal <IEnumerable <BinanceLendingInterestHistory> >(_baseClient.GetUrl(false, lendingInterestHistoryEndpoint, "sapi", "1"), HttpMethod.Get, ct, parameters, true).ConfigureAwait(false));
        }
 /// <summary>
 /// Get redemption records
 /// </summary>
 /// <param name="lendingType">Lending type</param>
 /// <param name="asset">Asset</param>
 /// <param name="page">Results page</param>
 /// <param name="startTime">Filter by startTime from</param>
 /// <param name="endTime">Filter by endTime from</param>
 /// <param name="limit">Limit of the amount of results</param>
 /// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
 /// <param name="ct">Cancellation token</param>
 /// <returns>The redemption records</returns>
 public WebCallResult <IEnumerable <BinanceRedemptionRecord> > GetRedemptionRecords(LendingType lendingType,
                                                                                    string?asset       = null, DateTime?startTime   = null, DateTime?endTime = null, int?page = 1, int?limit = 10,
                                                                                    long?receiveWindow = null, CancellationToken ct = default)
 => GetRedemptionRecordsAsync(lendingType, asset, startTime, endTime, page, limit, receiveWindow, ct).Result;