@hyperix/hooks 0.2.6 → 0.2.7
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.
|
@@ -99,20 +99,29 @@ export function useInfiniteTradeHistory(user, options = {}) {
|
|
|
99
99
|
endTime,
|
|
100
100
|
],
|
|
101
101
|
queryFn: async ({ pageParam }) => {
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
const rawFills = pageParam.latest
|
|
103
|
+
? await infoClient.userFills({
|
|
104
|
+
user,
|
|
105
|
+
aggregateByTime,
|
|
106
|
+
})
|
|
107
|
+
: await infoClient.userFillsByTime({
|
|
108
|
+
user,
|
|
109
|
+
startTime: pageParam.startTime,
|
|
110
|
+
endTime: pageParam.endTime,
|
|
111
|
+
aggregateByTime,
|
|
112
|
+
});
|
|
113
|
+
const fills = sortTradeHistory(rawFills.map((fill) => formatTradeHistoryFill(fill, symbolConverter?.getSpotByPairId(fill.coin))));
|
|
114
|
+
const newestFillTime = fills[0]?.time;
|
|
115
|
+
const oldestFillTime = fills.at(-1)?.time;
|
|
108
116
|
return {
|
|
109
117
|
user,
|
|
110
|
-
startTime: pageParam.startTime,
|
|
111
|
-
endTime: pageParam.endTime,
|
|
112
|
-
fills
|
|
118
|
+
startTime: oldestFillTime ?? pageParam.startTime,
|
|
119
|
+
endTime: newestFillTime ?? pageParam.endTime,
|
|
120
|
+
fills,
|
|
113
121
|
};
|
|
114
122
|
},
|
|
115
123
|
initialPageParam: {
|
|
124
|
+
latest: endTime === undefined,
|
|
116
125
|
startTime: Math.max(0, (endTime ?? Date.now()) - pageDurationMs),
|
|
117
126
|
endTime: endTime ?? Date.now(),
|
|
118
127
|
},
|