@orderly.network/hooks 1.1.4-experimental.0 → 1.1.4-experimental.2
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/esm/index.d.ts +1 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -0
- package/esm/orderly/useDeposit.d.ts +1 -1
- package/esm/orderly/useDeposit.d.ts.map +1 -1
- package/esm/orderly/useDeposit.js +19 -8
- package/esm/orderly/useOrderEntry.d.ts +10 -1
- package/esm/orderly/useOrderEntry.d.ts.map +1 -1
- package/esm/orderly/useOrderEntry.js +21 -14
- package/esm/orderly/useOrderbookStream.d.ts +8 -1
- package/esm/orderly/useOrderbookStream.d.ts.map +1 -1
- package/esm/orderly/useOrderbookStream.js +28 -21
- package/esm/orderly/usePositionStream.d.ts.map +1 -1
- package/esm/orderly/usePositionStream.js +5 -1
- package/esm/useWS.d.ts.map +1 -1
- package/esm/useWS.js +5 -1
- package/esm/utils/createOrder.d.ts.map +1 -1
- package/esm/utils/createOrder.js +6 -2
- package/esm/utils/orderEntryHelper.d.ts +1 -0
- package/esm/utils/orderEntryHelper.d.ts.map +1 -1
- package/esm/utils/orderEntryHelper.js +11 -0
- package/esm/version.d.ts +1 -1
- package/esm/version.js +2 -2
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -1
- package/lib/orderly/useDeposit.d.ts +1 -1
- package/lib/orderly/useDeposit.d.ts.map +1 -1
- package/lib/orderly/useDeposit.js +18 -7
- package/lib/orderly/useOrderEntry.d.ts +10 -1
- package/lib/orderly/useOrderEntry.d.ts.map +1 -1
- package/lib/orderly/useOrderEntry.js +21 -14
- package/lib/orderly/useOrderbookStream.d.ts +8 -1
- package/lib/orderly/useOrderbookStream.d.ts.map +1 -1
- package/lib/orderly/useOrderbookStream.js +28 -21
- package/lib/orderly/usePositionStream.d.ts.map +1 -1
- package/lib/orderly/usePositionStream.js +5 -1
- package/lib/useWS.d.ts.map +1 -1
- package/lib/useWS.js +5 -1
- package/lib/utils/createOrder.d.ts.map +1 -1
- package/lib/utils/createOrder.js +6 -2
- package/lib/utils/orderEntryHelper.d.ts +1 -0
- package/lib/utils/orderEntryHelper.d.ts.map +1 -1
- package/lib/utils/orderEntryHelper.js +13 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +2 -2
- package/package.json +7 -8
package/esm/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { usePreLoadData } from "./usePreloadData";
|
|
|
11
11
|
export { useEventEmitter } from "./useEventEmitter";
|
|
12
12
|
export { useSessionStorage } from "./useSessionStorage";
|
|
13
13
|
export { useLocalStorage } from "./useLocalStorage";
|
|
14
|
+
export { parseJSON } from "./utils/json";
|
|
14
15
|
export { default as useConstant } from "use-constant";
|
|
15
16
|
export { useWS } from "./useWS";
|
|
16
17
|
export { useConfig } from "./useConfig";
|
package/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAA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EpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7D,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EACL,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAElC,cAAc,wBAAwB,CAAC;AAGvC,OAAO,MAAM,EAAE,EAAE,KAAK,gBAAgB,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAE/D,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,CAAC;AAEpD,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,cAAc,wBAAwB,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC"}
|
package/esm/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export { usePreLoadData } from "./usePreloadData";
|
|
|
11
11
|
export { useEventEmitter } from "./useEventEmitter";
|
|
12
12
|
export { useSessionStorage } from "./useSessionStorage";
|
|
13
13
|
export { useLocalStorage } from "./useLocalStorage";
|
|
14
|
+
export { parseJSON } from "./utils/json";
|
|
14
15
|
export { default as useConstant } from "use-constant";
|
|
15
16
|
export { useWS } from "./useWS";
|
|
16
17
|
export { useConfig } from "./useConfig";
|
|
@@ -28,7 +28,7 @@ export declare const useDeposit: (options?: useDepositOptions) => {
|
|
|
28
28
|
depositFee: bigint;
|
|
29
29
|
/** enquiring depositFee status on chain */
|
|
30
30
|
depositFeeRevalidating: boolean;
|
|
31
|
-
approve: (amount?: string) => Promise<
|
|
31
|
+
approve: (amount?: string) => Promise<void | undefined>;
|
|
32
32
|
deposit: () => Promise<any>;
|
|
33
33
|
fetchBalances: (tokens: API.TokenInfo[]) => Promise<void>;
|
|
34
34
|
fetchBalance: (address: string, decimals?: number) => Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDeposit.d.ts","sourceRoot":"","sources":["../../src/orderly/useDeposit.ts"],"names":[],"mappings":";AAEA,OAAO,EACL,GAAG,EAMH,SAAS,EAEV,MAAM,wBAAwB,CAAC;AAMhC,MAAM,MAAM,iBAAiB,GAAG;IAE9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,UAAU,aAAc,iBAAiB;
|
|
1
|
+
{"version":3,"file":"useDeposit.d.ts","sourceRoot":"","sources":["../../src/orderly/useDeposit.ts"],"names":[],"mappings":";AAEA,OAAO,EACL,GAAG,EAMH,SAAS,EAEV,MAAM,wBAAwB,CAAC;AAMhC,MAAM,MAAM,iBAAiB,GAAG;IAE9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,UAAU,aAAc,iBAAiB;IA4TlD,gCAAgC;;;;;;;;;;;;;IAOhC,oBAAoB;;IAEpB,qCAAqC;;IAErC,2CAA2C;;uBApI3B,MAAM;;4BAhGyB,IAAI,SAAS,EAAE;4BAvC9C,MAAM,aAAa,MAAM;IAiRzC,yBAAyB;;CAG5B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { useAccount } from "../useAccount";
|
|
3
|
-
import { ARBITRUM_MAINNET_CHAINID, ARBITRUM_TESTNET_CHAINID, AccountStatusEnum, DEPOSIT_FEE_RATE,
|
|
3
|
+
import { ARBITRUM_MAINNET_CHAINID, ARBITRUM_TESTNET_CHAINID, AccountStatusEnum, DEPOSIT_FEE_RATE, isNativeTokenChecker, } from "@orderly.network/types";
|
|
4
4
|
import { Decimal } from "@orderly.network/utils";
|
|
5
5
|
import { useChains } from "./useChains";
|
|
6
6
|
import { useConfig } from "../useConfig";
|
|
@@ -159,22 +159,33 @@ export const useDeposit = (options) => {
|
|
|
159
159
|
return account.assetsManager
|
|
160
160
|
.approve(options.address, amount)
|
|
161
161
|
.then((result) => {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
162
|
+
return account.walletClient
|
|
163
|
+
?.pollTransactionReceiptWithBackoff(result.hash)
|
|
164
|
+
.then((receipt) => {
|
|
165
|
+
if (receipt.status === 1) {
|
|
166
|
+
account.assetsManager
|
|
167
|
+
.getAllowance(options.address)
|
|
168
|
+
.then((allowance) => {
|
|
169
|
+
setAllowance(() => allowance);
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
});
|
|
166
173
|
});
|
|
167
|
-
}, [account, getAllowance, options
|
|
174
|
+
}, [account, getAllowance, options, dst]);
|
|
168
175
|
const deposit = useCallback(async () => {
|
|
169
176
|
// only support orderly deposit
|
|
170
177
|
return account.assetsManager
|
|
171
178
|
.deposit(quantity, depositFee)
|
|
172
179
|
.then((res) => {
|
|
173
|
-
|
|
180
|
+
account.assetsManager
|
|
181
|
+
.getAllowance(options?.address)
|
|
182
|
+
.then((allowance) => {
|
|
183
|
+
setAllowance(() => allowance);
|
|
184
|
+
});
|
|
174
185
|
setBalance((value) => new Decimal(value).sub(quantity).toString());
|
|
175
186
|
return res;
|
|
176
187
|
});
|
|
177
|
-
}, [account, fetchBalance,
|
|
188
|
+
}, [account, fetchBalance, quantity, depositFee]);
|
|
178
189
|
const loopGetBalance = async () => {
|
|
179
190
|
getBalanceListener.current && clearTimeout(getBalanceListener.current);
|
|
180
191
|
getBalanceListener.current = setTimeout(async () => {
|
|
@@ -35,20 +35,29 @@ export type UseOrderEntryReturn = {
|
|
|
35
35
|
metaState: UseOrderEntryMetaState;
|
|
36
36
|
symbolConfig: API.SymbolExt;
|
|
37
37
|
};
|
|
38
|
-
export type OrderParams = Required<Pick<OrderEntity, "side" | "order_type" | "symbol">> & Partial<Omit<OrderEntity, "side" | "symbol" | "order_type"
|
|
38
|
+
export type OrderParams = Required<Pick<OrderEntity, "side" | "order_type" | "symbol">> & Partial<Omit<OrderEntity, "side" | "symbol" | "order_type">>;
|
|
39
39
|
/**
|
|
40
40
|
* Create Order
|
|
41
41
|
* @example
|
|
42
42
|
* ```tsx
|
|
43
|
+
* import { useOrderEntry } from "@orderly.network/hooks";
|
|
44
|
+
* import {OrderSide, OrderType} from '@orderly.network/types';
|
|
45
|
+
*
|
|
43
46
|
* const { formattedOrder, onSubmit, helper } = useOrderEntry({
|
|
44
47
|
* symbol: "PERP_ETH_USDC",
|
|
45
48
|
* side: OrderSide.BUY,
|
|
46
49
|
* order_type: OrderType.LIMIT,
|
|
47
50
|
* order_price: 10000,
|
|
48
51
|
* order_quantity: 1,
|
|
52
|
+
* },{
|
|
53
|
+
* // **Note:** it's required
|
|
54
|
+
* watchOrderbook: true,
|
|
49
55
|
* });
|
|
50
56
|
* ```
|
|
51
57
|
*/
|
|
52
58
|
export declare function useOrderEntry(order: OrderParams, options?: UseOrderEntryOptions): UseOrderEntryReturn;
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated
|
|
61
|
+
*/
|
|
53
62
|
export declare function useOrderEntry(symbol: string, side: OrderSide, reduceOnly: boolean): UseOrderEntryReturn;
|
|
54
63
|
//# sourceMappingURL=useOrderEntry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOrderEntry.d.ts","sourceRoot":"","sources":["../../src/orderly/useOrderEntry.ts"],"names":[],"mappings":"AACA,OAAO,EACL,GAAG,EACH,WAAW,EACX,SAAS,EAGV,MAAM,wBAAwB,CAAC;AAkBhC,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,CACT,IAAI,EAAE,WAAW,KACd;SAAG,CAAC,IAAI,MAAM,WAAW,CAAC,CAAC,EAAE,MAAM;KAAE,GAAG,IAAI,GAAG,SAAS,CAAC;CAC/D,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EACF;SAAG,CAAC,IAAI,MAAM,WAAW,CAAC,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE;KAAE,GAChE,IAAI,GACJ,SAAS,CAAC;IACd,KAAK,EAAE;SAAG,CAAC,IAAI,MAAM,WAAW,CAAC,CAAC,EAAE,OAAO;KAAE,GAAG,IAAI,GAAG,SAAS,CAAC;IACjE,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;
|
|
1
|
+
{"version":3,"file":"useOrderEntry.d.ts","sourceRoot":"","sources":["../../src/orderly/useOrderEntry.ts"],"names":[],"mappings":"AACA,OAAO,EACL,GAAG,EACH,WAAW,EACX,SAAS,EAG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AAC;QAC1B,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,GAAG,CAAC;KAGlD,CAAC;IAEF,SAAS,EAAE,sBAAsB,CAAC;IAClC,YAAY,EAAE,GAAG,CAAC,SAAS,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,QAAQ,CAChC,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,YAAY,GAAG,QAAQ,CAAC,CACpD,GACC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,QAAQ,GAAG,YAAY,CAAC,CAAC,CAAC;AAE/D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,WAAW,EAClB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,mBAAmB,CAAC;AACvB;;GAEG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,SAAS,EACf,UAAU,EAAE,OAAO,GAClB,mBAAmB,CAAC"}
|
|
@@ -12,10 +12,11 @@ import { useMarkPrice } from "./useMarkPrice";
|
|
|
12
12
|
import { order } from "@orderly.network/perp";
|
|
13
13
|
import { useEventEmitter } from "../useEventEmitter";
|
|
14
14
|
import { useDebouncedCallback } from "use-debounce";
|
|
15
|
-
const TIEMSTAMP = "timestamp";
|
|
16
15
|
export function useOrderEntry(symbolOrOrder, sideOrOptions, reduceOnly, options) {
|
|
17
|
-
//
|
|
16
|
+
// if symbolOrOrder is string, then it's deprecated
|
|
17
|
+
let isNewVersion = false;
|
|
18
18
|
if (typeof symbolOrOrder === "object") {
|
|
19
|
+
isNewVersion = true;
|
|
19
20
|
if (!symbolOrOrder.symbol) {
|
|
20
21
|
throw new SDKError("symbol is required");
|
|
21
22
|
}
|
|
@@ -25,21 +26,12 @@ export function useOrderEntry(symbolOrOrder, sideOrOptions, reduceOnly, options)
|
|
|
25
26
|
if (!symbolOrOrder.order_type) {
|
|
26
27
|
throw new SDKError("order_type is required");
|
|
27
28
|
}
|
|
28
|
-
// if (typeof symbolOrOrder[TIEMSTAMP] === "undefined") {
|
|
29
|
-
// console.warn(
|
|
30
|
-
// "The timestamp is not set, the order status may be out of sync."
|
|
31
|
-
// );
|
|
32
|
-
// }
|
|
33
|
-
// add timestamp to order, fix the issue of the same order
|
|
34
|
-
// symbolOrOrder[TIEMSTAMP] = Date.now();
|
|
35
29
|
}
|
|
36
|
-
// console.log("+++++++", symbolOrOrder);
|
|
37
30
|
const prevOrderData = useRef(null);
|
|
38
31
|
// Cache data from the last calculate
|
|
39
32
|
const orderDataCache = useRef(null);
|
|
40
33
|
//
|
|
41
34
|
const notSupportData = useRef({});
|
|
42
|
-
const [doCreateOrder, { data, error, reset, isMutating }] = useMutation(orderDataCache?.current?.isStopOrder ? "/v1/algo/order" : "/v1/order");
|
|
43
35
|
const [errors, setErrors] = useState(null);
|
|
44
36
|
const ee = useEventEmitter();
|
|
45
37
|
const fieldDirty = useRef({});
|
|
@@ -186,7 +178,10 @@ export function useOrderEntry(symbolOrOrder, sideOrOptions, reduceOnly, options)
|
|
|
186
178
|
needParse?.symbol,
|
|
187
179
|
needParse?.reduce_only,
|
|
188
180
|
needParse?.side,
|
|
181
|
+
needParse?.visible_quantity,
|
|
189
182
|
]);
|
|
183
|
+
const isStopOrder = parsedData?.order_type === OrderType.STOP_LIMIT || parsedData?.order_type === OrderType.STOP_MARKET;
|
|
184
|
+
const [doCreateOrder, { data, error, reset, isMutating }] = useMutation(isStopOrder ? "/v1/algo/order" : "/v1/order");
|
|
190
185
|
// const maxQty = 3;
|
|
191
186
|
const createOrder = (values) => {
|
|
192
187
|
if (!values.symbol) {
|
|
@@ -340,8 +335,16 @@ export function useOrderEntry(symbolOrOrder, sideOrOptions, reduceOnly, options)
|
|
|
340
335
|
]);
|
|
341
336
|
//====== update orderbook ask0/bid0 ======
|
|
342
337
|
useEffect(() => {
|
|
343
|
-
if (
|
|
344
|
-
|
|
338
|
+
if (isNewVersion) {
|
|
339
|
+
if (!optionsValue?.watchOrderbook) {
|
|
340
|
+
throw new SDKError("In order to calculate the estimated liquidation price, the `options.watchOrderbook` parameter must be set to true.");
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
if (!optionsValue?.watchOrderbook) {
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
345
348
|
ee.on("orderbook:update", onOrderbookUpdate);
|
|
346
349
|
return () => {
|
|
347
350
|
ee.off("orderbook_update", onOrderbookUpdate);
|
|
@@ -354,8 +357,12 @@ export function useOrderEntry(symbolOrOrder, sideOrOptions, reduceOnly, options)
|
|
|
354
357
|
const getPriceAndQty = (symbolOrOrder) => {
|
|
355
358
|
let quantity = Number(symbolOrOrder.order_quantity);
|
|
356
359
|
const orderPrice = Number(symbolOrOrder.order_price);
|
|
357
|
-
if (isNaN(quantity) || quantity <= 0
|
|
360
|
+
if (isNaN(quantity) || quantity <= 0) {
|
|
358
361
|
return null;
|
|
362
|
+
}
|
|
363
|
+
if (!!options?.watchOrderbook && askAndBid.current.length === 0) {
|
|
364
|
+
throw new SDKError("Please check if you are using the `useOrderbookStream` hook or if the orderBook has data.");
|
|
365
|
+
}
|
|
359
366
|
if ((symbolOrOrder.order_type === OrderType.LIMIT ||
|
|
360
367
|
symbolOrOrder.order_type === OrderType.STOP_LIMIT) &&
|
|
361
368
|
isNaN(orderPrice))
|
|
@@ -9,13 +9,20 @@ export type OrderbookData = {
|
|
|
9
9
|
* @param level
|
|
10
10
|
* @param data
|
|
11
11
|
*/
|
|
12
|
-
export declare const reduceOrderbook: (depth: number | undefined, level: number, data: OrderbookData) => OrderbookData;
|
|
12
|
+
export declare const reduceOrderbook: (depth: number | undefined, level: number, padding: boolean, data: OrderbookData) => OrderbookData;
|
|
13
13
|
export declare const mergeOrderbook: (data: OrderbookData, update: OrderbookData) => {
|
|
14
14
|
asks: OrderBookItem[];
|
|
15
15
|
bids: OrderBookItem[];
|
|
16
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Configuration for the Order Book
|
|
19
|
+
* @level Indicates the number of data entries to return for ask/bid, default is 10
|
|
20
|
+
* @padding Whether to fill in when the actual data entries are less than the level. If filled, it will add [nan, nan, nan, nan]
|
|
21
|
+
* default is true
|
|
22
|
+
*/
|
|
17
23
|
export type OrderbookOptions = {
|
|
18
24
|
level?: number;
|
|
25
|
+
padding?: boolean;
|
|
19
26
|
};
|
|
20
27
|
/**
|
|
21
28
|
* @name useOrderbookStream
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOrderbookStream.d.ts","sourceRoot":"","sources":["../../src/orderly/useOrderbookStream.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,aAAa,GAAG,MAAM,EAAE,CAAC;AAErC,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,aAAa,EAAE,CAAC;IACtB,IAAI,EAAE,aAAa,EAAE,CAAC;CACvB,CAAC;AAyFF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,UACnB,MAAM,GAAG,SAAS,SAClB,MAAM,
|
|
1
|
+
{"version":3,"file":"useOrderbookStream.d.ts","sourceRoot":"","sources":["../../src/orderly/useOrderbookStream.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,aAAa,GAAG,MAAM,EAAE,CAAC;AAErC,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,aAAa,EAAE,CAAC;IACtB,IAAI,EAAE,aAAa,EAAE,CAAC;CACvB,CAAC;AAyFF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,UACnB,MAAM,GAAG,SAAS,SAClB,MAAM,WACJ,OAAO,QACV,aAAa,KAClB,aAqDF,CAAC;AAgCF,eAAO,MAAM,cAAc,SAAU,aAAa,UAAU,aAAa;;;CAWxE,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAIF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,WACrB,MAAM,YACL,aAAa,YACZ,gBAAgB;;;;;;;;;;;2BA2HgB,MAAM;;;;;;;;;IAmDjD,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -7,7 +7,7 @@ import { useSymbolsInfo } from "./useSymbolsInfo";
|
|
|
7
7
|
import { Decimal } from "@orderly.network/utils";
|
|
8
8
|
import { min } from "ramda";
|
|
9
9
|
import { SDKError } from "@orderly.network/types";
|
|
10
|
-
const paddingFn = (len) => Array(len).fill([Number.NaN, Number.NaN, Number.NaN]);
|
|
10
|
+
const paddingFn = (len) => Array(len).fill([Number.NaN, Number.NaN, Number.NaN, Number.NaN]);
|
|
11
11
|
const asksSortFn = (a, b) => a[0] - b[0];
|
|
12
12
|
const bidsSortFn = (a, b) => b[0] - a[0];
|
|
13
13
|
// const commonSortFn = (a: OrderBookItem, b: OrderBookItem) => b[0] - a[0];
|
|
@@ -78,28 +78,37 @@ const reduceItems = (depth, level, data, asks = false) => {
|
|
|
78
78
|
* @param level
|
|
79
79
|
* @param data
|
|
80
80
|
*/
|
|
81
|
-
export const reduceOrderbook = (depth, level, data) => {
|
|
81
|
+
export const reduceOrderbook = (depth, level, padding, data) => {
|
|
82
82
|
let asks = reduceItems(depth, level, data.asks, true);
|
|
83
83
|
let bids = reduceItems(depth, level, data.bids);
|
|
84
84
|
/// not empty and asks.price <= bids.price
|
|
85
85
|
if (asks.length !== 0 && bids.length !== 0 && asks[0][0] <= bids[0][0]) {
|
|
86
86
|
if (asks.length === 1) {
|
|
87
|
-
const [price, qty, newQuantity] = asks[0];
|
|
87
|
+
const [price, qty, newQuantity, newAmount] = asks[0];
|
|
88
88
|
asks.shift();
|
|
89
|
-
asks.push([price + (depth === undefined ? 0 : depth), qty, newQuantity]);
|
|
89
|
+
asks.push([price + (depth === undefined ? 0 : depth), qty, newQuantity, newAmount]);
|
|
90
90
|
}
|
|
91
91
|
else {
|
|
92
92
|
const [bidPrice] = bids[0];
|
|
93
93
|
while (asks.length > 0) {
|
|
94
|
-
const [askPrice, askQty, newQuantity] = asks[0];
|
|
94
|
+
const [askPrice, askQty, newQuantity, newAmount] = asks[0];
|
|
95
95
|
if (askPrice <= bidPrice) {
|
|
96
|
+
// console.log("xxxxxxxxxxx reset ask list begin", [...asks], { ...asks[0] });
|
|
96
97
|
asks.shift();
|
|
98
|
+
// let logStr = "";
|
|
97
99
|
for (let index = 0; index < asks.length; index++) {
|
|
98
100
|
if (index === 0) {
|
|
99
|
-
asks[index][1]
|
|
101
|
+
const quantity = asks[index][1] + askQty;
|
|
102
|
+
asks[index][1] = quantity;
|
|
103
|
+
asks[index][2] = quantity;
|
|
104
|
+
asks[index][3] += newAmount;
|
|
100
105
|
}
|
|
101
|
-
|
|
106
|
+
else {
|
|
107
|
+
asks[index][3] += newAmount;
|
|
108
|
+
}
|
|
109
|
+
// logStr += `index: ${index} ${asks[index]}\n`;
|
|
102
110
|
}
|
|
111
|
+
// console.log("xxxxxxxxxxx reset ask list end", logStr);
|
|
103
112
|
}
|
|
104
113
|
else {
|
|
105
114
|
break;
|
|
@@ -108,15 +117,12 @@ export const reduceOrderbook = (depth, level, data) => {
|
|
|
108
117
|
}
|
|
109
118
|
}
|
|
110
119
|
asks = asks.reverse();
|
|
111
|
-
|
|
112
|
-
asks
|
|
113
|
-
|
|
114
|
-
bids
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
// let maxBidQty = bids.reduce((a,b) => Math.max(a, b[1]),0);
|
|
118
|
-
// asks = asks.map((item) => [...item, maxAskQty]);
|
|
119
|
-
// bids = bids.map((item) => [...item, maxBidQty]);
|
|
120
|
+
if (padding) {
|
|
121
|
+
asks =
|
|
122
|
+
asks.length < level ? paddingFn(level - asks.length).concat(asks) : asks;
|
|
123
|
+
bids =
|
|
124
|
+
bids.length < level ? bids.concat(paddingFn(level - bids.length)) : bids;
|
|
125
|
+
}
|
|
120
126
|
return {
|
|
121
127
|
asks: asks,
|
|
122
128
|
bids: bids,
|
|
@@ -171,6 +177,7 @@ export const useOrderbookStream = (symbol, initial = INIT_DATA, options) => {
|
|
|
171
177
|
throw new SDKError("useOrderbookStream requires a symbol");
|
|
172
178
|
}
|
|
173
179
|
const level = options?.level ?? 10;
|
|
180
|
+
const padding = options?.padding ?? true;
|
|
174
181
|
const [requestData, setRequestData] = useState(null);
|
|
175
182
|
const [data, setData] = useState(initial);
|
|
176
183
|
const [isLoading, setIsLoading] = useState(true);
|
|
@@ -225,7 +232,7 @@ export const useOrderbookStream = (symbol, initial = INIT_DATA, options) => {
|
|
|
225
232
|
// clean the data;
|
|
226
233
|
setData(INIT_DATA);
|
|
227
234
|
};
|
|
228
|
-
}, [symbol
|
|
235
|
+
}, [symbol]);
|
|
229
236
|
// const {data:markPrices} = useMarkPricesStream();
|
|
230
237
|
const { data: markPrice } = useMarkPrice(symbol);
|
|
231
238
|
useEffect(() => {
|
|
@@ -279,17 +286,17 @@ export const useOrderbookStream = (symbol, initial = INIT_DATA, options) => {
|
|
|
279
286
|
useEffect(() => {
|
|
280
287
|
prevMiddlePrice.current = middlePrice;
|
|
281
288
|
}, [middlePrice]);
|
|
282
|
-
const reducedData = reduceOrderbook(depth, level, {
|
|
289
|
+
const reducedData = reduceOrderbook(depth, level, padding, {
|
|
283
290
|
asks: [...data.asks],
|
|
284
291
|
bids: [...data.bids],
|
|
285
292
|
});
|
|
286
293
|
// emit the asks0 and bids0
|
|
287
294
|
useEffect(() => {
|
|
288
295
|
eventEmitter.emit("orderbook:update", [
|
|
289
|
-
reducedData.asks[0][0],
|
|
290
|
-
reducedData.bids[0][0],
|
|
296
|
+
reducedData.asks?.[0]?.[0],
|
|
297
|
+
reducedData.bids?.[0]?.[0],
|
|
291
298
|
]);
|
|
292
|
-
}, [reducedData.asks[0][0], reducedData.bids[0][0]]);
|
|
299
|
+
}, [reducedData.asks?.[0]?.[0], reducedData.bids?.[0]?.[0]]);
|
|
293
300
|
return [
|
|
294
301
|
{
|
|
295
302
|
asks: reducedData.asks.slice(-level),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePositionStream.d.ts","sourceRoot":"","sources":["../../src/orderly/usePositionStream.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAI5C,OAAO,EAAE,KAAK,GAAG,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAK/D,OAAO,EAAE,OAAO,EAAQ,MAAM,wBAAwB,CAAC;AAIvD,KAAK,SAAS,GAAG,WAAW,GAAG,WAAW,CAAC;AAE3C,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,CACL,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,YAAY,GAAG,aAAa,GAAG,MAAM,CAAC,KAC5D,IAAI,CAAC;CACX;AAED,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"usePositionStream.d.ts","sourceRoot":"","sources":["../../src/orderly/usePositionStream.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAI5C,OAAO,EAAE,KAAK,GAAG,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAK/D,OAAO,EAAE,OAAO,EAAQ,MAAM,wBAAwB,CAAC;AAIvD,KAAK,SAAS,GAAG,WAAW,GAAG,WAAW,CAAC;AAE3C,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,CACL,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,YAAY,GAAG,aAAa,GAAG,MAAM,CAAC,KAC5D,IAAI,CAAC;CACX;AAED,eAAO,MAAM,iBAAiB,YAInB,MAAM,YACL,gBAAgB,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE;;;;;;;;;;EAiRtD,CAAC;AAEF,eAAO,MAAM,yBAAyB,sBAIpC,CAAC"}
|
|
@@ -9,7 +9,11 @@ import { pathOr, propOr } from "ramda";
|
|
|
9
9
|
import { parseHolding } from "../utils/parseHolding";
|
|
10
10
|
import { zero } from "@orderly.network/utils";
|
|
11
11
|
import { useMarketsStream } from "./useMarketsStream";
|
|
12
|
-
export const usePositionStream = (
|
|
12
|
+
export const usePositionStream = (
|
|
13
|
+
/**
|
|
14
|
+
* If symbol is passed, only the position of that symbol will be returned.
|
|
15
|
+
*/
|
|
16
|
+
symbol, options) => {
|
|
13
17
|
const symbolInfo = useSymbolsInfo();
|
|
14
18
|
const { data: accountInfo } = usePrivateQuery("/v1/client/info");
|
|
15
19
|
const { data: holding } = usePrivateQuery("/v1/client/holding", {
|
package/esm/useWS.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWS.d.ts","sourceRoot":"","sources":["../src/useWS.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,sBAAsB,CAAC;AAO1C,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"useWS.d.ts","sourceRoot":"","sources":["../src/useWS.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,sBAAsB,CAAC;AAO1C,eAAO,MAAM,KAAK,UAyDjB,CAAC"}
|
package/esm/useWS.js
CHANGED
|
@@ -7,6 +7,7 @@ import { OrderlyContext } from "./orderlyContext";
|
|
|
7
7
|
const WS_NAME = "nativeWebsocketClient";
|
|
8
8
|
export const useWS = () => {
|
|
9
9
|
const { configStore } = useContext(OrderlyContext);
|
|
10
|
+
// const prevAccountState = useRef<AccountState | null>(null);
|
|
10
11
|
const ws = useConstant(() => {
|
|
11
12
|
let websocketClient = SimpleDI.get(WS_NAME);
|
|
12
13
|
const account = SimpleDI.get(Account.instanceName);
|
|
@@ -29,11 +30,14 @@ export const useWS = () => {
|
|
|
29
30
|
}
|
|
30
31
|
// open the pirvate websocket when user login
|
|
31
32
|
account.on("change:status", (nextState) => {
|
|
32
|
-
//
|
|
33
33
|
if (nextState.status === AccountStatusEnum.EnableTrading &&
|
|
34
34
|
nextState.accountId) {
|
|
35
35
|
websocketClient.openPrivate(nextState.accountId);
|
|
36
36
|
}
|
|
37
|
+
else {
|
|
38
|
+
websocketClient.closePrivate(1000, "switch account");
|
|
39
|
+
}
|
|
40
|
+
// prevAccountState.current = nextState;
|
|
37
41
|
});
|
|
38
42
|
if (typeof window !== "undefined") {
|
|
39
43
|
window["__Orderly_WS"] = websocketClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createOrder.d.ts","sourceRoot":"","sources":["../../src/utils/createOrder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,GAAG,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAK1E,MAAM,MAAM,YAAY,GAAG;KACxB,CAAC,IAAI,MAAM,WAAW,CAAC,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;CAC7D,CAAC;AACF,MAAM,MAAM,eAAe,GAAG,IAAI,CAChC,WAAW,EACX,aAAa,GAAG,gBAAgB,GAAG,OAAO,CAC3C,CAAC;AAEF,KAAK,eAAe,GAAG;IAErB,MAAM,EAAE,GAAG,CAAC,SAAS,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,KAAK,WAAW,CAAC;IACvE,QAAQ,EAAE,CACR,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,eAAe,KACrB,OAAO,CAAC,YAAY,CAAC,CAAC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{
|
|
|
182
182
|
delete order["order_quantity"];
|
|
183
183
|
delete order["order_price"];
|
|
184
184
|
// @ts-ignore
|
|
185
|
+
delete order["order_type"];
|
|
186
|
+
// @ts-ignore
|
|
185
187
|
delete order["isStopOrder"];
|
|
186
188
|
delete order['total'];
|
|
187
189
|
return order;
|
|
@@ -240,17 +242,19 @@ export class StopMarketOrderCreator extends LimitOrderCreator {
|
|
|
240
242
|
create(values, _) {
|
|
241
243
|
const result = {
|
|
242
244
|
...this.baseOrder(values),
|
|
243
|
-
order_price: values.order_price,
|
|
245
|
+
// order_price: values.order_price,
|
|
244
246
|
trigger_price: values.trigger_price,
|
|
245
247
|
algo_type: "STOP",
|
|
246
248
|
type: "MARKET",
|
|
247
249
|
quantity: values["order_quantity"],
|
|
248
|
-
price: values["order_price"],
|
|
250
|
+
// price: values["order_price"],
|
|
249
251
|
trigger_price_type: "MARK_PRICE",
|
|
250
252
|
};
|
|
251
253
|
delete result["order_quantity"];
|
|
252
254
|
delete result["order_price"];
|
|
253
255
|
// @ts-ignore
|
|
256
|
+
delete result["order_type"];
|
|
257
|
+
// @ts-ignore
|
|
254
258
|
delete result["isStopOrder"];
|
|
255
259
|
delete result['total'];
|
|
256
260
|
console.log("result is", result);
|
|
@@ -13,6 +13,7 @@ type orderEntryInputs = [
|
|
|
13
13
|
type orderEntryInputHandle = (inputs: orderEntryInputs) => orderEntryInputs;
|
|
14
14
|
export declare const cleanStringStyle: (str: string | number) => string;
|
|
15
15
|
export declare function baseInputHandle(inputs: orderEntryInputs): orderEntryInputs;
|
|
16
|
+
export declare function orderTypeHandle(inputs: orderEntryInputs): orderEntryInputs;
|
|
16
17
|
/**
|
|
17
18
|
* digital precision processing
|
|
18
19
|
* @param inputs
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orderEntryHelper.d.ts","sourceRoot":"","sources":["../../src/utils/orderEntryHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAa,MAAM,wBAAwB,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AAE,gBAAgB,GAAG,gBAAgB,CAU1E;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kDA8B1E;AA2KD,eAAO,MAAM,mBAAmB,cACnB,MAAM,KAChB,qBAgBF,CAAC"}
|
|
@@ -43,6 +43,15 @@ export function baseInputHandle(inputs) {
|
|
|
43
43
|
];
|
|
44
44
|
// return [values, input, value, markPrice];
|
|
45
45
|
}
|
|
46
|
+
export function orderTypeHandle(inputs) {
|
|
47
|
+
const [values, input, value, markPrice, config] = inputs;
|
|
48
|
+
if (value === OrderType.LIMIT || value === OrderType.STOP_LIMIT) {
|
|
49
|
+
if (values.order_price === "") {
|
|
50
|
+
values.total = "";
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return [values, input, value, markPrice, config];
|
|
54
|
+
}
|
|
46
55
|
/**
|
|
47
56
|
* digital precision processing
|
|
48
57
|
* @param inputs
|
|
@@ -216,6 +225,8 @@ function otherInputHandle(inputs) {
|
|
|
216
225
|
}
|
|
217
226
|
export const getCalculateHandler = (fieldName) => {
|
|
218
227
|
switch (fieldName) {
|
|
228
|
+
case "order_type":
|
|
229
|
+
return orderTypeHandle;
|
|
219
230
|
case "order_quantity": {
|
|
220
231
|
return quantityInputHandle;
|
|
221
232
|
}
|
package/esm/version.d.ts
CHANGED
package/esm/version.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
if (typeof window !== 'undefined') {
|
|
2
2
|
window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
|
|
3
|
-
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.1.4-experimental.
|
|
3
|
+
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.1.4-experimental.2";
|
|
4
4
|
}
|
|
5
5
|
;
|
|
6
|
-
export default "1.1.4-experimental.
|
|
6
|
+
export default "1.1.4-experimental.2";
|
package/lib/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { usePreLoadData } from "./usePreloadData";
|
|
|
11
11
|
export { useEventEmitter } from "./useEventEmitter";
|
|
12
12
|
export { useSessionStorage } from "./useSessionStorage";
|
|
13
13
|
export { useLocalStorage } from "./useLocalStorage";
|
|
14
|
+
export { parseJSON } from "./utils/json";
|
|
14
15
|
export { default as useConstant } from "use-constant";
|
|
15
16
|
export { useWS } from "./useWS";
|
|
16
17
|
export { useConfig } from "./useConfig";
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC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E,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7D,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EACL,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAElC,cAAc,wBAAwB,CAAC;AAGvC,OAAO,MAAM,EAAE,EAAE,KAAK,gBAAgB,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAE/D,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,CAAC;AAEpD,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,cAAc,wBAAwB,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
29
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.cleanStringStyle = exports.useMediaQuery = exports.SWRConfig = exports.useSWR = exports.useWalletConnector = exports.WalletConnectorContext = exports.OrderlyConfigProvider = exports.WsNetworkStatus = exports.useWsStatus = exports.useConfig = exports.useWS = exports.useConstant = exports.useLocalStorage = exports.useSessionStorage = exports.useEventEmitter = exports.usePreLoadData = exports.useAccountInstance = exports.useAccount = exports.useBoolean = exports.usePrivateInfiniteQuery = exports.usePrivateQuery = exports.useMutation = exports.useLazyQuery = exports.useQuery = exports.version = void 0;
|
|
32
|
+
exports.cleanStringStyle = exports.useMediaQuery = exports.SWRConfig = exports.useSWR = exports.useWalletConnector = exports.WalletConnectorContext = exports.OrderlyConfigProvider = exports.WsNetworkStatus = exports.useWsStatus = exports.useConfig = exports.useWS = exports.useConstant = exports.parseJSON = exports.useLocalStorage = exports.useSessionStorage = exports.useEventEmitter = exports.usePreLoadData = exports.useAccountInstance = exports.useAccount = exports.useBoolean = exports.usePrivateInfiniteQuery = exports.usePrivateQuery = exports.useMutation = exports.useLazyQuery = exports.useQuery = exports.version = void 0;
|
|
33
33
|
var version_1 = require("./version");
|
|
34
34
|
Object.defineProperty(exports, "version", { enumerable: true, get: function () { return __importDefault(version_1).default; } });
|
|
35
35
|
var useQuery_1 = require("./useQuery");
|
|
@@ -56,6 +56,8 @@ var useSessionStorage_1 = require("./useSessionStorage");
|
|
|
56
56
|
Object.defineProperty(exports, "useSessionStorage", { enumerable: true, get: function () { return useSessionStorage_1.useSessionStorage; } });
|
|
57
57
|
var useLocalStorage_1 = require("./useLocalStorage");
|
|
58
58
|
Object.defineProperty(exports, "useLocalStorage", { enumerable: true, get: function () { return useLocalStorage_1.useLocalStorage; } });
|
|
59
|
+
var json_1 = require("./utils/json");
|
|
60
|
+
Object.defineProperty(exports, "parseJSON", { enumerable: true, get: function () { return json_1.parseJSON; } });
|
|
59
61
|
var use_constant_1 = require("use-constant");
|
|
60
62
|
Object.defineProperty(exports, "useConstant", { enumerable: true, get: function () { return __importDefault(use_constant_1).default; } });
|
|
61
63
|
var useWS_1 = require("./useWS");
|
|
@@ -28,7 +28,7 @@ export declare const useDeposit: (options?: useDepositOptions) => {
|
|
|
28
28
|
depositFee: bigint;
|
|
29
29
|
/** enquiring depositFee status on chain */
|
|
30
30
|
depositFeeRevalidating: boolean;
|
|
31
|
-
approve: (amount?: string) => Promise<
|
|
31
|
+
approve: (amount?: string) => Promise<void | undefined>;
|
|
32
32
|
deposit: () => Promise<any>;
|
|
33
33
|
fetchBalances: (tokens: API.TokenInfo[]) => Promise<void>;
|
|
34
34
|
fetchBalance: (address: string, decimals?: number) => Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDeposit.d.ts","sourceRoot":"","sources":["../../src/orderly/useDeposit.ts"],"names":[],"mappings":";AAEA,OAAO,EACL,GAAG,EAMH,SAAS,EAEV,MAAM,wBAAwB,CAAC;AAMhC,MAAM,MAAM,iBAAiB,GAAG;IAE9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,UAAU,aAAc,iBAAiB;
|
|
1
|
+
{"version":3,"file":"useDeposit.d.ts","sourceRoot":"","sources":["../../src/orderly/useDeposit.ts"],"names":[],"mappings":";AAEA,OAAO,EACL,GAAG,EAMH,SAAS,EAEV,MAAM,wBAAwB,CAAC;AAMhC,MAAM,MAAM,iBAAiB,GAAG;IAE9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,UAAU,aAAc,iBAAiB;IA4TlD,gCAAgC;;;;;;;;;;;;;IAOhC,oBAAoB;;IAEpB,qCAAqC;;IAErC,2CAA2C;;uBApI3B,MAAM;;4BAhGyB,IAAI,SAAS,EAAE;4BAvC9C,MAAM,aAAa,MAAM;IAiRzC,yBAAyB;;CAG5B,CAAC"}
|
|
@@ -162,22 +162,33 @@ const useDeposit = (options) => {
|
|
|
162
162
|
return account.assetsManager
|
|
163
163
|
.approve(options.address, amount)
|
|
164
164
|
.then((result) => {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
165
|
+
return account.walletClient
|
|
166
|
+
?.pollTransactionReceiptWithBackoff(result.hash)
|
|
167
|
+
.then((receipt) => {
|
|
168
|
+
if (receipt.status === 1) {
|
|
169
|
+
account.assetsManager
|
|
170
|
+
.getAllowance(options.address)
|
|
171
|
+
.then((allowance) => {
|
|
172
|
+
setAllowance(() => allowance);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
});
|
|
169
176
|
});
|
|
170
|
-
}, [account, getAllowance, options
|
|
177
|
+
}, [account, getAllowance, options, dst]);
|
|
171
178
|
const deposit = (0, react_1.useCallback)(async () => {
|
|
172
179
|
// only support orderly deposit
|
|
173
180
|
return account.assetsManager
|
|
174
181
|
.deposit(quantity, depositFee)
|
|
175
182
|
.then((res) => {
|
|
176
|
-
|
|
183
|
+
account.assetsManager
|
|
184
|
+
.getAllowance(options?.address)
|
|
185
|
+
.then((allowance) => {
|
|
186
|
+
setAllowance(() => allowance);
|
|
187
|
+
});
|
|
177
188
|
setBalance((value) => new utils_1.Decimal(value).sub(quantity).toString());
|
|
178
189
|
return res;
|
|
179
190
|
});
|
|
180
|
-
}, [account, fetchBalance,
|
|
191
|
+
}, [account, fetchBalance, quantity, depositFee]);
|
|
181
192
|
const loopGetBalance = async () => {
|
|
182
193
|
getBalanceListener.current && clearTimeout(getBalanceListener.current);
|
|
183
194
|
getBalanceListener.current = setTimeout(async () => {
|
|
@@ -35,20 +35,29 @@ export type UseOrderEntryReturn = {
|
|
|
35
35
|
metaState: UseOrderEntryMetaState;
|
|
36
36
|
symbolConfig: API.SymbolExt;
|
|
37
37
|
};
|
|
38
|
-
export type OrderParams = Required<Pick<OrderEntity, "side" | "order_type" | "symbol">> & Partial<Omit<OrderEntity, "side" | "symbol" | "order_type"
|
|
38
|
+
export type OrderParams = Required<Pick<OrderEntity, "side" | "order_type" | "symbol">> & Partial<Omit<OrderEntity, "side" | "symbol" | "order_type">>;
|
|
39
39
|
/**
|
|
40
40
|
* Create Order
|
|
41
41
|
* @example
|
|
42
42
|
* ```tsx
|
|
43
|
+
* import { useOrderEntry } from "@orderly.network/hooks";
|
|
44
|
+
* import {OrderSide, OrderType} from '@orderly.network/types';
|
|
45
|
+
*
|
|
43
46
|
* const { formattedOrder, onSubmit, helper } = useOrderEntry({
|
|
44
47
|
* symbol: "PERP_ETH_USDC",
|
|
45
48
|
* side: OrderSide.BUY,
|
|
46
49
|
* order_type: OrderType.LIMIT,
|
|
47
50
|
* order_price: 10000,
|
|
48
51
|
* order_quantity: 1,
|
|
52
|
+
* },{
|
|
53
|
+
* // **Note:** it's required
|
|
54
|
+
* watchOrderbook: true,
|
|
49
55
|
* });
|
|
50
56
|
* ```
|
|
51
57
|
*/
|
|
52
58
|
export declare function useOrderEntry(order: OrderParams, options?: UseOrderEntryOptions): UseOrderEntryReturn;
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated
|
|
61
|
+
*/
|
|
53
62
|
export declare function useOrderEntry(symbol: string, side: OrderSide, reduceOnly: boolean): UseOrderEntryReturn;
|
|
54
63
|
//# sourceMappingURL=useOrderEntry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOrderEntry.d.ts","sourceRoot":"","sources":["../../src/orderly/useOrderEntry.ts"],"names":[],"mappings":"AACA,OAAO,EACL,GAAG,EACH,WAAW,EACX,SAAS,EAGV,MAAM,wBAAwB,CAAC;AAkBhC,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,CACT,IAAI,EAAE,WAAW,KACd;SAAG,CAAC,IAAI,MAAM,WAAW,CAAC,CAAC,EAAE,MAAM;KAAE,GAAG,IAAI,GAAG,SAAS,CAAC;CAC/D,CAAC;AAEF,MAAM,MAAM,sBAA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("../useEventEmitter");
|
|
17
17
|
const use_debounce_1 = require("use-debounce");
|
|
18
|
-
const TIEMSTAMP = "timestamp";
|
|
19
18
|
function useOrderEntry(symbolOrOrder, sideOrOptions, reduceOnly, options) {
|
|
20
|
-
//
|
|
19
|
+
// if symbolOrOrder is string, then it's deprecated
|
|
20
|
+
let isNewVersion = false;
|
|
21
21
|
if (typeof symbolOrOrder === "object") {
|
|
22
|
+
isNewVersion = true;
|
|
22
23
|
if (!symbolOrOrder.symbol) {
|
|
23
24
|
throw new types_1.SDKError("symbol is required");
|
|
24
25
|
}
|
|
@@ -28,21 +29,12 @@ function useOrderEntry(symbolOrOrder, sideOrOptions, reduceOnly, options) {
|
|
|
28
29
|
if (!symbolOrOrder.order_type) {
|
|
29
30
|
throw new types_1.SDKError("order_type is required");
|
|
30
31
|
}
|
|
31
|
-
// if (typeof symbolOrOrder[TIEMSTAMP] === "undefined") {
|
|
32
|
-
// console.warn(
|
|
33
|
-
// "The timestamp is not set, the order status may be out of sync."
|
|
34
|
-
// );
|
|
35
|
-
// }
|
|
36
|
-
// add timestamp to order, fix the issue of the same order
|
|
37
|
-
// symbolOrOrder[TIEMSTAMP] = Date.now();
|
|
38
32
|
}
|
|
39
|
-
// console.log("+++++++", symbolOrOrder);
|
|
40
33
|
const prevOrderData = (0, react_1.useRef)(null);
|
|
41
34
|
// Cache data from the last calculate
|
|
42
35
|
const orderDataCache = (0, react_1.useRef)(null);
|
|
43
36
|
//
|
|
44
37
|
const notSupportData = (0, react_1.useRef)({});
|
|
45
|
-
const [doCreateOrder, { data, error, reset, isMutating }] = (0, useMutation_1.useMutation)(orderDataCache?.current?.isStopOrder ? "/v1/algo/order" : "/v1/order");
|
|
46
38
|
const [errors, setErrors] = (0, react_1.useState)(null);
|
|
47
39
|
const ee = (0, useEventEmitter_1.useEventEmitter)();
|
|
48
40
|
const fieldDirty = (0, react_1.useRef)({});
|
|
@@ -189,7 +181,10 @@ function useOrderEntry(symbolOrOrder, sideOrOptions, reduceOnly, options) {
|
|
|
189
181
|
needParse?.symbol,
|
|
190
182
|
needParse?.reduce_only,
|
|
191
183
|
needParse?.side,
|
|
184
|
+
needParse?.visible_quantity,
|
|
192
185
|
]);
|
|
186
|
+
const isStopOrder = parsedData?.order_type === types_1.OrderType.STOP_LIMIT || parsedData?.order_type === types_1.OrderType.STOP_MARKET;
|
|
187
|
+
const [doCreateOrder, { data, error, reset, isMutating }] = (0, useMutation_1.useMutation)(isStopOrder ? "/v1/algo/order" : "/v1/order");
|
|
193
188
|
// const maxQty = 3;
|
|
194
189
|
const createOrder = (values) => {
|
|
195
190
|
if (!values.symbol) {
|
|
@@ -343,8 +338,16 @@ function useOrderEntry(symbolOrOrder, sideOrOptions, reduceOnly, options) {
|
|
|
343
338
|
]);
|
|
344
339
|
//====== update orderbook ask0/bid0 ======
|
|
345
340
|
(0, react_1.useEffect)(() => {
|
|
346
|
-
if (
|
|
347
|
-
|
|
341
|
+
if (isNewVersion) {
|
|
342
|
+
if (!optionsValue?.watchOrderbook) {
|
|
343
|
+
throw new types_1.SDKError("In order to calculate the estimated liquidation price, the `options.watchOrderbook` parameter must be set to true.");
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
if (!optionsValue?.watchOrderbook) {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
348
351
|
ee.on("orderbook:update", onOrderbookUpdate);
|
|
349
352
|
return () => {
|
|
350
353
|
ee.off("orderbook_update", onOrderbookUpdate);
|
|
@@ -357,8 +360,12 @@ function useOrderEntry(symbolOrOrder, sideOrOptions, reduceOnly, options) {
|
|
|
357
360
|
const getPriceAndQty = (symbolOrOrder) => {
|
|
358
361
|
let quantity = Number(symbolOrOrder.order_quantity);
|
|
359
362
|
const orderPrice = Number(symbolOrOrder.order_price);
|
|
360
|
-
if (isNaN(quantity) || quantity <= 0
|
|
363
|
+
if (isNaN(quantity) || quantity <= 0) {
|
|
361
364
|
return null;
|
|
365
|
+
}
|
|
366
|
+
if (!!options?.watchOrderbook && askAndBid.current.length === 0) {
|
|
367
|
+
throw new types_1.SDKError("Please check if you are using the `useOrderbookStream` hook or if the orderBook has data.");
|
|
368
|
+
}
|
|
362
369
|
if ((symbolOrOrder.order_type === types_1.OrderType.LIMIT ||
|
|
363
370
|
symbolOrOrder.order_type === types_1.OrderType.STOP_LIMIT) &&
|
|
364
371
|
isNaN(orderPrice))
|
|
@@ -9,13 +9,20 @@ export type OrderbookData = {
|
|
|
9
9
|
* @param level
|
|
10
10
|
* @param data
|
|
11
11
|
*/
|
|
12
|
-
export declare const reduceOrderbook: (depth: number | undefined, level: number, data: OrderbookData) => OrderbookData;
|
|
12
|
+
export declare const reduceOrderbook: (depth: number | undefined, level: number, padding: boolean, data: OrderbookData) => OrderbookData;
|
|
13
13
|
export declare const mergeOrderbook: (data: OrderbookData, update: OrderbookData) => {
|
|
14
14
|
asks: OrderBookItem[];
|
|
15
15
|
bids: OrderBookItem[];
|
|
16
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Configuration for the Order Book
|
|
19
|
+
* @level Indicates the number of data entries to return for ask/bid, default is 10
|
|
20
|
+
* @padding Whether to fill in when the actual data entries are less than the level. If filled, it will add [nan, nan, nan, nan]
|
|
21
|
+
* default is true
|
|
22
|
+
*/
|
|
17
23
|
export type OrderbookOptions = {
|
|
18
24
|
level?: number;
|
|
25
|
+
padding?: boolean;
|
|
19
26
|
};
|
|
20
27
|
/**
|
|
21
28
|
* @name useOrderbookStream
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOrderbookStream.d.ts","sourceRoot":"","sources":["../../src/orderly/useOrderbookStream.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,aAAa,GAAG,MAAM,EAAE,CAAC;AAErC,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,aAAa,EAAE,CAAC;IACtB,IAAI,EAAE,aAAa,EAAE,CAAC;CACvB,CAAC;AAyFF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,UACnB,MAAM,GAAG,SAAS,SAClB,MAAM,
|
|
1
|
+
{"version":3,"file":"useOrderbookStream.d.ts","sourceRoot":"","sources":["../../src/orderly/useOrderbookStream.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,aAAa,GAAG,MAAM,EAAE,CAAC;AAErC,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,aAAa,EAAE,CAAC;IACtB,IAAI,EAAE,aAAa,EAAE,CAAC;CACvB,CAAC;AAyFF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,UACnB,MAAM,GAAG,SAAS,SAClB,MAAM,WACJ,OAAO,QACV,aAAa,KAClB,aAqDF,CAAC;AAgCF,eAAO,MAAM,cAAc,SAAU,aAAa,UAAU,aAAa;;;CAWxE,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAIF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,WACrB,MAAM,YACL,aAAa,YACZ,gBAAgB;;;;;;;;;;;2BA2HgB,MAAM;;;;;;;;;IAmDjD,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -10,7 +10,7 @@ const useSymbolsInfo_1 = require("./useSymbolsInfo");
|
|
|
10
10
|
const utils_1 = require("@orderly.network/utils");
|
|
11
11
|
const ramda_1 = require("ramda");
|
|
12
12
|
const types_1 = require("@orderly.network/types");
|
|
13
|
-
const paddingFn = (len) => Array(len).fill([Number.NaN, Number.NaN, Number.NaN]);
|
|
13
|
+
const paddingFn = (len) => Array(len).fill([Number.NaN, Number.NaN, Number.NaN, Number.NaN]);
|
|
14
14
|
const asksSortFn = (a, b) => a[0] - b[0];
|
|
15
15
|
const bidsSortFn = (a, b) => b[0] - a[0];
|
|
16
16
|
// const commonSortFn = (a: OrderBookItem, b: OrderBookItem) => b[0] - a[0];
|
|
@@ -81,28 +81,37 @@ const reduceItems = (depth, level, data, asks = false) => {
|
|
|
81
81
|
* @param level
|
|
82
82
|
* @param data
|
|
83
83
|
*/
|
|
84
|
-
const reduceOrderbook = (depth, level, data) => {
|
|
84
|
+
const reduceOrderbook = (depth, level, padding, data) => {
|
|
85
85
|
let asks = reduceItems(depth, level, data.asks, true);
|
|
86
86
|
let bids = reduceItems(depth, level, data.bids);
|
|
87
87
|
/// not empty and asks.price <= bids.price
|
|
88
88
|
if (asks.length !== 0 && bids.length !== 0 && asks[0][0] <= bids[0][0]) {
|
|
89
89
|
if (asks.length === 1) {
|
|
90
|
-
const [price, qty, newQuantity] = asks[0];
|
|
90
|
+
const [price, qty, newQuantity, newAmount] = asks[0];
|
|
91
91
|
asks.shift();
|
|
92
|
-
asks.push([price + (depth === undefined ? 0 : depth), qty, newQuantity]);
|
|
92
|
+
asks.push([price + (depth === undefined ? 0 : depth), qty, newQuantity, newAmount]);
|
|
93
93
|
}
|
|
94
94
|
else {
|
|
95
95
|
const [bidPrice] = bids[0];
|
|
96
96
|
while (asks.length > 0) {
|
|
97
|
-
const [askPrice, askQty, newQuantity] = asks[0];
|
|
97
|
+
const [askPrice, askQty, newQuantity, newAmount] = asks[0];
|
|
98
98
|
if (askPrice <= bidPrice) {
|
|
99
|
+
// console.log("xxxxxxxxxxx reset ask list begin", [...asks], { ...asks[0] });
|
|
99
100
|
asks.shift();
|
|
101
|
+
// let logStr = "";
|
|
100
102
|
for (let index = 0; index < asks.length; index++) {
|
|
101
103
|
if (index === 0) {
|
|
102
|
-
asks[index][1]
|
|
104
|
+
const quantity = asks[index][1] + askQty;
|
|
105
|
+
asks[index][1] = quantity;
|
|
106
|
+
asks[index][2] = quantity;
|
|
107
|
+
asks[index][3] += newAmount;
|
|
103
108
|
}
|
|
104
|
-
|
|
109
|
+
else {
|
|
110
|
+
asks[index][3] += newAmount;
|
|
111
|
+
}
|
|
112
|
+
// logStr += `index: ${index} ${asks[index]}\n`;
|
|
105
113
|
}
|
|
114
|
+
// console.log("xxxxxxxxxxx reset ask list end", logStr);
|
|
106
115
|
}
|
|
107
116
|
else {
|
|
108
117
|
break;
|
|
@@ -111,15 +120,12 @@ const reduceOrderbook = (depth, level, data) => {
|
|
|
111
120
|
}
|
|
112
121
|
}
|
|
113
122
|
asks = asks.reverse();
|
|
114
|
-
|
|
115
|
-
asks
|
|
116
|
-
|
|
117
|
-
bids
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
// let maxBidQty = bids.reduce((a,b) => Math.max(a, b[1]),0);
|
|
121
|
-
// asks = asks.map((item) => [...item, maxAskQty]);
|
|
122
|
-
// bids = bids.map((item) => [...item, maxBidQty]);
|
|
123
|
+
if (padding) {
|
|
124
|
+
asks =
|
|
125
|
+
asks.length < level ? paddingFn(level - asks.length).concat(asks) : asks;
|
|
126
|
+
bids =
|
|
127
|
+
bids.length < level ? bids.concat(paddingFn(level - bids.length)) : bids;
|
|
128
|
+
}
|
|
123
129
|
return {
|
|
124
130
|
asks: asks,
|
|
125
131
|
bids: bids,
|
|
@@ -176,6 +182,7 @@ const useOrderbookStream = (symbol, initial = INIT_DATA, options) => {
|
|
|
176
182
|
throw new types_1.SDKError("useOrderbookStream requires a symbol");
|
|
177
183
|
}
|
|
178
184
|
const level = options?.level ?? 10;
|
|
185
|
+
const padding = options?.padding ?? true;
|
|
179
186
|
const [requestData, setRequestData] = (0, react_1.useState)(null);
|
|
180
187
|
const [data, setData] = (0, react_1.useState)(initial);
|
|
181
188
|
const [isLoading, setIsLoading] = (0, react_1.useState)(true);
|
|
@@ -230,7 +237,7 @@ const useOrderbookStream = (symbol, initial = INIT_DATA, options) => {
|
|
|
230
237
|
// clean the data;
|
|
231
238
|
setData(INIT_DATA);
|
|
232
239
|
};
|
|
233
|
-
}, [symbol
|
|
240
|
+
}, [symbol]);
|
|
234
241
|
// const {data:markPrices} = useMarkPricesStream();
|
|
235
242
|
const { data: markPrice } = (0, useMarkPrice_1.useMarkPrice)(symbol);
|
|
236
243
|
(0, react_1.useEffect)(() => {
|
|
@@ -284,17 +291,17 @@ const useOrderbookStream = (symbol, initial = INIT_DATA, options) => {
|
|
|
284
291
|
(0, react_1.useEffect)(() => {
|
|
285
292
|
prevMiddlePrice.current = middlePrice;
|
|
286
293
|
}, [middlePrice]);
|
|
287
|
-
const reducedData = (0, exports.reduceOrderbook)(depth, level, {
|
|
294
|
+
const reducedData = (0, exports.reduceOrderbook)(depth, level, padding, {
|
|
288
295
|
asks: [...data.asks],
|
|
289
296
|
bids: [...data.bids],
|
|
290
297
|
});
|
|
291
298
|
// emit the asks0 and bids0
|
|
292
299
|
(0, react_1.useEffect)(() => {
|
|
293
300
|
eventEmitter.emit("orderbook:update", [
|
|
294
|
-
reducedData.asks[0][0],
|
|
295
|
-
reducedData.bids[0][0],
|
|
301
|
+
reducedData.asks?.[0]?.[0],
|
|
302
|
+
reducedData.bids?.[0]?.[0],
|
|
296
303
|
]);
|
|
297
|
-
}, [reducedData.asks[0][0], reducedData.bids[0][0]]);
|
|
304
|
+
}, [reducedData.asks?.[0]?.[0], reducedData.bids?.[0]?.[0]]);
|
|
298
305
|
return [
|
|
299
306
|
{
|
|
300
307
|
asks: reducedData.asks.slice(-level),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePositionStream.d.ts","sourceRoot":"","sources":["../../src/orderly/usePositionStream.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAI5C,OAAO,EAAE,KAAK,GAAG,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAK/D,OAAO,EAAE,OAAO,EAAQ,MAAM,wBAAwB,CAAC;AAIvD,KAAK,SAAS,GAAG,WAAW,GAAG,WAAW,CAAC;AAE3C,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,CACL,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,YAAY,GAAG,aAAa,GAAG,MAAM,CAAC,KAC5D,IAAI,CAAC;CACX;AAED,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"usePositionStream.d.ts","sourceRoot":"","sources":["../../src/orderly/usePositionStream.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAI5C,OAAO,EAAE,KAAK,GAAG,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAK/D,OAAO,EAAE,OAAO,EAAQ,MAAM,wBAAwB,CAAC;AAIvD,KAAK,SAAS,GAAG,WAAW,GAAG,WAAW,CAAC;AAE3C,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,CACL,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,YAAY,GAAG,aAAa,GAAG,MAAM,CAAC,KAC5D,IAAI,CAAC;CACX;AAED,eAAO,MAAM,iBAAiB,YAInB,MAAM,YACL,gBAAgB,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE;;;;;;;;;;EAiRtD,CAAC;AAEF,eAAO,MAAM,yBAAyB,sBAIpC,CAAC"}
|
|
@@ -12,7 +12,11 @@ const ramda_1 = require("ramda");
|
|
|
12
12
|
const parseHolding_1 = require("../utils/parseHolding");
|
|
13
13
|
const utils_1 = require("@orderly.network/utils");
|
|
14
14
|
const useMarketsStream_1 = require("./useMarketsStream");
|
|
15
|
-
const usePositionStream = (
|
|
15
|
+
const usePositionStream = (
|
|
16
|
+
/**
|
|
17
|
+
* If symbol is passed, only the position of that symbol will be returned.
|
|
18
|
+
*/
|
|
19
|
+
symbol, options) => {
|
|
16
20
|
const symbolInfo = (0, useSymbolsInfo_1.useSymbolsInfo)();
|
|
17
21
|
const { data: accountInfo } = (0, usePrivateQuery_1.usePrivateQuery)("/v1/client/info");
|
|
18
22
|
const { data: holding } = (0, usePrivateQuery_1.usePrivateQuery)("/v1/client/holding", {
|
package/lib/useWS.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWS.d.ts","sourceRoot":"","sources":["../src/useWS.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,sBAAsB,CAAC;AAO1C,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"useWS.d.ts","sourceRoot":"","sources":["../src/useWS.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,sBAAsB,CAAC;AAO1C,eAAO,MAAM,KAAK,UAyDjB,CAAC"}
|
package/lib/useWS.js
CHANGED
|
@@ -13,6 +13,7 @@ const orderlyContext_1 = require("./orderlyContext");
|
|
|
13
13
|
const WS_NAME = "nativeWebsocketClient";
|
|
14
14
|
const useWS = () => {
|
|
15
15
|
const { configStore } = (0, react_1.useContext)(orderlyContext_1.OrderlyContext);
|
|
16
|
+
// const prevAccountState = useRef<AccountState | null>(null);
|
|
16
17
|
const ws = (0, use_constant_1.default)(() => {
|
|
17
18
|
let websocketClient = core_1.SimpleDI.get(WS_NAME);
|
|
18
19
|
const account = core_1.SimpleDI.get(core_1.Account.instanceName);
|
|
@@ -35,11 +36,14 @@ const useWS = () => {
|
|
|
35
36
|
}
|
|
36
37
|
// open the pirvate websocket when user login
|
|
37
38
|
account.on("change:status", (nextState) => {
|
|
38
|
-
//
|
|
39
39
|
if (nextState.status === types_1.AccountStatusEnum.EnableTrading &&
|
|
40
40
|
nextState.accountId) {
|
|
41
41
|
websocketClient.openPrivate(nextState.accountId);
|
|
42
42
|
}
|
|
43
|
+
else {
|
|
44
|
+
websocketClient.closePrivate(1000, "switch account");
|
|
45
|
+
}
|
|
46
|
+
// prevAccountState.current = nextState;
|
|
43
47
|
});
|
|
44
48
|
if (typeof window !== "undefined") {
|
|
45
49
|
window["__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BAAsB,SAAQ,iBAAiB;IAC1D,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,eAAe,GAAG,WAAW;IAsBjE,QAAQ,CACN,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,YAAY,CAAC;CA+DzB;AACD,qBAAa,sBAAuB,SAAQ,iBAAiB;IAC3D,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,EAAE,eAAe,GAAG,WAAW;IAsB5D,QAAQ,CACN,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,YAAY,CAAC;CAgBzB;AAED,qBAAa,mBAAoB,SAAQ,gBAAgB;IACvD,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW;IAOtC,QAAQ,CACN,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,YAAY,CAAC;CAGzB;AAED,eAAO,MAAM,mBAAmB,aAQ/B,CAAC;AAEF,qBAAa,YAAY;IACvB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,YAAY,GAAG,IAAI;CA0BpD"}
|
package/lib/utils/createOrder.js
CHANGED
|
@@ -191,6 +191,8 @@ class StopLimitOrderCreator extends LimitOrderCreator {
|
|
|
191
191
|
delete order["order_quantity"];
|
|
192
192
|
delete order["order_price"];
|
|
193
193
|
// @ts-ignore
|
|
194
|
+
delete order["order_type"];
|
|
195
|
+
// @ts-ignore
|
|
194
196
|
delete order["isStopOrder"];
|
|
195
197
|
delete order['total'];
|
|
196
198
|
return order;
|
|
@@ -250,17 +252,19 @@ class StopMarketOrderCreator extends LimitOrderCreator {
|
|
|
250
252
|
create(values, _) {
|
|
251
253
|
const result = {
|
|
252
254
|
...this.baseOrder(values),
|
|
253
|
-
order_price: values.order_price,
|
|
255
|
+
// order_price: values.order_price,
|
|
254
256
|
trigger_price: values.trigger_price,
|
|
255
257
|
algo_type: "STOP",
|
|
256
258
|
type: "MARKET",
|
|
257
259
|
quantity: values["order_quantity"],
|
|
258
|
-
price: values["order_price"],
|
|
260
|
+
// price: values["order_price"],
|
|
259
261
|
trigger_price_type: "MARK_PRICE",
|
|
260
262
|
};
|
|
261
263
|
delete result["order_quantity"];
|
|
262
264
|
delete result["order_price"];
|
|
263
265
|
// @ts-ignore
|
|
266
|
+
delete result["order_type"];
|
|
267
|
+
// @ts-ignore
|
|
264
268
|
delete result["isStopOrder"];
|
|
265
269
|
delete result['total'];
|
|
266
270
|
console.log("result is", result);
|
|
@@ -13,6 +13,7 @@ type orderEntryInputs = [
|
|
|
13
13
|
type orderEntryInputHandle = (inputs: orderEntryInputs) => orderEntryInputs;
|
|
14
14
|
export declare const cleanStringStyle: (str: string | number) => string;
|
|
15
15
|
export declare function baseInputHandle(inputs: orderEntryInputs): orderEntryInputs;
|
|
16
|
+
export declare function orderTypeHandle(inputs: orderEntryInputs): orderEntryInputs;
|
|
16
17
|
/**
|
|
17
18
|
* digital precision processing
|
|
18
19
|
* @param inputs
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orderEntryHelper.d.ts","sourceRoot":"","sources":["../../src/utils/orderEntryHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAa,MAAM,wBAAwB,CAAC;AAGhE,MAAM,MAAM,cAAc,GAAG,MAAM,WAAW,GAAG,MAAM,CAAC;AAGxD,KAAK,gBAAgB,GAAG;IACtB,OAAO,CAAC,WAAW,CAAC;IAEpB,MAAM,WAAW;IACjB,GAAG;IACH,MAAM;IACN;QACE,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;KACjB;CACF,CAAC;AAEF,KAAK,qBAAqB,GAAG,CAAC,MAAM,EAAE,gBAAgB,KAAK,gBAAgB,CAAC;AAU5E,eAAO,MAAM,gBAAgB,QAAS,MAAM,GAAG,MAAM,KAAG,MAavD,CAAC;AAEF,wBAAgB,eAAe,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CA0B1E;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kDA8B1E;AA2KD,eAAO,MAAM,mBAAmB,cACnB,MAAM,KAChB,
|
|
1
|
+
{"version":3,"file":"orderEntryHelper.d.ts","sourceRoot":"","sources":["../../src/utils/orderEntryHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAa,MAAM,wBAAwB,CAAC;AAGhE,MAAM,MAAM,cAAc,GAAG,MAAM,WAAW,GAAG,MAAM,CAAC;AAGxD,KAAK,gBAAgB,GAAG;IACtB,OAAO,CAAC,WAAW,CAAC;IAEpB,MAAM,WAAW;IACjB,GAAG;IACH,MAAM;IACN;QACE,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;KACjB;CACF,CAAC;AAEF,KAAK,qBAAqB,GAAG,CAAC,MAAM,EAAE,gBAAgB,KAAK,gBAAgB,CAAC;AAU5E,eAAO,MAAM,gBAAgB,QAAS,MAAM,GAAG,MAAM,KAAG,MAavD,CAAC;AAEF,wBAAgB,eAAe,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CA0B1E;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAU1E;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kDA8B1E;AA2KD,eAAO,MAAM,mBAAmB,cACnB,MAAM,KAChB,qBAgBF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCalculateHandler = exports.orderEntityFormatHandle = exports.baseInputHandle = exports.cleanStringStyle = void 0;
|
|
3
|
+
exports.getCalculateHandler = exports.orderEntityFormatHandle = exports.orderTypeHandle = exports.baseInputHandle = exports.cleanStringStyle = void 0;
|
|
4
4
|
const types_1 = require("@orderly.network/types");
|
|
5
5
|
const utils_1 = require("@orderly.network/utils");
|
|
6
6
|
const needNumberOnlyFields = [
|
|
@@ -48,6 +48,16 @@ function baseInputHandle(inputs) {
|
|
|
48
48
|
// return [values, input, value, markPrice];
|
|
49
49
|
}
|
|
50
50
|
exports.baseInputHandle = baseInputHandle;
|
|
51
|
+
function orderTypeHandle(inputs) {
|
|
52
|
+
const [values, input, value, markPrice, config] = inputs;
|
|
53
|
+
if (value === types_1.OrderType.LIMIT || value === types_1.OrderType.STOP_LIMIT) {
|
|
54
|
+
if (values.order_price === "") {
|
|
55
|
+
values.total = "";
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return [values, input, value, markPrice, config];
|
|
59
|
+
}
|
|
60
|
+
exports.orderTypeHandle = orderTypeHandle;
|
|
51
61
|
/**
|
|
52
62
|
* digital precision processing
|
|
53
63
|
* @param inputs
|
|
@@ -222,6 +232,8 @@ function otherInputHandle(inputs) {
|
|
|
222
232
|
}
|
|
223
233
|
const getCalculateHandler = (fieldName) => {
|
|
224
234
|
switch (fieldName) {
|
|
235
|
+
case "order_type":
|
|
236
|
+
return orderTypeHandle;
|
|
225
237
|
case "order_quantity": {
|
|
226
238
|
return quantityInputHandle;
|
|
227
239
|
}
|
package/lib/version.d.ts
CHANGED
package/lib/version.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
if (typeof window !== 'undefined') {
|
|
4
4
|
window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
|
|
5
|
-
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.1.4-experimental.
|
|
5
|
+
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.1.4-experimental.2";
|
|
6
6
|
}
|
|
7
7
|
;
|
|
8
|
-
exports.default = "1.1.4-experimental.
|
|
8
|
+
exports.default = "1.1.4-experimental.2";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orderly.network/hooks",
|
|
3
|
-
"version": "1.1.4-experimental.
|
|
3
|
+
"version": "1.1.4-experimental.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -27,19 +27,18 @@
|
|
|
27
27
|
"tsup": "^7.1.0",
|
|
28
28
|
"typedoc": "^0.24.8",
|
|
29
29
|
"typescript": "^5.1.6",
|
|
30
|
-
"tsconfig": "0.1.4-experimental.
|
|
30
|
+
"tsconfig": "0.1.4-experimental.2"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@layerzerolabs/scan-client": "^0.0.6",
|
|
34
33
|
"ramda": "^0.29.0",
|
|
35
34
|
"swr": "^2.2.4",
|
|
36
35
|
"use-constant": "^1.1.1",
|
|
37
36
|
"use-debounce": "^9.0.4",
|
|
38
|
-
"@orderly.network/net": "1.1.4-experimental.
|
|
39
|
-
"@orderly.network/
|
|
40
|
-
"@orderly.network/utils": "0.1.4-experimental.
|
|
41
|
-
"@orderly.network/types": "0.2.4-experimental.
|
|
42
|
-
"@orderly.network/
|
|
37
|
+
"@orderly.network/net": "1.1.4-experimental.2",
|
|
38
|
+
"@orderly.network/core": "0.2.4-experimental.2",
|
|
39
|
+
"@orderly.network/utils": "0.1.4-experimental.2",
|
|
40
|
+
"@orderly.network/types": "0.2.4-experimental.2",
|
|
41
|
+
"@orderly.network/perp": "2.0.4-experimental.2"
|
|
43
42
|
},
|
|
44
43
|
"publishConfig": {
|
|
45
44
|
"access": "public"
|