@kodiak-finance/orderly-hooks 2.8.1 → 2.8.3

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.
package/dist/index.mjs CHANGED
@@ -5148,11 +5148,11 @@ var useOrderStream = (params, options) => {
5148
5148
  const normalOrdersResponse = usePrivateInfiniteQuery(normalOrderKeyFn, {
5149
5149
  initialSize: 1,
5150
5150
  formatter: (data) => data,
5151
- revalidateOnFocus: false
5151
+ revalidateOnFocus: true
5152
5152
  });
5153
5153
  const algoOrdersResponse = usePrivateInfiniteQuery(algoOrderKeyFn, {
5154
5154
  formatter: (data) => data,
5155
- revalidateOnFocus: false
5155
+ revalidateOnFocus: true
5156
5156
  });
5157
5157
  const flattenOrders = useMemo(() => {
5158
5158
  if (!normalOrdersResponse.data || !algoOrdersResponse.data && !sourceTypeAll) {
@@ -5213,15 +5213,20 @@ var useOrderStream = (params, options) => {
5213
5213
  })
5214
5214
  );
5215
5215
  };
5216
- const cancelAllOrders = useCallback(() => {
5216
+ const cancelAllOrders = useCallback((symbol2) => {
5217
+ const queryParams = symbol2 ? { symbol: symbol2 } : void 0;
5217
5218
  return Promise.all([
5218
- doCancelAllOrders(null),
5219
- doCancelAllAlgoOrders(null, { algo_type: AlgoOrderRootType.STOP }),
5219
+ doCancelAllOrders(null, queryParams),
5220
5220
  doCancelAllAlgoOrders(null, {
5221
+ ...queryParams || {},
5222
+ algo_type: AlgoOrderRootType.STOP
5223
+ }),
5224
+ doCancelAllAlgoOrders(null, {
5225
+ ...queryParams || {},
5221
5226
  algo_type: AlgoOrderRootType.TRAILING_STOP
5222
5227
  })
5223
5228
  ]);
5224
- }, [normalOrdersResponse.data, algoOrdersResponse.data]);
5229
+ }, []);
5225
5230
  const cancelPostionOrdersByTypes = useCallback(
5226
5231
  (symbol2, types) => {
5227
5232
  return doCancelAllAlgoOrders(null, {
@@ -5231,12 +5236,27 @@ var useOrderStream = (params, options) => {
5231
5236
  },
5232
5237
  [algoOrdersResponse.data]
5233
5238
  );
5234
- const cancelAllTPSLOrders = useCallback(() => {
5235
- return cancelAlgoOrdersByTypes([
5236
- AlgoOrderRootType.POSITIONAL_TP_SL,
5237
- AlgoOrderRootType.TP_SL
5238
- ]);
5239
- }, [algoOrdersResponse.data]);
5239
+ const cancelAllTPSLOrders = useCallback(
5240
+ (symbol2) => {
5241
+ if (!symbol2) {
5242
+ return cancelAlgoOrdersByTypes([
5243
+ AlgoOrderRootType.POSITIONAL_TP_SL,
5244
+ AlgoOrderRootType.TP_SL
5245
+ ]);
5246
+ }
5247
+ return Promise.all([
5248
+ doCancelAllAlgoOrders(null, {
5249
+ symbol: symbol2,
5250
+ algo_type: AlgoOrderRootType.POSITIONAL_TP_SL
5251
+ }),
5252
+ doCancelAllAlgoOrders(null, {
5253
+ symbol: symbol2,
5254
+ algo_type: AlgoOrderRootType.TP_SL
5255
+ })
5256
+ ]);
5257
+ },
5258
+ [cancelAlgoOrdersByTypes, doCancelAllAlgoOrders]
5259
+ );
5240
5260
  const _updateOrder = useCallback(
5241
5261
  (orderId, order, type) => {
5242
5262
  switch (type) {