Skip to main content
Orderly SDKs / Modules / @orderly.network/hooks

Module: @orderly.network/hooks

Table of contents

Namespaces

Enumerations

Interfaces

Type Aliases

Variables

Function Functions

Other Functions

Type Aliases

Chain

Ƭ Chain: Chain & { nativeToken?: TokenInfo }

Defined in

packages/hooks/src/orderly/useChains.ts:15

Chains

Ƭ Chains<T, K>: T extends NetworkId ? K extends keyof Chain ? Chain[K][] : Chain[] : K extends keyof Chain ? { mainnet: Chain[K][] ; testnet: Chain[K][] } : { mainnet: Chain[] ; testnet: Chain[] }

Type parameters

Defined in

packages/hooks/src/orderly/useChains.ts:19

CollateralOutputs

Ƭ CollateralOutputs: Object

Type declaration

Defined in

packages/hooks/src/orderly/useCollateral.ts:16

ComputedAlgoOrder

Ƭ ComputedAlgoOrder: Partial<AlgoOrderEntity<TP_SL> & { sl_offset: number ; sl_offset_percentage: number ; sl_pnl: number ; tp_offset: number ; tp_offset_percentage: number ; tp_pnl: number }>

Defined in

packages/hooks/src/orderly/useTakeProfitAndStopLoss/useTPSL.ts:19

DrawOptions

Ƭ DrawOptions: Object

Type declaration

Defined in

packages/hooks/src/services/painter/basePaint.ts:85

OrderBookItem

Ƭ OrderBookItem: number[]

Defined in

packages/hooks/src/orderly/useOrderbookStream.ts:12

OrderParams

Ƭ OrderParams: Required<Pick<OrderEntity, "side" | "order_type" | "symbol">> & Partial<Omit<OrderEntity, "side" | "symbol" | "order_type">>

Defined in

packages/hooks/src/orderly/useOrderEntry.ts:74

OrderbookData

Ƭ OrderbookData: Object

Type declaration

Defined in

packages/hooks/src/orderly/useOrderbookStream.ts:14

OrderbookOptions

Ƭ OrderbookOptions: Object Configuration for the Order Book

Type declaration

Defined in

packages/hooks/src/orderly/useOrderbookStream.ts:222

PosterLayoutConfig

Ƭ PosterLayoutConfig: Object

Type declaration

Defined in

packages/hooks/src/services/painter/basePaint.ts:69

SWRConfiguration

Ƭ SWRConfiguration<Data, Error, Fn>: Partial<PublicConfiguration<Data, Error, Fn>>

Type parameters

Defined in

node_modules/.pnpm/swr@2.2.4_react@18.2.0/node_modules/swr/_internal/dist/index.d.ts:257

UseChainsOptions

Ƭ UseChainsOptions: { filter?: (item: Chain) => boolean ; pick?: "dexs" | "network_infos" | "token_infos" } & SWRConfiguration

Defined in

packages/hooks/src/orderly/useChains.ts:36

UseChainsReturnObject

Ƭ UseChainsReturnObject: Object

Type declaration

Defined in

packages/hooks/src/orderly/useChains.ts:41

UseOrderEntryMetaState

Ƭ UseOrderEntryMetaState: Object

Type declaration

Defined in

packages/hooks/src/orderly/useOrderEntry.ts:37

chainFilter

Ƭ chainFilter: filteredChains | chainFilterFunc

Defined in

packages/hooks/src/orderlyContext.ts:18

chainFilterFunc

Ƭ chainFilterFunc: (config: ConfigStore) => filteredChains

Type declaration

▸ (config): filteredChains
Parameters
Returns
filteredChains

Defined in

packages/hooks/src/orderlyContext.ts:16

filteredChains

Ƭ filteredChains: Object

Type declaration

Defined in

packages/hooks/src/orderlyContext.ts:11

Variables

DefaultLayoutConfig

Const DefaultLayoutConfig: PosterLayoutConfig

Defined in

packages/hooks/src/services/painter/layout.config.ts:3

OrderlyContext

Const OrderlyContext: Context<OrderlyConfigContextState>

Defined in

packages/hooks/src/orderlyContext.ts:37

StatusContext

Const StatusContext: Context<StatusContextState>

Defined in

packages/hooks/src/statusProvider.tsx:8

WalletConnectorContext

Const WalletConnectorContext: Context<WalletConnectorContextState>

Defined in

packages/hooks/src/walletConnectorContext.tsx:36

version

version: "1.5.7"

Defined in

packages/hooks/src/version.ts:14

Function Functions

useDebouncedCallback

useDebouncedCallback<T>(func, wait?, options?): DebouncedState<T> Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since the last time the debounced function was invoked, or until the next browser frame is drawn. The debounced function comes with a cancel method to cancel delayed func invocations and a flush method to immediately invoke them. Provide options to indicate whether func should be invoked on the leading and/or trailing edge of the wait timeout. The func is invoked with the last arguments provided to the debounced function. Subsequent calls to the debounced function return the result of the last func invocation. Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only if the debounced function is invoked more than once during the wait timeout. If wait is 0 and leading is false, func invocation is deferred until the next tick, similar to setTimeout with a timeout of 0. If wait is omitted in an environment with requestAnimationFrame, func invocation will be deferred until the next frame is drawn (typically about 16ms). See David Corbacho’s article for details over the differences between debounce and throttle.

Type parameters

Parameters

Returns

DebouncedState<T> Returns the new debounced function. Example

Defined in

node_modules/.pnpm/use-debounce@9.0.4_react@18.2.0/node_modules/use-debounce/dist/useDebouncedCallback.d.ts:104

useThrottledCallback

useThrottledCallback<T>(func, wait?, options?): DebouncedState<T> Creates a throttled function that only invokes func at most once per every wait milliseconds (or once per browser frame). The throttled function comes with a cancel method to cancel delayed func invocations and a flush method to immediately invoke them. Provide options to indicate whether func should be invoked on the leading and/or trailing edge of the wait timeout. The func is invoked with the last arguments provided to the throttled function. Subsequent calls to the throttled function return the result of the last func invocation. Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only if the throttled function is invoked more than once during the wait timeout. If wait is 0 and leading is false, func invocation is deferred until the next tick, similar to setTimeout with a timeout of 0. If wait is omitted in an environment with requestAnimationFrame, func invocation will be deferred until the next frame is drawn (typically about 16ms). See David Corbacho’s article for details over the differences between throttle and debounce.

Type parameters

Parameters

Returns

DebouncedState<T> Returns the new throttled function. Example

Defined in

node_modules/.pnpm/use-debounce@9.0.4_react@18.2.0/node_modules/use-debounce/dist/useThrottledCallback.d.ts:54

Other Functions

OrderlyConfigProvider

OrderlyConfigProvider(props): null | Element

Parameters

Returns

null | Element

Defined in

packages/hooks/src/configProvider.tsx:60

OrderlyProvider

OrderlyProvider(props): ReactNode NOTE: Exotic components are not callable.

Parameters

Returns

ReactNode

Defined in

node_modules/.pnpm/@types+react@18.2.38/node_modules/@types/react/index.d.ts:395

SWRConfig

SWRConfig(props, context?): ReactNode

Parameters

Returns

ReactNode

Defined in

node_modules/.pnpm/@types+react@18.2.21/node_modules/@types/react/index.d.ts:563

StatusProvider

StatusProvider(props, context?): ReactNode

Parameters

Returns

ReactNode

Defined in

node_modules/.pnpm/@types+react@18.2.38/node_modules/@types/react/index.d.ts:567

checkNotional

checkNotional(price?, qty?, minNotional?): string | undefined

Parameters

Returns

string | undefined

Defined in

packages/hooks/src/utils/createOrder.ts:3

cleanStringStyle

cleanStringStyle(str): string

Parameters

Returns

string

Defined in

packages/hooks/src/utils/orderEntryHelper.ts:29

parseJSON

parseJSON<T>(value): T | undefined

Type parameters

Parameters

Returns

T | undefined

Defined in

packages/hooks/src/utils/json.ts:1

unstable_serialize

unstable_serialize(key): string

Parameters

Returns

string

Defined in

node_modules/.pnpm/swr@2.2.4_react@18.2.0/node_modules/swr/core/dist/index.d.ts:6

useAccount

useAccount(): Object

Returns

Object

Defined in

packages/hooks/src/useAccount.ts:6

useAccountInfo

useAccountInfo(): SWRResponse<AccountInfo, any, any>

Returns

SWRResponse<AccountInfo, any, any>

Defined in

packages/hooks/src/orderly/useAccountInfo.ts:4

useAccountInstance

useAccountInstance(): Account

Returns

Account

Defined in

packages/hooks/src/useAccountInstance.ts:6

useBoolean

useBoolean(initialValue?): [boolean, { setFalse: () => void ; setTrue: () => void ; toggle: () => void }]

Parameters

Returns

[boolean, { setFalse: () => void ; setTrue: () => void ; toggle: () => void }]

Defined in

packages/hooks/src/useBoolean.ts:3

useChain

useChain(token): Object

Parameters

Returns

Object

Defined in

packages/hooks/src/orderly/useChain.ts:5

useChains

useChains(networkId?, options?): [Chains<undefined, undefined>, UseChainsReturnObject]

Parameters

Returns

[Chains<undefined, undefined>, UseChainsReturnObject]

Defined in

packages/hooks/src/orderly/useChains.ts:46 useChains<T, K>(networkId?, options?): [Chains<T, K extends UseChainsOptions ? K["pick"] extends keyof Chain ? K["pick"] : undefined : undefined>, UseChainsReturnObject]

Type parameters

Parameters

Returns

[Chains<T, K extends UseChainsOptions ? K["pick"] extends keyof Chain ? K["pick"] : undefined : undefined>, UseChainsReturnObject]

Defined in

packages/hooks/src/orderly/useChains.ts:51

useCheckReferralCode

useCheckReferralCode(code?): Object

Parameters

Returns

Object

Defined in

packages/hooks/src/referral/useCheckReferralCode.ts:4

useCollateral

useCollateral(options?): CollateralOutputs

Parameters

Returns

CollateralOutputs

Defined in

packages/hooks/src/orderly/useCollateral.ts:30

useCommission

useCommission(options?): any[]

Parameters

Returns

any[]

Defined in

packages/hooks/src/referral/useCommission.ts:5

useConfig

useConfig(): ConfigStore

Returns

ConfigStore

Defined in

packages/hooks/src/useConfig.ts:5 useConfig<T>(key, defaultValue?): T

Type parameters

Parameters

Returns

T

Defined in

packages/hooks/src/useConfig.ts:6

useConstant

useConstant<T>(fn): T

Type parameters

Parameters

Returns

T

Defined in

node_modules/.pnpm/use-constant@1.1.1_react@18.2.0/node_modules/use-constant/types/index.d.ts:1

useDaily

useDaily(options?): Object

Parameters

Returns

Object

Defined in

packages/hooks/src/referral/useDaily.ts:5

useDebounce

useDebounce<T>(value, delay, options?): [T, DebouncedState<(value: T) => void>]

Type parameters

Parameters

Returns

[T, DebouncedState<(value: T) => void>]

Defined in

node_modules/.pnpm/use-debounce@9.0.4_react@18.2.0/node_modules/use-debounce/dist/useDebounce.d.ts:2

useDeposit

useDeposit(options?): Object

Parameters

Returns

Object

Defined in

packages/hooks/src/orderly/useDeposit.ts:27

useDistribution

useDistribution(params): any

Parameters

Returns

any

Defined in

packages/hooks/src/referral/useDistribution.ts:17

useEventEmitter

useEventEmitter(): EventEmitter<string | symbol, any>

Returns

EventEmitter<string | symbol, any>

Defined in

packages/hooks/src/useEventEmitter.ts:4

useFundingRate

useFundingRate(symbol): Object

Parameters

Returns

Object

Defined in

packages/hooks/src/orderly/useFundingRate.ts:6

useGetReferralCode

useGetReferralCode(accountId?): Object

Parameters

Returns

Object

Defined in

packages/hooks/src/referral/useGetReferralCode.ts:3

useHoldingStream

useHoldingStream(): Object

Returns

Object

Defined in

packages/hooks/src/orderly/useHoldingStream.ts:7

useIndexPrice

useIndexPrice(symbol): SWRSubscriptionResponse<any, any>

Parameters

Returns

SWRSubscriptionResponse<any, any>

Defined in

packages/hooks/src/orderly/useIndexPrice.ts:4

useLazyQuery

useLazyQuery<T, R>(query, options?): SWRMutationResponse<any, any, Key, never> useQuery

Type parameters

Parameters

Returns

SWRMutationResponse<any, any, Key, never> Description for public api

Defined in

packages/hooks/src/useLazyQuery.ts:15

useLeverage

useLeverage(): any

Returns

any

Defined in

packages/hooks/src/orderly/useLeverage.ts:7

useLocalStorage

useLocalStorage<T>(key, initialValue): [any, (value: T) => void]

Type parameters

Parameters

Returns

[any, (value: T) => void]

Defined in

packages/hooks/src/useLocalStorage.ts:5

useMarginRatio

useMarginRatio(): MarginRatioReturn

Returns

MarginRatioReturn

Defined in

packages/hooks/src/orderly/useMarginRatio.ts:17

useMarkPrice

useMarkPrice(symbol): Object

Parameters

Returns

Object

Defined in

packages/hooks/src/orderly/useMarkPrice.ts:5

useMarkPricesStream

useMarkPricesStream(): SWRSubscriptionResponse<Record<string, number>, any>

Returns

SWRSubscriptionResponse<Record<string, number>, any>

Defined in

packages/hooks/src/orderly/useMarkPricesStream.ts:4

useMarketTradeStream

useMarketTradeStream(symbol, options?): Object

Parameters

Returns

Object

Defined in

packages/hooks/src/orderly/useMarketTradeStream.ts:9

useMarkets

useMarkets(type): readonly [Ticker[], { addToHistory: (symbol: MarketInfoExt) => void ; favoriteTabs: FavoriteTab[] = tabs; favorites: { name: string ; tabs: FavoriteTab[] = favTabs }[] ; getLastSelFavTab: () => FavoriteTab ; pinToTop: (symbol: MarketInfoExt) => void ; recent: Recent[] ; updateFavoriteTabs: (tab: FavoriteTab | FavoriteTab[], operator?: { add?: boolean ; delete?: boolean ; update?: boolean }) => void ; updateSelectedFavoriteTab: (tab: FavoriteTab) => void ; updateSymbolFavoriteState: (symbol: MarketInfoExt, tab: FavoriteTab | FavoriteTab[], del: boolean) => void }]

Parameters

Returns

readonly [Ticker[], { addToHistory: (symbol: MarketInfoExt) => void ; favoriteTabs: FavoriteTab[] = tabs; favorites: { name: string ; tabs: FavoriteTab[] = favTabs }[] ; getLastSelFavTab: () => FavoriteTab ; pinToTop: (symbol: MarketInfoExt) => void ; recent: Recent[] ; updateFavoriteTabs: (tab: FavoriteTab | FavoriteTab[], operator?: { add?: boolean ; delete?: boolean ; update?: boolean }) => void ; updateSelectedFavoriteTab: (tab: FavoriteTab) => void ; updateSymbolFavoriteState: (symbol: MarketInfoExt, tab: FavoriteTab | FavoriteTab[], del: boolean) => void }]

Defined in

packages/hooks/src/orderly/useMarkets.ts:49

useMarketsStream

useMarketsStream(): Object

Returns

Object

Defined in

packages/hooks/src/orderly/useMarketsStream.ts:8

useMaxQty

useMaxQty(symbol, side, reduceOnly?): number

Parameters

Returns

number the maximum quantity available for trading in USD

Defined in

packages/hooks/src/orderly/useMaxQty.ts:23

useMediaQuery

useMediaQuery(query): boolean

Parameters

Returns

boolean

Defined in

packages/hooks/src/useMediaQuery.ts:3

useMutation

useMutation<T, E>(url, method?, options?): readonly [(data: null | Record<string, any>, params?: Record<string, any>, options?: SWRMutationConfiguration<T, E>) => Promise<any>, { data: any ; error: undefined | E ; isMutating: boolean ; reset: () => void }] This hook is used to execute API requests for data mutation, such as POST, DELETE, PUT, etc.

Type parameters

Parameters

Returns

readonly [(data: null | Record<string, any>, params?: Record<string, any>, options?: SWRMutationConfiguration<T, E>) => Promise<any>, { data: any ; error: undefined | E ; isMutating: boolean ; reset: () => void }]

Defined in

packages/hooks/src/useMutation.ts:53

useOrderEntry

useOrderEntry(order, options?): UseOrderEntryReturn Create Order

Parameters

Returns

UseOrderEntryReturn Example

Defined in

packages/hooks/src/orderly/useOrderEntry.ts:98 useOrderEntry(symbol, side, reduceOnly): UseOrderEntryReturn

Parameters

Returns

UseOrderEntryReturn Deprecated

Defined in

packages/hooks/src/orderly/useOrderEntry.ts:105

useOrderStream

useOrderStream(params, options?): readonly [null | any[], { cancelAlgoOrder: (orderId: number, symbol?: string) => Promise<any> ; cancelAlgoOrdersByTypes: (types: AlgoOrderRootType[]) => Promise<any[]> ; cancelAllOrders: () => Promise<[any, any]> ; cancelAllTPSLOrders: () => Promise<any[]> ; cancelOrder: (orderId: number, symbol?: string) => Promise<any> ; cancelTPSLChildOrder: (orderId: number, rootAlgoOrderId: number) => Promise<any> ; errors: { cancelAlgoOrder: unknown = cancelAlgoOrderError; cancelOrder: unknown = cancelOrderError; updateAlgoOrder: unknown = updateAlgoOrderError; updateOrder: unknown = updateOrderError } ; isLoading: boolean = ordersResponse.isLoading; loadMore: () => void ; refresh: KeyedMutator<any[]> = ordersResponse.mutate; submitting: { cancelAlgoOrder: boolean = cancelAlgoMutating; cancelOrder: boolean = cancelMutating; updateAlglOrder: boolean = updateAlgoMutating; updateOrder: boolean = updateMutating } ; total: number ; updateAlgoOrder: (orderId: string, order: OrderEntity) => Promise<any> ; updateOrder: (orderId: string, order: OrderEntity) => Promise<any> ; updateTPSLOrder: (orderId: number, childOrders: AlgoOrder[]) => Promise<any> }]

Parameters

Returns

readonly [null | any[], { cancelAlgoOrder: (orderId: number, symbol?: string) => Promise<any> ; cancelAlgoOrdersByTypes: (types: AlgoOrderRootType[]) => Promise<any[]> ; cancelAllOrders: () => Promise<[any, any]> ; cancelAllTPSLOrders: () => Promise<any[]> ; cancelOrder: (orderId: number, symbol?: string) => Promise<any> ; cancelTPSLChildOrder: (orderId: number, rootAlgoOrderId: number) => Promise<any> ; errors: { cancelAlgoOrder: unknown = cancelAlgoOrderError; cancelOrder: unknown = cancelOrderError; updateAlgoOrder: unknown = updateAlgoOrderError; updateOrder: unknown = updateOrderError } ; isLoading: boolean = ordersResponse.isLoading; loadMore: () => void ; refresh: KeyedMutator<any[]> = ordersResponse.mutate; submitting: { cancelAlgoOrder: boolean = cancelAlgoMutating; cancelOrder: boolean = cancelMutating; updateAlglOrder: boolean = updateAlgoMutating; updateOrder: boolean = updateMutating } ; total: number ; updateAlgoOrder: (orderId: string, order: OrderEntity) => Promise<any> ; updateOrder: (orderId: string, order: OrderEntity) => Promise<any> ; updateTPSLOrder: (orderId: number, childOrders: AlgoOrder[]) => Promise<any> }]

Defined in

packages/hooks/src/orderly/useOrderStream/useOrderStream.ts:23

useOrderbookStream

useOrderbookStream(symbol, initial?, options?): ({ allDepths?: undefined = depths; asks: OrderBookItem[] ; bids: OrderBookItem[] ; depth: undefined ; isLoading: undefined ; markPrice: number = markPrice; middlePrice: number[] ; onDepthChange: undefined ; onItemClick: undefined } | { allDepths: any[] = depths; asks?: undefined ; bids?: undefined ; depth: undefined | number ; isLoading: boolean ; markPrice?: undefined = markPrice; middlePrice?: undefined ; onDepthChange: (depth: number) => void ; onItemClick: (item: OrderBookItem) => void })[]

Parameters

Returns

({ allDepths?: undefined = depths; asks: OrderBookItem[] ; bids: OrderBookItem[] ; depth: undefined ; isLoading: undefined ; markPrice: number = markPrice; middlePrice: number[] ; onDepthChange: undefined ; onItemClick: undefined } | { allDepths: any[] = depths; asks?: undefined ; bids?: undefined ; depth: undefined | number ; isLoading: boolean ; markPrice?: undefined = markPrice; middlePrice?: undefined ; onDepthChange: (depth: number) => void ; onItemClick: (item: OrderBookItem) => void })[] Name useOrderbookStream Description React hook that returns the current orderbook for a given market

Defined in

packages/hooks/src/orderly/useOrderbookStream.ts:235

usePositionStream

usePositionStream(symbol?, options?): readonly [{ aggregated: any ; rows: null | PositionTPSLExt[] = positionsRows; totalCollateral: Decimal ; totalUnrealizedROI: number ; totalValue: Decimal }, { current_margin_ratio_with_orders: (key?: "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", defaultValue?: number) => any ; free_collateral: (key?: "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", defaultValue?: number) => any ; initial_margin_ratio: (key?: "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", defaultValue?: number) => any ; initial_margin_ratio_with_orders: (key?: "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", defaultValue?: number) => any ; maintenance_margin_ratio: (key?: "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", defaultValue?: number) => any ; maintenance_margin_ratio_with_orders: (key?: "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", defaultValue?: number) => any ; margin_ratio: (key?: "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", defaultValue?: number) => any ; open_margin_ratio: (key?: "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", defaultValue?: number) => any ; total_collateral_value: (key?: "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", defaultValue?: number) => any ; total_pnl_24_h: (key?: "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", defaultValue?: number) => any } & { isNil: boolean }, { error: any ; loading: false = false; refresh: KeyedMutator<PositionInfo> = refreshPositions }]

Parameters

Returns

readonly [{ aggregated: any ; rows: null | PositionTPSLExt[] = positionsRows; totalCollateral: Decimal ; totalUnrealizedROI: number ; totalValue: Decimal }, { current_margin_ratio_with_orders: (key?: "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", defaultValue?: number) => any ; free_collateral: (key?: "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", defaultValue?: number) => any ; initial_margin_ratio: (key?: "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", defaultValue?: number) => any ; initial_margin_ratio_with_orders: (key?: "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", defaultValue?: number) => any ; maintenance_margin_ratio: (key?: "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", defaultValue?: number) => any ; maintenance_margin_ratio_with_orders: (key?: "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", defaultValue?: number) => any ; margin_ratio: (key?: "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", defaultValue?: number) => any ; open_margin_ratio: (key?: "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", defaultValue?: number) => any ; total_collateral_value: (key?: "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", defaultValue?: number) => any ; total_pnl_24_h: (key?: "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", defaultValue?: number) => any } & { isNil: boolean }, { error: any ; loading: false = false; refresh: KeyedMutator<PositionInfo> = refreshPositions }]

Defined in

packages/hooks/src/orderly/usePositionStream/usePositionStream.ts:37

usePoster

usePoster(data, options?): Object Generates a poster image based on position information. You can set the size, background color, font color, font size, and content position of the poster.

Parameters

Returns

Object Example

Defined in

packages/hooks/src/usePoster.ts:21

usePreLoadData

usePreLoadData(): Object

Returns

Object

Defined in

packages/hooks/src/usePreloadData.ts:6

usePrivateDataObserver

usePrivateDataObserver(options): void

Parameters

Returns

void

Defined in

packages/hooks/src/orderly/usePrivateDataObserver.ts:14

usePrivateInfiniteQuery

usePrivateInfiniteQuery(getKey, options?): SWRInfiniteResponse<any, any>

Parameters

Returns

SWRInfiniteResponse<any, any>

Defined in

packages/hooks/src/usePrivateInfiniteQuery.ts:10

usePrivateQuery

usePrivateQuery<T>(query, options?): SWRResponse<T, any, any> usePrivateQuery

Type parameters

Parameters

Returns

SWRResponse<T, any, any> Description for private api

Defined in

packages/hooks/src/usePrivateQuery.ts:13

useQuery

useQuery<T>(query, options?): SWRResponse<T, any, any> useQuery

Type parameters

Parameters

Returns

SWRResponse<T, any, any> Description for public api

Defined in

packages/hooks/src/useQuery.ts:11

useRefereeHistory

useRefereeHistory(params): any[]

Parameters

Returns

any[]

Defined in

packages/hooks/src/referral/useRefereeHistory.ts:16

useRefereeInfo

useRefereeInfo(params): any[]

Parameters

Returns

any[]

Defined in

packages/hooks/src/referral/useRefereeInfo.ts:17

useRefereeRebateSummary

useRefereeRebateSummary(params): Object

Parameters

Returns

Object

Defined in

packages/hooks/src/referral/useRefereeRebateSummary.ts:10

useReferralInfo

useReferralInfo(): Object

Returns

Object

Defined in

packages/hooks/src/referral/useReferralInfo.tsx:7

useReferralRebateSummary

useReferralRebateSummary(params): any[]

Parameters

Returns

any[]

Defined in

packages/hooks/src/referral/useReferralRebateSummary.ts:17

useSWR

useSWR<Data, Error, SWRKey>(key): SWRResponse<Data, Error, any> A hook to fetch data.

Type parameters

Parameters

Returns

SWRResponse<Data, Error, any> Link https://swr.vercel.app Example

Defined in

node_modules/.pnpm/swr@2.2.4_react@18.2.0/node_modules/swr/_internal/dist/index.d.ts:199 useSWR<Data, Error, SWRKey>(key, fetcher): SWRResponse<Data, Error, any> A hook to fetch data.

Type parameters

Parameters

Returns

SWRResponse<Data, Error, any> Link https://swr.vercel.app Example

Defined in

node_modules/.pnpm/swr@2.2.4_react@18.2.0/node_modules/swr/_internal/dist/index.d.ts:200 useSWR<Data, Error, SWRKey>(key, fetcher): SWRResponse<Data, Error, any> A hook to fetch data.

Type parameters

Parameters

Returns

SWRResponse<Data, Error, any> Link https://swr.vercel.app Example

Defined in

node_modules/.pnpm/swr@2.2.4_react@18.2.0/node_modules/swr/_internal/dist/index.d.ts:201 useSWR<Data, Error, SWRKey, SWROptions>(key, config): SWRResponse<Data, Error, SWROptions> A hook to fetch data.

Type parameters

Parameters

Returns

SWRResponse<Data, Error, SWROptions> Link https://swr.vercel.app Example

Defined in

node_modules/.pnpm/swr@2.2.4_react@18.2.0/node_modules/swr/_internal/dist/index.d.ts:202 useSWR<Data, Error, SWRKey, SWROptions>(key, fetcher, config): SWRResponse<Data, Error, SWROptions> A hook to fetch data.

Type parameters

Parameters

Returns

SWRResponse<Data, Error, SWROptions> Link https://swr.vercel.app Example

Defined in

node_modules/.pnpm/swr@2.2.4_react@18.2.0/node_modules/swr/_internal/dist/index.d.ts:203 useSWR<Data, Error>(key): SWRResponse<Data, Error, any> A hook to fetch data.

Type parameters

Parameters

Returns

SWRResponse<Data, Error, any> Link https://swr.vercel.app Example

Defined in

node_modules/.pnpm/swr@2.2.4_react@18.2.0/node_modules/swr/_internal/dist/index.d.ts:204 useSWR<Data, Error, SWROptions>(key, config): SWRResponse<Data, Error, SWROptions> A hook to fetch data.

Type parameters

Parameters

Returns

SWRResponse<Data, Error, SWROptions> Link https://swr.vercel.app Example

Defined in

node_modules/.pnpm/swr@2.2.4_react@18.2.0/node_modules/swr/_internal/dist/index.d.ts:205 useSWR<Data, Error, SWROptions>(key, fetcher, config): SWRResponse<Data, Error, SWROptions> A hook to fetch data.

Type parameters

Parameters

Returns

SWRResponse<Data, Error, SWROptions> Link https://swr.vercel.app Example

Defined in

node_modules/.pnpm/swr@2.2.4_react@18.2.0/node_modules/swr/_internal/dist/index.d.ts:206

useSWRConfig

useSWRConfig(): FullConfiguration<any, any, BareFetcher<unknown>>

Returns

FullConfiguration<any, any, BareFetcher<unknown>>

Defined in

node_modules/.pnpm/swr@2.2.4_react@18.2.0/node_modules/swr/_internal/dist/index.d.ts:356

useSessionStorage

useSessionStorage<T>(key, initialValue): [T, (data: any) => void]

Type parameters

Parameters

Returns

[T, (data: any) => void]

Defined in

packages/hooks/src/useSessionStorage.ts:4

useSettleSubscription

useSettleSubscription(options?): SWRSubscriptionResponse<any, any>

Parameters

Returns

SWRSubscriptionResponse<any, any>

Defined in

packages/hooks/src/orderly/useSettleSubscription.ts:4

useSymbolLeverage

useSymbolLeverage(symbol): number | "-"

Parameters

Returns

number | "-"

Defined in

packages/hooks/src/orderly/useSymbolLeverage.ts:5

useSymbolPriceRange

useSymbolPriceRange(symbol, side, price?): undefined | PriceRange Get the price range for the specified symbol with an optional price

Parameters

Returns

undefined | PriceRange PriceRange | undefined - Returns the PriceRange representing the price range or undefined

Defined in

packages/hooks/src/orderly/useSymbolPriceRange.ts:19

useSymbolsInfo

useSymbolsInfo(): & { isNil: boolean }

Returns

& { isNil: boolean }

Defined in

packages/hooks/src/orderly/useSymbolsInfo.ts:6

useTPSLOrder

useTPSLOrder(position, options?): [Partial<Omit<BaseAlgoOrderEntity<TP_SL>, "type" | "side" | "trigger_price" | "order_type"> & Partial<Pick<BaseAlgoOrderEntity<TP_SL>, "type" | "side" | "trigger_price" | "order_type">> & { sl_offset: number ; sl_offset_percentage: number ; sl_pnl: number ; tp_offset: number ; tp_offset_percentage: number ; tp_pnl: number }>, { errors: null | ValidateError ; setValue: (key: string, value: string | number) => void ; setValues: (values: Partial<Partial<Omit<BaseAlgoOrderEntity<TP_SL>, "type" | "side" | "trigger_price" | "order_type"> & Partial<Pick<BaseAlgoOrderEntity<TP_SL>, "type" | "side" | "trigger_price" | "order_type">> & { sl_offset: number ; sl_offset_percentage: number ; sl_pnl: number ; tp_offset: number ; tp_offset_percentage: number ; tp_pnl: number }>>) => void ; submit: () => Promise<void> ; validate: () => Promise<AlgoOrderEntity<TP_SL | POSITIONAL_TP_SL>> }]

Parameters

Returns

[Partial<Omit<BaseAlgoOrderEntity<TP_SL>, "type" | "side" | "trigger_price" | "order_type"> & Partial<Pick<BaseAlgoOrderEntity<TP_SL>, "type" | "side" | "trigger_price" | "order_type">> & { sl_offset: number ; sl_offset_percentage: number ; sl_pnl: number ; tp_offset: number ; tp_offset_percentage: number ; tp_pnl: number }>, { errors: null | ValidateError ; setValue: (key: string, value: string | number) => void ; setValues: (values: Partial<Partial<Omit<BaseAlgoOrderEntity<TP_SL>, "type" | "side" | "trigger_price" | "order_type"> & Partial<Pick<BaseAlgoOrderEntity<TP_SL>, "type" | "side" | "trigger_price" | "order_type">> & { sl_offset: number ; sl_offset_percentage: number ; sl_pnl: number ; tp_offset: number ; tp_offset_percentage: number ; tp_pnl: number }>>) => void ; submit: () => Promise<void> ; validate: () => Promise<AlgoOrderEntity<TP_SL | POSITIONAL_TP_SL>> }]

Defined in

packages/hooks/src/orderly/useTakeProfitAndStopLoss/index.ts:4

useTickerStream

useTickerStream(symbol): MarketInfo & { 24h_change?: Decimal ; change?: Decimal }

Parameters

Returns

MarketInfo & { 24h_change?: Decimal ; change?: Decimal }

Defined in

packages/hooks/src/orderly/useTickerStream.ts:11

useWS

useWS(): WS

Returns

WS

Defined in

packages/hooks/src/useWS.ts:11

useWalletConnector

useWalletConnector(): WalletConnectorContextState

Returns

WalletConnectorContextState

Defined in

packages/hooks/src/walletConnectorContext.tsx:39

useWalletSubscription

useWalletSubscription(options?): SWRSubscriptionResponse<any, any>

Parameters

Returns

SWRSubscriptionResponse<any, any>

Defined in

packages/hooks/src/orderly/useWalletSubscription.ts:4

useWithdraw

useWithdraw(options?): Object

Parameters

Returns

Object

Defined in

packages/hooks/src/orderly/useWithdraw.ts:16

useWsStatus

useWsStatus(): WsNetworkStatus

Returns

WsNetworkStatus

Defined in

packages/hooks/src/useWsStatus.ts:10