@orderly.network/ui-tpsl 2.12.0-alpha.0 → 2.12.1-alpha.0
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.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +5 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React, { ReactNode, SVGProps } from 'react';
|
|
3
3
|
import * as _orderly_network_types from '@orderly.network/types';
|
|
4
|
-
import { API, AlgoOrderRootType, PositionType, OrderSide, OrderlyOrder, AlgoOrder } from '@orderly.network/types';
|
|
4
|
+
import { API, AlgoOrderRootType, PositionType, OrderSide, OrderlyOrder, AlgoOrder, MarginMode } from '@orderly.network/types';
|
|
5
5
|
import { ButtonProps } from '@orderly.network/ui';
|
|
6
6
|
import * as _orderly_network_hooks from '@orderly.network/hooks';
|
|
7
7
|
import { ComputedAlgoOrder, OrderValidationResult } from '@orderly.network/hooks';
|
|
@@ -284,6 +284,7 @@ declare const TPSLSimpleDialogWidget: React.FC<{
|
|
|
284
284
|
symbol: string;
|
|
285
285
|
close?: () => void;
|
|
286
286
|
onComplete?: () => void;
|
|
287
|
+
marginMode?: MarginMode;
|
|
287
288
|
showAdvancedTPSLDialog?: () => void;
|
|
288
289
|
}>;
|
|
289
290
|
declare const TPSLSimpleSheetId = "TPSLSimpleSheetId";
|
|
@@ -293,6 +294,7 @@ type TPSLBuilderOptions = {
|
|
|
293
294
|
type: "tp" | "sl";
|
|
294
295
|
triggerPrice?: number;
|
|
295
296
|
symbol: string;
|
|
297
|
+
marginMode?: MarginMode;
|
|
296
298
|
};
|
|
297
299
|
declare const useTPSLSimpleDialog: (options: TPSLBuilderOptions) => {
|
|
298
300
|
readonly symbolInfo: (<Key extends keyof API.SymbolExt>(key: Key, defaultValue?: API.SymbolExt[Key] | undefined) => API.SymbolExt[Key]) & (() => API.SymbolExt);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React, { ReactNode, SVGProps } from 'react';
|
|
3
3
|
import * as _orderly_network_types from '@orderly.network/types';
|
|
4
|
-
import { API, AlgoOrderRootType, PositionType, OrderSide, OrderlyOrder, AlgoOrder } from '@orderly.network/types';
|
|
4
|
+
import { API, AlgoOrderRootType, PositionType, OrderSide, OrderlyOrder, AlgoOrder, MarginMode } from '@orderly.network/types';
|
|
5
5
|
import { ButtonProps } from '@orderly.network/ui';
|
|
6
6
|
import * as _orderly_network_hooks from '@orderly.network/hooks';
|
|
7
7
|
import { ComputedAlgoOrder, OrderValidationResult } from '@orderly.network/hooks';
|
|
@@ -284,6 +284,7 @@ declare const TPSLSimpleDialogWidget: React.FC<{
|
|
|
284
284
|
symbol: string;
|
|
285
285
|
close?: () => void;
|
|
286
286
|
onComplete?: () => void;
|
|
287
|
+
marginMode?: MarginMode;
|
|
287
288
|
showAdvancedTPSLDialog?: () => void;
|
|
288
289
|
}>;
|
|
289
290
|
declare const TPSLSimpleSheetId = "TPSLSimpleSheetId";
|
|
@@ -293,6 +294,7 @@ type TPSLBuilderOptions = {
|
|
|
293
294
|
type: "tp" | "sl";
|
|
294
295
|
triggerPrice?: number;
|
|
295
296
|
symbol: string;
|
|
297
|
+
marginMode?: MarginMode;
|
|
296
298
|
};
|
|
297
299
|
declare const useTPSLSimpleDialog: (options: TPSLBuilderOptions) => {
|
|
298
300
|
readonly symbolInfo: (<Key extends keyof API.SymbolExt>(key: Key, defaultValue?: API.SymbolExt[Key] | undefined) => API.SymbolExt[Key]) & (() => API.SymbolExt);
|
package/dist/index.js
CHANGED
|
@@ -1358,9 +1358,10 @@ var useTPSLBuilder = (options) => {
|
|
|
1358
1358
|
const [needConfirm] = hooks.useLocalStorage("orderly_order_confirm", true);
|
|
1359
1359
|
const { marginMode: symbolMarginMode } = hooks.useMarginModeBySymbol(symbol);
|
|
1360
1360
|
const [{ rows: positions }] = hooks.usePositionStream();
|
|
1361
|
-
const mainAccountPosition = positions.find(
|
|
1362
|
-
|
|
1363
|
-
|
|
1361
|
+
const mainAccountPosition = positions.find((item) => {
|
|
1362
|
+
const marginMode = options.position?.margin_mode ?? symbolMarginMode;
|
|
1363
|
+
return item.symbol === symbol && item.margin_mode === marginMode;
|
|
1364
|
+
});
|
|
1364
1365
|
const isSubAccount = options.position?.account_id && options.position?.account_id !== state.mainAccountId;
|
|
1365
1366
|
const position = isSubAccount ? options.position : mainAccountPosition;
|
|
1366
1367
|
const estLiqPrice = hooks.useEstLiqPriceBySymbol(
|
|
@@ -1410,7 +1411,6 @@ var useTPSLBuilder = (options) => {
|
|
|
1410
1411
|
});
|
|
1411
1412
|
const isSlPriceWarning = slPriceError?.sl_trigger_price?.type === hooks.ERROR_MSG_CODES.SL_PRICE_WARNING;
|
|
1412
1413
|
const setQuantity = (value) => {
|
|
1413
|
-
console.log("------>>>>>setQuantity", value);
|
|
1414
1414
|
setValue("quantity", value);
|
|
1415
1415
|
};
|
|
1416
1416
|
const setOrderPrice = (name, value) => {
|
|
@@ -2931,9 +2931,8 @@ ui.registerSimpleSheet(TPSLDetailSheetId, TPSLDetailWidget, {
|
|
|
2931
2931
|
}
|
|
2932
2932
|
});
|
|
2933
2933
|
var useTPSLSimpleDialog = (options) => {
|
|
2934
|
-
const { type, triggerPrice, symbol } = options;
|
|
2934
|
+
const { type, triggerPrice, symbol, marginMode } = options;
|
|
2935
2935
|
const symbolInfo = hooks.useSymbolsInfo();
|
|
2936
|
-
const { marginMode } = hooks.useMarginModeBySymbol(symbol ?? "");
|
|
2937
2936
|
const [{ rows: positions }, positionsInfo] = hooks.usePositionStream(symbol);
|
|
2938
2937
|
const position = positions?.find((item) => item.margin_mode === marginMode);
|
|
2939
2938
|
react.useRef(types.AlgoOrderRootType.TP_SL);
|
|
@@ -3245,7 +3244,6 @@ var TPSLSimpleDialogUI = (props) => {
|
|
|
3245
3244
|
var TPSLSimpleDialogWidget = (props) => {
|
|
3246
3245
|
const { close, onComplete, showAdvancedTPSLDialog } = props;
|
|
3247
3246
|
const state = useTPSLSimpleDialog(props);
|
|
3248
|
-
console.log("------>>>>>TPSLSimpleDialogWidget", state);
|
|
3249
3247
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3250
3248
|
TPSLSimpleDialogUI,
|
|
3251
3249
|
{
|