mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2026-02-16 14:13:46 +00:00
wip
This commit is contained in:
parent
d4965ad68d
commit
2281b8d7b3
@ -351,6 +351,7 @@ namespace CryptoExchange.Net
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static bool CheckForNextPage(
|
public static bool CheckForNextPage(
|
||||||
int resultCount,
|
int resultCount,
|
||||||
IEnumerable<DateTime> timestamps,
|
IEnumerable<DateTime> timestamps,
|
||||||
@ -359,7 +360,7 @@ namespace CryptoExchange.Net
|
|||||||
int limit,
|
int limit,
|
||||||
DataDirection paginationDirection)
|
DataDirection paginationDirection)
|
||||||
{
|
{
|
||||||
if (resultCount < limit)
|
if (limit <= resultCount)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!timestamps.Any())
|
if (!timestamps.Any())
|
||||||
@ -385,7 +386,8 @@ namespace CryptoExchange.Net
|
|||||||
{
|
{
|
||||||
FromId,
|
FromId,
|
||||||
Time,
|
Time,
|
||||||
Offset
|
Offset,
|
||||||
|
Page
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum TimeParameterSetType
|
public enum TimeParameterSetType
|
||||||
@ -410,6 +412,14 @@ namespace CryptoExchange.Net
|
|||||||
return new PaginationParameters { FromId = pageRequest.FromId };
|
return new PaginationParameters { FromId = pageRequest.FromId };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PaginationParameters ApplyPageFilter(PageRequest? pageRequest)
|
||||||
|
{
|
||||||
|
if (pageRequest?.Page == null || pageRequest.Page == 0)
|
||||||
|
return new PaginationParameters() { Page = 1 };
|
||||||
|
|
||||||
|
return new PaginationParameters { Page = pageRequest.Page };
|
||||||
|
}
|
||||||
|
|
||||||
public static PaginationParameters ApplyOffsetFilter(PageRequest pageRequest)
|
public static PaginationParameters ApplyOffsetFilter(PageRequest pageRequest)
|
||||||
{
|
{
|
||||||
if (pageRequest.Offset == null)
|
if (pageRequest.Offset == null)
|
||||||
@ -440,6 +450,20 @@ namespace CryptoExchange.Net
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Without date/time filter
|
||||||
|
public static PageRequest? GetNextPageRequestPageSimple(
|
||||||
|
PageRequest? currentPageRequest,
|
||||||
|
bool hasNextPage,
|
||||||
|
IEnumerable<DateTime> timeSelector,
|
||||||
|
DateTime? requestStartTime,
|
||||||
|
DateTime? requestEndTime
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (CheckForNextPage(timeSelector, requestStartTime, requestEndTime, limit, direction))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static PageRequest? GetNextPageRequest(
|
public static PageRequest? GetNextPageRequest(
|
||||||
Func<PageRequest> normalNextPageCallback,
|
Func<PageRequest> normalNextPageCallback,
|
||||||
int responseLength,
|
int responseLength,
|
||||||
@ -539,6 +563,9 @@ namespace CryptoExchange.Net
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (filterType == PaginationFilterType.Page)
|
||||||
|
return ApplyPageFilter(pageRequest);
|
||||||
|
|
||||||
if (filterType == PaginationFilterType.FromId)
|
if (filterType == PaginationFilterType.FromId)
|
||||||
// From id doesn't need any other parameters
|
// From id doesn't need any other parameters
|
||||||
return ApplyFromIdFilter(pageRequest);
|
return ApplyFromIdFilter(pageRequest);
|
||||||
|
|||||||
@ -18,6 +18,7 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
public DateTime? EndTime { get; set; }
|
public DateTime? EndTime { get; set; }
|
||||||
public string? FromId { get; set; }
|
public string? FromId { get; set; }
|
||||||
public int? Offset { get; set; }
|
public int? Offset { get; set; }
|
||||||
|
public int? Page { get; set; }
|
||||||
}
|
}
|
||||||
public class PageRequest
|
public class PageRequest
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user