@hyperix/hooks 0.2.8 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -63,6 +63,13 @@ function mergeTradeHistoryFills(pages, realtimeFills) {
|
|
|
63
63
|
}
|
|
64
64
|
return sortTradeHistory([...fillsByKey.values()]);
|
|
65
65
|
}
|
|
66
|
+
function flattenTradeHistoryPages(pages) {
|
|
67
|
+
const fills = [];
|
|
68
|
+
for (const page of pages) {
|
|
69
|
+
fills.push(...page.fills);
|
|
70
|
+
}
|
|
71
|
+
return fills;
|
|
72
|
+
}
|
|
66
73
|
function getLatestPageFromFills(user, fills, fallbackEndTime, pageDurationMs) {
|
|
67
74
|
const endTime = fills[0]?.time ?? fallbackEndTime;
|
|
68
75
|
const startTime = Math.max(0, endTime - pageDurationMs);
|
|
@@ -107,7 +114,7 @@ export function useInfiniteTradeHistory(user, options = {}) {
|
|
|
107
114
|
const selectTradeHistoryData = useMemo(() => (data) => ({
|
|
108
115
|
pages: data.pages,
|
|
109
116
|
user,
|
|
110
|
-
fills:
|
|
117
|
+
fills: flattenTradeHistoryPages(data.pages),
|
|
111
118
|
}), [user]);
|
|
112
119
|
useUserFills(user, {
|
|
113
120
|
aggregateByTime,
|