@orderly.network/trading-next 3.0.0-beta.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/dist/index.d.mts +678 -0
- package/dist/index.d.ts +678 -0
- package/dist/index.js +7852 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +7825 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +67 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,678 @@
|
|
|
1
|
+
import { SymbolInfoBarFullProps } from '@orderly.network/markets';
|
|
2
|
+
import { AccountState as AccountState$1 } from '@orderly.network/core';
|
|
3
|
+
import { LayoutStrategy, LayoutModel } from '@orderly.network/layout-core';
|
|
4
|
+
import * as React$1 from 'react';
|
|
5
|
+
import React__default, { ReactNode, RefObject, FC, PropsWithChildren } from 'react';
|
|
6
|
+
import * as _orderly_network_types from '@orderly.network/types';
|
|
7
|
+
import { API, NetworkId, AccountStatusEnum } from '@orderly.network/types';
|
|
8
|
+
import * as _orderly_network_ui_share from '@orderly.network/ui-share';
|
|
9
|
+
import { SharePnLConfig } from '@orderly.network/ui-share';
|
|
10
|
+
import { TradingviewWidgetPropsInterface } from '@orderly.network/ui-tradingview';
|
|
11
|
+
import Split, { SplitProps } from '@uiw/react-split';
|
|
12
|
+
import { PositionsProps } from '@orderly.network/ui-positions';
|
|
13
|
+
import * as _orderly_network_hooks from '@orderly.network/hooks';
|
|
14
|
+
import { SliderMarks } from '@orderly.network/ui';
|
|
15
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
16
|
+
|
|
17
|
+
interface Props$1 {
|
|
18
|
+
data: number[][];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface Props {
|
|
22
|
+
data: any[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare const useAccountScript: () => {
|
|
26
|
+
onShowAccountSheet: () => void;
|
|
27
|
+
address: string | undefined;
|
|
28
|
+
state: AccountState$1;
|
|
29
|
+
};
|
|
30
|
+
type AccountState = ReturnType<typeof useAccountScript>;
|
|
31
|
+
|
|
32
|
+
declare const scrollBarWidth = 6;
|
|
33
|
+
declare const topBarHeight = 48;
|
|
34
|
+
declare const bottomBarHeight = 29;
|
|
35
|
+
declare const space = 8;
|
|
36
|
+
declare const orderbookMinHeight = 464;
|
|
37
|
+
declare const orderbookMaxHeight = 728;
|
|
38
|
+
/** Absolute minimum height the TradingView chart may be resized to */
|
|
39
|
+
declare const tradindviewMinHeight = 320;
|
|
40
|
+
declare const dataListInitialHeight = 350;
|
|
41
|
+
|
|
42
|
+
type LayoutPosition = "left" | "right";
|
|
43
|
+
|
|
44
|
+
type layoutInfo = {
|
|
45
|
+
width?: number;
|
|
46
|
+
height?: number;
|
|
47
|
+
fontSize?: number;
|
|
48
|
+
color?: string;
|
|
49
|
+
textAlign?: CanvasTextAlign;
|
|
50
|
+
textBaseline?: CanvasTextBaseline;
|
|
51
|
+
position: Partial<{
|
|
52
|
+
left: number;
|
|
53
|
+
right: number;
|
|
54
|
+
top: number;
|
|
55
|
+
bottom: number;
|
|
56
|
+
}>;
|
|
57
|
+
};
|
|
58
|
+
type PosterLayoutConfig = {
|
|
59
|
+
message?: layoutInfo;
|
|
60
|
+
domain?: layoutInfo;
|
|
61
|
+
position?: layoutInfo;
|
|
62
|
+
unrealizedPnl?: layoutInfo & {
|
|
63
|
+
secondaryColor: string;
|
|
64
|
+
secondaryFontSize: number;
|
|
65
|
+
};
|
|
66
|
+
informations?: layoutInfo & {
|
|
67
|
+
labelColor?: string;
|
|
68
|
+
};
|
|
69
|
+
updateTime?: layoutInfo;
|
|
70
|
+
};
|
|
71
|
+
type ShareOptions = {
|
|
72
|
+
pnl: {
|
|
73
|
+
/**
|
|
74
|
+
* defualt is Manrope
|
|
75
|
+
*/
|
|
76
|
+
fontFamily?: string;
|
|
77
|
+
/**
|
|
78
|
+
* can not empty
|
|
79
|
+
*/
|
|
80
|
+
backgroundImages: string[];
|
|
81
|
+
/**
|
|
82
|
+
* posterLayoutConfig
|
|
83
|
+
*/
|
|
84
|
+
layout?: PosterLayoutConfig;
|
|
85
|
+
/**
|
|
86
|
+
* norma text color, default is "rgba(255, 255, 255, 0.98)"
|
|
87
|
+
*/
|
|
88
|
+
color?: string;
|
|
89
|
+
/**
|
|
90
|
+
* profit text color, default is "rgb(0,181,159)"
|
|
91
|
+
*/
|
|
92
|
+
profitColor?: string;
|
|
93
|
+
/**
|
|
94
|
+
* loss text color, default is "rgb(255,103,194)"
|
|
95
|
+
*/
|
|
96
|
+
lossColor?: string;
|
|
97
|
+
/**
|
|
98
|
+
* brand color, default is "rgb(0,181,159)"
|
|
99
|
+
*/
|
|
100
|
+
brandColor?: string;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
declare enum TradingFeatures {
|
|
104
|
+
Sider = "sider",
|
|
105
|
+
TopNavBar = "topNavBar",
|
|
106
|
+
Footer = "footer",
|
|
107
|
+
Header = "header",
|
|
108
|
+
Kline = "kline",
|
|
109
|
+
OrderBook = "orderBook",
|
|
110
|
+
TradeHistory = "tradeHistory",
|
|
111
|
+
Positions = "positions",
|
|
112
|
+
Orders = "orders",
|
|
113
|
+
AssetAndMarginInfo = "asset_margin_info",
|
|
114
|
+
SlippageSetting = "slippageSetting",
|
|
115
|
+
FeesInfo = "feesInfo"
|
|
116
|
+
}
|
|
117
|
+
type BasicSymbolInfo = {
|
|
118
|
+
base_dp: number;
|
|
119
|
+
quote_dp: number;
|
|
120
|
+
base_tick: number;
|
|
121
|
+
base: string;
|
|
122
|
+
quote: string;
|
|
123
|
+
};
|
|
124
|
+
interface TradingPageState extends TradingPageProps {
|
|
125
|
+
symbolInfo: {
|
|
126
|
+
base_dp: number;
|
|
127
|
+
quote_dp: number;
|
|
128
|
+
base_tick: number;
|
|
129
|
+
base: string;
|
|
130
|
+
quote: string;
|
|
131
|
+
symbol: string;
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
interface TradingViewConfigInterface {
|
|
135
|
+
scriptSRC?: string;
|
|
136
|
+
library_path: string;
|
|
137
|
+
overrides?: TradingviewWidgetPropsInterface["overrides"];
|
|
138
|
+
studiesOverrides?: TradingviewWidgetPropsInterface["studiesOverrides"];
|
|
139
|
+
customCssUrl?: string;
|
|
140
|
+
colorConfig?: ColorConfigInterface;
|
|
141
|
+
locale?: TradingviewWidgetPropsInterface["locale"];
|
|
142
|
+
enabled_features?: string[];
|
|
143
|
+
disabled_features?: string[];
|
|
144
|
+
}
|
|
145
|
+
interface ColorConfigInterface {
|
|
146
|
+
chartBG?: string;
|
|
147
|
+
upColor?: string;
|
|
148
|
+
downColor?: string;
|
|
149
|
+
pnlUpColor?: string;
|
|
150
|
+
pnlDownColor?: string;
|
|
151
|
+
pnlZoreColor?: string;
|
|
152
|
+
textColor?: string;
|
|
153
|
+
qtyTextColor?: string;
|
|
154
|
+
font?: string;
|
|
155
|
+
closeIcon?: string;
|
|
156
|
+
}
|
|
157
|
+
type ReferralProps = {
|
|
158
|
+
saveRefCode?: boolean;
|
|
159
|
+
onClickReferral?: () => void;
|
|
160
|
+
onBoundRefCode?: (success: boolean, error: any) => void;
|
|
161
|
+
};
|
|
162
|
+
type TradingRewardsProps = {
|
|
163
|
+
onClickTradingRewards?: () => void;
|
|
164
|
+
};
|
|
165
|
+
type BaseTradingPageProps = {
|
|
166
|
+
symbol: string;
|
|
167
|
+
tradingViewConfig: TradingViewConfigInterface;
|
|
168
|
+
onSymbolChange?: (symbol: API.Symbol) => void;
|
|
169
|
+
disableFeatures?: TradingFeatures[];
|
|
170
|
+
overrideFeatures?: Record<TradingFeatures, ReactNode>;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Options passed to getInitialLayout for desktop trading layout.
|
|
174
|
+
* Trading only passes non-layout fields (e.g. variant); layout-related state is owned by layout plugins.
|
|
175
|
+
*/
|
|
176
|
+
type DesktopLayoutInitialOptions = {
|
|
177
|
+
/** Viewport/screen size variant; layout plugins may use for breakpoint behaviour */
|
|
178
|
+
variant?: "default" | "max2XL";
|
|
179
|
+
};
|
|
180
|
+
type TradingPageProps = BaseTradingPageProps & {
|
|
181
|
+
sharePnLConfig?: SharePnLConfig;
|
|
182
|
+
referral?: ReferralProps;
|
|
183
|
+
tradingRewards?: TradingRewardsProps;
|
|
184
|
+
bottomSheetLeading?: React.ReactNode | string;
|
|
185
|
+
/** Layout strategy for desktop trading UI; must be provided by the consumer (e.g. split or grid) */
|
|
186
|
+
layoutStrategy?: LayoutStrategy;
|
|
187
|
+
/** Optional factory for initial layout; called with desktop options. If omitted, strategy.defaultLayout(panelIds) is used. */
|
|
188
|
+
getInitialLayout?: (options: DesktopLayoutInitialOptions) => LayoutModel;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
type TradingState = ReturnType<typeof useTradingScript>;
|
|
192
|
+
declare const useTradingScript: () => TradingPageState & {
|
|
193
|
+
tradindviewMaxHeight: number;
|
|
194
|
+
dataListMinHeight: number;
|
|
195
|
+
total: number | null;
|
|
196
|
+
hideAssets: any;
|
|
197
|
+
setHideAssets: (value: boolean) => void;
|
|
198
|
+
onShowPortfolioSheet: () => void;
|
|
199
|
+
navigateToPortfolio: (() => void) | undefined;
|
|
200
|
+
isFirstTimeDeposit: boolean;
|
|
201
|
+
symbolInfoBarHeight: number;
|
|
202
|
+
sortableItems: any;
|
|
203
|
+
setSortableItems: (value: string[]) => void;
|
|
204
|
+
tradingViewFullScreen: any;
|
|
205
|
+
max2XLSplitRef: RefObject<Split>;
|
|
206
|
+
tradingviewAndOrderbookSplitRef: RefObject<Split>;
|
|
207
|
+
onTradingviewAndOrderbookDragging: (preSize: number, nextSize: number) => void;
|
|
208
|
+
onDataListSplitHeightDragging: (preSize: number, nextSize: number) => void;
|
|
209
|
+
extraHeight: any;
|
|
210
|
+
dataListHeight: any;
|
|
211
|
+
restrictedInfo: {
|
|
212
|
+
ip: string;
|
|
213
|
+
invalidRegions: string[];
|
|
214
|
+
restrictedOpen: boolean;
|
|
215
|
+
content: React$1.ReactNode | ((data: {
|
|
216
|
+
ip: string;
|
|
217
|
+
brokerName: string;
|
|
218
|
+
}) => React$1.ReactNode);
|
|
219
|
+
canUnblock: boolean;
|
|
220
|
+
accessRestricted: any;
|
|
221
|
+
setAccessRestricted: (value: boolean | undefined) => void;
|
|
222
|
+
};
|
|
223
|
+
orderEntryViewRef: RefObject<HTMLDivElement>;
|
|
224
|
+
orderEntryHeight: number;
|
|
225
|
+
positions: number[];
|
|
226
|
+
showPositionIcon: boolean;
|
|
227
|
+
updatePositions: (currentIdx: number, targetIdx: number) => void;
|
|
228
|
+
max2XL: boolean;
|
|
229
|
+
min3XL: boolean;
|
|
230
|
+
max4XL: boolean;
|
|
231
|
+
canTrade: boolean;
|
|
232
|
+
openMarketsSheet: boolean;
|
|
233
|
+
onOpenMarketsSheetChange: React$1.Dispatch<React$1.SetStateAction<boolean>>;
|
|
234
|
+
horizontalDraggable: boolean;
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Minimal desktop layout: builds panel registry and renders LayoutHost.
|
|
239
|
+
* Chrome (markets, DnD, Flex) is provided by layout plugins (e.g. layout-split).
|
|
240
|
+
*/
|
|
241
|
+
|
|
242
|
+
type DesktopLayoutProps = TradingState & {
|
|
243
|
+
className?: string;
|
|
244
|
+
/** Injected by layout plugin interceptor when not provided by host */
|
|
245
|
+
layoutStrategy?: LayoutStrategy;
|
|
246
|
+
getInitialLayout?: (options: DesktopLayoutInitialOptions) => LayoutModel | undefined;
|
|
247
|
+
/** Optional storage key for layout persistence; when provided (e.g. by grid plugin) overrides default. */
|
|
248
|
+
storageKey?: string;
|
|
249
|
+
/**
|
|
250
|
+
* When true, disables LayoutHost localStorage persistence.
|
|
251
|
+
* Useful in development when layout should reset on every refresh.
|
|
252
|
+
*/
|
|
253
|
+
disableLayoutPersistence?: boolean;
|
|
254
|
+
/** Optional layout props when plugin provides rule-based layout; defaults used for SwitchLayout. */
|
|
255
|
+
layout?: LayoutPosition;
|
|
256
|
+
marketLayout?: "left" | "top" | "bottom" | "hide";
|
|
257
|
+
onLayout?: (v: LayoutPosition) => void;
|
|
258
|
+
onMarketLayout?: (v: "left" | "top" | "bottom" | "hide") => void;
|
|
259
|
+
resizeable?: boolean;
|
|
260
|
+
panelSize?: "small" | "middle" | "large";
|
|
261
|
+
onPanelSizeChange?: (v: "small" | "middle" | "large") => void;
|
|
262
|
+
animating?: boolean;
|
|
263
|
+
setAnimating?: (v: boolean) => void;
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Module augmentation: maps interceptor target paths to their component props types.
|
|
268
|
+
* Import from @orderly.network/trading to enable typed props in
|
|
269
|
+
* createInterceptor('Trading.DesktopLayout', ...), createInterceptor('Account.MobileAccountMenu', ...), etc.
|
|
270
|
+
*/
|
|
271
|
+
|
|
272
|
+
declare module "@orderly.network/plugin-core" {
|
|
273
|
+
interface InterceptorTargetPropsMap {
|
|
274
|
+
"Account.MobileAccountMenu": AccountState;
|
|
275
|
+
"OrderBook.Desktop.Asks": Props$1;
|
|
276
|
+
"OrderBook.Desktop.Bids": Props;
|
|
277
|
+
"Trading.Layout.Desktop": DesktopLayoutProps;
|
|
278
|
+
"Trading.SymbolInfoBar.Desktop": SymbolInfoBarFullProps;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
declare enum DataListTabType {
|
|
283
|
+
positions = "Positions",
|
|
284
|
+
pending = "Pending",
|
|
285
|
+
tp_sl = "TP/SL",
|
|
286
|
+
filled = "Filled",
|
|
287
|
+
positionHistory = "Position history",
|
|
288
|
+
orderHistory = "Order history",
|
|
289
|
+
liquidation = "Liquidation",
|
|
290
|
+
assets = "Assets"
|
|
291
|
+
}
|
|
292
|
+
declare const useDataListScript: (inputs: {
|
|
293
|
+
current?: DataListTabType;
|
|
294
|
+
} & PositionsProps) => {
|
|
295
|
+
positionCount: number;
|
|
296
|
+
pendingOrderCount: number;
|
|
297
|
+
tpSlOrderCount: number;
|
|
298
|
+
onSymbolChange: ((symbol: _orderly_network_types.API.Symbol) => void) | undefined;
|
|
299
|
+
unPnlPriceBasis: any;
|
|
300
|
+
setUnPnlPriceBasic: (value: string) => void;
|
|
301
|
+
pnlNotionalDecimalPrecision: any;
|
|
302
|
+
setPnlNotionalDecimalPrecision: (value: number) => void;
|
|
303
|
+
showAllSymbol: any;
|
|
304
|
+
setShowAllSymbol: (value: boolean) => void;
|
|
305
|
+
hideAssets: any;
|
|
306
|
+
setHideAssets: (value: boolean) => void;
|
|
307
|
+
current: DataListTabType | undefined;
|
|
308
|
+
sharePnLConfig: _orderly_network_ui_share.SharePnLConfig | undefined;
|
|
309
|
+
symbol: string | undefined;
|
|
310
|
+
calcMode: any;
|
|
311
|
+
includedPendingOrder: boolean | undefined;
|
|
312
|
+
};
|
|
313
|
+
type DataListState = ReturnType<typeof useDataListScript>;
|
|
314
|
+
|
|
315
|
+
declare const DataList: React__default.FC<DataListState>;
|
|
316
|
+
|
|
317
|
+
declare const DataListWidget: React__default.FC<{
|
|
318
|
+
current?: DataListTabType;
|
|
319
|
+
} & PositionsProps>;
|
|
320
|
+
|
|
321
|
+
declare const useLastTradesScript: (symbol: string) => {
|
|
322
|
+
base: string;
|
|
323
|
+
quote: string;
|
|
324
|
+
data: _orderly_network_types.API.Trade[];
|
|
325
|
+
isLoading: boolean;
|
|
326
|
+
baseDp: number;
|
|
327
|
+
quoteDp: number;
|
|
328
|
+
};
|
|
329
|
+
type LastTradesState = ReturnType<typeof useLastTradesScript>;
|
|
330
|
+
|
|
331
|
+
declare const LastTrades: FC<LastTradesState & {
|
|
332
|
+
classNames?: {
|
|
333
|
+
root?: string;
|
|
334
|
+
list?: string;
|
|
335
|
+
listHeader?: string;
|
|
336
|
+
listItem?: {
|
|
337
|
+
left?: string;
|
|
338
|
+
mid?: string;
|
|
339
|
+
right?: string;
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
style?: React__default.CSSProperties;
|
|
343
|
+
}>;
|
|
344
|
+
|
|
345
|
+
declare const LastTradesWidget: React__default.FC<{
|
|
346
|
+
symbol: string;
|
|
347
|
+
classNames?: {
|
|
348
|
+
root?: string;
|
|
349
|
+
list?: string;
|
|
350
|
+
listHeader?: string;
|
|
351
|
+
listItem?: {
|
|
352
|
+
left?: string;
|
|
353
|
+
mid?: string;
|
|
354
|
+
right?: string;
|
|
355
|
+
};
|
|
356
|
+
};
|
|
357
|
+
style?: React__default.CSSProperties;
|
|
358
|
+
}>;
|
|
359
|
+
|
|
360
|
+
declare const useAssetViewScript: () => {
|
|
361
|
+
onDeposit: () => Promise<unknown>;
|
|
362
|
+
onWithdraw: () => Promise<unknown>;
|
|
363
|
+
onTransfer: () => Promise<unknown>;
|
|
364
|
+
onSettle: () => Promise<any>;
|
|
365
|
+
visible: any;
|
|
366
|
+
toggleVisible: () => void;
|
|
367
|
+
networkId: NetworkId;
|
|
368
|
+
totalValue: number | undefined;
|
|
369
|
+
status: AccountStatusEnum;
|
|
370
|
+
freeCollateral: number | undefined;
|
|
371
|
+
marginRatioVal: number | undefined;
|
|
372
|
+
renderMMR: number | undefined;
|
|
373
|
+
maintenanceMargin: number | undefined;
|
|
374
|
+
currentLeverage: number | undefined;
|
|
375
|
+
isConnected: boolean;
|
|
376
|
+
isMainAccount: boolean;
|
|
377
|
+
hasSubAccount: boolean;
|
|
378
|
+
currentLtv: number;
|
|
379
|
+
};
|
|
380
|
+
type AssetViewState = ReturnType<typeof useAssetViewScript>;
|
|
381
|
+
|
|
382
|
+
declare const AssetView: FC<AssetViewState & {
|
|
383
|
+
isFirstTimeDeposit?: boolean;
|
|
384
|
+
}>;
|
|
385
|
+
|
|
386
|
+
type AssetViewWidgetProps = {
|
|
387
|
+
isFirstTimeDeposit?: boolean;
|
|
388
|
+
};
|
|
389
|
+
declare const AssetViewWidget: React__default.FC<AssetViewWidgetProps>;
|
|
390
|
+
|
|
391
|
+
interface BuySellRatio {
|
|
392
|
+
buyPercentage: number;
|
|
393
|
+
sellPercentage: number;
|
|
394
|
+
buyAmount: number;
|
|
395
|
+
sellAmount: number;
|
|
396
|
+
}
|
|
397
|
+
declare const useOrderBookScript: (props: {
|
|
398
|
+
symbol: string;
|
|
399
|
+
height?: number;
|
|
400
|
+
}) => {
|
|
401
|
+
level: number;
|
|
402
|
+
asks: _orderly_network_hooks.OrderBookItem[] | undefined;
|
|
403
|
+
bids: _orderly_network_hooks.OrderBookItem[] | undefined;
|
|
404
|
+
markPrice: number | undefined;
|
|
405
|
+
lastPrice: number[] | undefined;
|
|
406
|
+
depths: string[];
|
|
407
|
+
selDepth: string | undefined;
|
|
408
|
+
base: string;
|
|
409
|
+
quote: string;
|
|
410
|
+
isLoading: boolean | undefined;
|
|
411
|
+
onItemClick: ((item: _orderly_network_hooks.OrderBookItem) => void) | undefined;
|
|
412
|
+
cellHeight: number;
|
|
413
|
+
onDepthChange: ((val: number) => void) | undefined;
|
|
414
|
+
pendingOrders: number[];
|
|
415
|
+
symbolInfo: BasicSymbolInfo;
|
|
416
|
+
isMobile: boolean;
|
|
417
|
+
showBuySellRatio: any;
|
|
418
|
+
setShowBuySellRatio: (value: boolean) => void;
|
|
419
|
+
buySellRatio: BuySellRatio | null;
|
|
420
|
+
};
|
|
421
|
+
type OrderBookState = ReturnType<typeof useOrderBookScript>;
|
|
422
|
+
|
|
423
|
+
declare const OrderBook: React__default.FC<OrderBookState & {
|
|
424
|
+
className?: string;
|
|
425
|
+
}>;
|
|
426
|
+
|
|
427
|
+
interface OrderBookWidgetProps {
|
|
428
|
+
className?: string;
|
|
429
|
+
symbol: string;
|
|
430
|
+
height?: number;
|
|
431
|
+
}
|
|
432
|
+
declare const OrderBookWidget: React__default.FC<OrderBookWidgetProps>;
|
|
433
|
+
|
|
434
|
+
interface BuySellRatioBarProps {
|
|
435
|
+
ratio: BuySellRatio | null;
|
|
436
|
+
className?: string;
|
|
437
|
+
}
|
|
438
|
+
declare const BuySellRatioBar: FC<BuySellRatioBarProps>;
|
|
439
|
+
|
|
440
|
+
type QtyMode = "quantity" | "amount";
|
|
441
|
+
type TotalMode = "quantity" | "amount";
|
|
442
|
+
|
|
443
|
+
interface OrderBookContextValue {
|
|
444
|
+
cellHeight: number;
|
|
445
|
+
mode: QtyMode;
|
|
446
|
+
depth?: string;
|
|
447
|
+
onModeChange?: (mode: QtyMode) => void;
|
|
448
|
+
onItemClick?: (item: number[]) => void;
|
|
449
|
+
showTotal: boolean;
|
|
450
|
+
totalMode: TotalMode;
|
|
451
|
+
pendingOrders: ReadonlyArray<number> | number[];
|
|
452
|
+
onTotalModeChange?: (mode: TotalMode) => void;
|
|
453
|
+
symbolInfo: BasicSymbolInfo;
|
|
454
|
+
showBuySellRatio: boolean;
|
|
455
|
+
onShowBuySellRatioChange?: (show: boolean) => void;
|
|
456
|
+
}
|
|
457
|
+
declare const useOrderBookContext: () => OrderBookContextValue;
|
|
458
|
+
interface OrderBookProviderProps {
|
|
459
|
+
cellHeight: number;
|
|
460
|
+
depth?: string;
|
|
461
|
+
showTotal: boolean;
|
|
462
|
+
pendingOrders: ReadonlyArray<number> | number[];
|
|
463
|
+
onItemClick?: (item: number[]) => void;
|
|
464
|
+
symbolInfo: BasicSymbolInfo;
|
|
465
|
+
showBuySellRatio?: boolean;
|
|
466
|
+
onShowBuySellRatioChange?: (show: boolean) => void;
|
|
467
|
+
}
|
|
468
|
+
declare const OrderBookProvider: FC<PropsWithChildren<OrderBookProviderProps>>;
|
|
469
|
+
|
|
470
|
+
declare const useRiskRateScript: () => {
|
|
471
|
+
riskRate: string | null;
|
|
472
|
+
riskRateColor: {
|
|
473
|
+
isHigh: boolean;
|
|
474
|
+
isMedium: boolean;
|
|
475
|
+
isLow: boolean;
|
|
476
|
+
isDefault: boolean;
|
|
477
|
+
};
|
|
478
|
+
isConnected: boolean;
|
|
479
|
+
currentLeverage: number | null;
|
|
480
|
+
maxLeverage: number | null;
|
|
481
|
+
};
|
|
482
|
+
type RiskRateState = ReturnType<typeof useRiskRateScript>;
|
|
483
|
+
|
|
484
|
+
declare const RiskRate: FC<RiskRateState>;
|
|
485
|
+
|
|
486
|
+
declare const RiskRateWidget: React__default.FC;
|
|
487
|
+
|
|
488
|
+
declare const useOrderBookAndTradesScript: (symbol: string) => {
|
|
489
|
+
symbol: string;
|
|
490
|
+
containerSize: {
|
|
491
|
+
width: number;
|
|
492
|
+
height: number;
|
|
493
|
+
} | undefined;
|
|
494
|
+
containerRef: React$1.RefObject<HTMLDivElement>;
|
|
495
|
+
tab: "orderBook" | "lastTrades";
|
|
496
|
+
setTab: React$1.Dispatch<React$1.SetStateAction<"orderBook" | "lastTrades">>;
|
|
497
|
+
};
|
|
498
|
+
type OrderBookAndTradesState = ReturnType<typeof useOrderBookAndTradesScript>;
|
|
499
|
+
|
|
500
|
+
declare const OrderBookAndTrades: React__default.FC<OrderBookAndTradesState>;
|
|
501
|
+
|
|
502
|
+
declare const OrderBookAndTradesWidget: React__default.FC<{
|
|
503
|
+
symbol: string;
|
|
504
|
+
}>;
|
|
505
|
+
|
|
506
|
+
declare const SplitLayout: React__default.ForwardRefExoticComponent<SplitProps & {
|
|
507
|
+
children?: React__default.ReactNode | undefined;
|
|
508
|
+
} & {
|
|
509
|
+
onSizeChange?: (size: string) => void;
|
|
510
|
+
} & React__default.RefAttributes<Split>>;
|
|
511
|
+
|
|
512
|
+
declare const useBottomNavBarScript: () => {
|
|
513
|
+
wrongNetwork: boolean;
|
|
514
|
+
disabledConnect: boolean;
|
|
515
|
+
status: _orderly_network_types.AccountStatusEnum;
|
|
516
|
+
onDisconnect: () => Promise<void>;
|
|
517
|
+
};
|
|
518
|
+
type BottomNavBarState = ReturnType<typeof useBottomNavBarScript>;
|
|
519
|
+
|
|
520
|
+
declare const BottomNavBar: FC<BottomNavBarState>;
|
|
521
|
+
|
|
522
|
+
declare const BottomNavBarWidget: React__default.FC;
|
|
523
|
+
|
|
524
|
+
declare const usePortfolioSheetScript: () => {
|
|
525
|
+
onSettlePnL: () => Promise<any>;
|
|
526
|
+
onDeposit: () => void;
|
|
527
|
+
onWithdraw: () => void;
|
|
528
|
+
showSliderTip: boolean;
|
|
529
|
+
setShowSliderTip: React$1.Dispatch<React$1.SetStateAction<boolean>>;
|
|
530
|
+
isMainAccount: boolean;
|
|
531
|
+
onTransfer: () => void;
|
|
532
|
+
hasSubAccount: boolean;
|
|
533
|
+
aggregated: Omit<_orderly_network_types.API.PositionsTPSLExt, "rows">;
|
|
534
|
+
totalUnrealizedROI: number;
|
|
535
|
+
positionsInfo: Record<"notional" | "unsettledPnL" | "margin_ratio" | "initial_margin_ratio" | "maintenance_margin_ratio" | "open_margin_ratio" | "current_margin_ratio_with_orders" | "initial_margin_ratio_with_orders" | "maintenance_margin_ratio_with_orders" | "total_collateral_value" | "free_collateral" | "total_pnl_24_h" | "unrealPnL" | "total_unreal_pnl" | "total_unreal_pnl_index" | "total_unsettled_pnl" | "unrealPnlROI" | "unrealPnlROI_index" | "total_unsettled_cross_pnl" | "total_unsettled_isolated_pnl", <Key extends "unsettledPnL" | "margin_ratio" | "initial_margin_ratio" | "maintenance_margin_ratio" | "open_margin_ratio" | "current_margin_ratio_with_orders" | "initial_margin_ratio_with_orders" | "maintenance_margin_ratio_with_orders" | "total_collateral_value" | "free_collateral" | "total_pnl_24_h" | "unrealPnL" | "total_unreal_pnl" | "total_unreal_pnl_index" | "total_unsettled_pnl" | "notional" | "unrealPnlROI" | "unrealPnlROI_index" | "total_unsettled_cross_pnl" | "total_unsettled_isolated_pnl">(defaultValue?: Omit<_orderly_network_types.API.PositionInfo, "rows">[Key] | undefined) => Omit<_orderly_network_types.API.PositionInfo, "rows">[Key]> & {
|
|
536
|
+
isNil: boolean;
|
|
537
|
+
};
|
|
538
|
+
marginRatio: number;
|
|
539
|
+
marginRatioVal: number;
|
|
540
|
+
mmr: number | null;
|
|
541
|
+
currentLeverage: number | null;
|
|
542
|
+
step: number;
|
|
543
|
+
marks: SliderMarks;
|
|
544
|
+
onLeverageChange: (leverage: number) => void;
|
|
545
|
+
onLeverageIncrease: React$1.MouseEventHandler<SVGSVGElement>;
|
|
546
|
+
onLeverageReduce: React$1.MouseEventHandler<SVGSVGElement>;
|
|
547
|
+
onInputChange: React$1.ChangeEventHandler<HTMLInputElement>;
|
|
548
|
+
isReduceDisabled: boolean;
|
|
549
|
+
isIncreaseDisabled: boolean;
|
|
550
|
+
onValueCommit: (value: number | number[]) => void;
|
|
551
|
+
value: number;
|
|
552
|
+
maxLeverage: number;
|
|
553
|
+
onSaveLeverage: (leverage: number) => Promise<void>;
|
|
554
|
+
hideAssets: any;
|
|
555
|
+
toggleHideAssets: () => void;
|
|
556
|
+
totalCollateral: number;
|
|
557
|
+
freeCollateral: number;
|
|
558
|
+
totalValue: number | null;
|
|
559
|
+
availableBalance: number;
|
|
560
|
+
};
|
|
561
|
+
type PortfolioSheetState = ReturnType<typeof usePortfolioSheetScript>;
|
|
562
|
+
|
|
563
|
+
declare const PortfolioSheet: FC<PortfolioSheetState>;
|
|
564
|
+
|
|
565
|
+
declare const PortfolioSheetWidget: () => react_jsx_runtime.JSX.Element;
|
|
566
|
+
|
|
567
|
+
declare const useFundingRateScript: (symbol: string) => {
|
|
568
|
+
data: {
|
|
569
|
+
est_funding_rate: string | null | undefined;
|
|
570
|
+
countDown: string;
|
|
571
|
+
symbol?: string | undefined;
|
|
572
|
+
est_funding_rate_timestamp?: number | undefined;
|
|
573
|
+
last_funding_rate?: number | undefined;
|
|
574
|
+
last_funding_rate_timestamp?: number | undefined;
|
|
575
|
+
next_funding_time?: number | undefined;
|
|
576
|
+
sum_unitary_funding?: number | undefined;
|
|
577
|
+
};
|
|
578
|
+
onClick: React$1.MouseEventHandler<HTMLElement>;
|
|
579
|
+
};
|
|
580
|
+
type FundingRateState = ReturnType<typeof useFundingRateScript>;
|
|
581
|
+
|
|
582
|
+
declare const FundingRate: FC<FundingRateState>;
|
|
583
|
+
|
|
584
|
+
declare const FundingRateWidget: React__default.FC<{
|
|
585
|
+
symbol: string;
|
|
586
|
+
}>;
|
|
587
|
+
|
|
588
|
+
interface FundingRateOptions {
|
|
589
|
+
symbol: string;
|
|
590
|
+
}
|
|
591
|
+
declare const useFundingRateModalScript: (options: FundingRateOptions) => {
|
|
592
|
+
fundingPeriod: string;
|
|
593
|
+
capFunding: string;
|
|
594
|
+
floorFunding: string;
|
|
595
|
+
lastFundingRate: string | undefined;
|
|
596
|
+
estFundingFee: string;
|
|
597
|
+
lastFundingRateAnnualized: string | undefined;
|
|
598
|
+
estFundingRateByTimeframe: {
|
|
599
|
+
timeframe: "1H" | "4H" | "1D" | "7D" | "30D" | "1Y";
|
|
600
|
+
value: string;
|
|
601
|
+
}[];
|
|
602
|
+
};
|
|
603
|
+
type FundingRateModalState = ReturnType<typeof useFundingRateModalScript>;
|
|
604
|
+
|
|
605
|
+
declare const FundingRateModal: React__default.FC<FundingRateModalState>;
|
|
606
|
+
|
|
607
|
+
declare const FundingRateModalWidget: React__default.FC<{
|
|
608
|
+
symbol: string;
|
|
609
|
+
}>;
|
|
610
|
+
declare const FundingRateDialogId = "FundingRateDialogId";
|
|
611
|
+
declare const FundingRateSheetId = "FundingRateSheetId";
|
|
612
|
+
|
|
613
|
+
/** Injectable so layout plugins can intercept and replace desktop layout via renderContent */
|
|
614
|
+
declare const Trading: FC<TradingState>;
|
|
615
|
+
|
|
616
|
+
declare const TradingWidget: React__default.FC;
|
|
617
|
+
|
|
618
|
+
/** Injectable so layout plugins can intercept and inject layoutStrategy/getInitialLayout when host does not pass them */
|
|
619
|
+
declare const TradingPage: React__default.ComponentType<TradingPageProps>;
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Drag overlay content for order-entry sortable panels.
|
|
623
|
+
* Used by layout-split chrome inside DragOverlay; Trading owns widget definitions.
|
|
624
|
+
*/
|
|
625
|
+
|
|
626
|
+
/** Props required to render the overlay for one order-entry item */
|
|
627
|
+
interface OrderEntryDragOverlayContentProps {
|
|
628
|
+
/** Id of the panel being dragged (e.g. "margin" | "assets" | "orderEntry") */
|
|
629
|
+
activeId: string | null;
|
|
630
|
+
showPositionIcon: boolean;
|
|
631
|
+
symbol: string;
|
|
632
|
+
disableFeatures?: unknown;
|
|
633
|
+
navigateToPortfolio?: () => void;
|
|
634
|
+
isFirstTimeDeposit?: boolean;
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* Renders the drag overlay content for the active order-entry sortable item.
|
|
638
|
+
* Used by split layout chrome; does not render when activeId is null.
|
|
639
|
+
*/
|
|
640
|
+
declare function OrderEntryDragOverlayContent(props: OrderEntryDragOverlayContentProps): React__default.ReactElement | null;
|
|
641
|
+
|
|
642
|
+
declare const TradingPageContext: React$1.Context<TradingPageState>;
|
|
643
|
+
declare const useTradingPageContext: () => TradingPageState;
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* Provider does not import a default layout strategy; consumer or desktop UI
|
|
647
|
+
* should pass layoutStrategy via props or use a fallback when rendering LayoutHost.
|
|
648
|
+
*/
|
|
649
|
+
declare const TradingPageProvider: FC<PropsWithChildren<TradingPageProps>>;
|
|
650
|
+
|
|
651
|
+
declare const useTradingLocalStorage: (props?: {
|
|
652
|
+
pnlNotionalDecimalPrecision?: number;
|
|
653
|
+
}) => {
|
|
654
|
+
unPnlPriceBasis: any;
|
|
655
|
+
setUnPnlPriceBasic: (value: string) => void;
|
|
656
|
+
pnlNotionalDecimalPrecision: any;
|
|
657
|
+
setPnlNotionalDecimalPrecision: (value: number) => void;
|
|
658
|
+
showAllSymbol: any;
|
|
659
|
+
setShowAllSymbol: (value: boolean) => void;
|
|
660
|
+
hideAssets: any;
|
|
661
|
+
setHideAssets: (value: boolean) => void;
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
declare const usePositionsCount: (symbol?: string) => {
|
|
665
|
+
positionCount: number;
|
|
666
|
+
};
|
|
667
|
+
|
|
668
|
+
declare const usePendingOrderCount: (symbol?: string) => {
|
|
669
|
+
pendingOrderCount: number;
|
|
670
|
+
tpSlOrderCount: number;
|
|
671
|
+
};
|
|
672
|
+
|
|
673
|
+
declare const useShowRwaCountdown: (symbol: string) => {
|
|
674
|
+
showCountdown: boolean | undefined;
|
|
675
|
+
closeCountdown: () => void;
|
|
676
|
+
};
|
|
677
|
+
|
|
678
|
+
export { type AccountState, AssetView, AssetViewWidget, BottomNavBar, BottomNavBarWidget, type BuySellRatio, BuySellRatioBar, DataList, DataListWidget, type DesktopLayoutInitialOptions, type DesktopLayoutProps, FundingRate, FundingRateDialogId, FundingRateModal, type FundingRateModalState, FundingRateModalWidget, FundingRateSheetId, FundingRateWidget, LastTrades, LastTradesWidget, OrderBook, OrderBookAndTrades, OrderBookAndTradesWidget, type OrderBookContextValue, type Props$1 as OrderBookDesktopAsksProps, OrderBookProvider, OrderBookWidget, OrderEntryDragOverlayContent, type OrderEntryDragOverlayContentProps, PortfolioSheet, PortfolioSheetWidget, type ReferralProps, RiskRate, RiskRateWidget, type ShareOptions, SplitLayout, Trading, TradingPage, TradingPageContext, type TradingPageProps, TradingPageProvider, type TradingRewardsProps, TradingWidget, bottomBarHeight, dataListInitialHeight, orderbookMaxHeight, orderbookMinHeight, scrollBarWidth, space, topBarHeight, tradindviewMinHeight, useBottomNavBarScript, useFundingRateModalScript, useFundingRateScript, useOrderBookAndTradesScript, useOrderBookContext, useOrderBookScript, usePendingOrderCount, usePortfolioSheetScript, usePositionsCount, useShowRwaCountdown, useTradingLocalStorage, useTradingPageContext, useTradingScript };
|