Module: @orderly.network/hooks
Table of contents
Namespaces
Enumerations
Interfaces
- CallOptions
- ConfigProviderProps
- ControlFunctions
- DebouncedState
- Favorite
- FavoriteTab
- Options
- OrderlyConfigContextState
- Recent
- StatusContextState
- WalletAdapter
Type Aliases
- Chain
- Chains
- CollateralOutputs
- ComputedAlgoOrder
- DrawOptions
- OrderBookItem
- OrderParams
- OrderbookData
- OrderbookOptions
- PosterLayoutConfig
- SWRConfiguration
- UseChainsOptions
- UseChainsReturnObject
- UseOrderEntryMetaState
- chainFilter
- chainFilterFunc
- filteredChains
Variables
Function Functions
Other Functions
- OrderlyConfigProvider
- OrderlyProvider
- SWRConfig
- StatusProvider
- checkNotional
- cleanStringStyle
- parseJSON
- unstable_serialize
- useAccount
- useAccountInfo
- useAccountInstance
- useBoolean
- useChain
- useChains
- useCheckReferralCode
- useCollateral
- useCommission
- useConfig
- useConstant
- useDaily
- useDebounce
- useDeposit
- useDistribution
- useEventEmitter
- useFundingRate
- useGetReferralCode
- useHoldingStream
- useIndexPrice
- useLazyQuery
- useLeverage
- useLocalStorage
- useMarginRatio
- useMarkPrice
- useMarkPricesStream
- useMarketTradeStream
- useMarkets
- useMarketsStream
- useMaxQty
- useMediaQuery
- useMutation
- useOrderEntry
- useOrderStream
- useOrderbookStream
- usePositionStream
- usePoster
- usePreLoadData
- usePrivateDataObserver
- usePrivateInfiniteQuery
- usePrivateQuery
- useQuery
- useRefereeHistory
- useRefereeInfo
- useRefereeRebateSummary
- useReferralInfo
- useReferralRebateSummary
- useSWR
- useSWRConfig
- useSessionStorage
- useSettleSubscription
- useSymbolLeverage
- useSymbolPriceRange
- useSymbolsInfo
- useTPSLOrder
- useTickerStream
- useWS
- useWalletConnector
- useWalletSubscription
- useWithdraw
- useWsStatus
Type Aliases
Chain
Ƭ Chain:Chain & { nativeToken?: TokenInfo }
Defined in
packages/hooks/src/orderly/useChains.ts:15Chains
Ƭ 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:19CollateralOutputs
Ƭ CollateralOutputs:Object
Type declaration
Defined in
packages/hooks/src/orderly/useCollateral.ts:16ComputedAlgoOrder
Ƭ 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:19DrawOptions
Ƭ DrawOptions:Object
Type declaration
Defined in
packages/hooks/src/services/painter/basePaint.ts:85OrderBookItem
Ƭ OrderBookItem:number[]
Defined in
packages/hooks/src/orderly/useOrderbookStream.ts:12OrderParams
Ƭ OrderParams:Required<Pick<OrderEntity, "side" | "order_type" | "symbol">> & Partial<Omit<OrderEntity, "side" | "symbol" | "order_type">>
Defined in
packages/hooks/src/orderly/useOrderEntry.ts:74OrderbookData
Ƭ OrderbookData:Object
Type declaration
Defined in
packages/hooks/src/orderly/useOrderbookStream.ts:14OrderbookOptions
Ƭ OrderbookOptions:Object
Configuration for the Order Book
Type declaration
Defined in
packages/hooks/src/orderly/useOrderbookStream.ts:222PosterLayoutConfig
Ƭ PosterLayoutConfig:Object
Type declaration
Defined in
packages/hooks/src/services/painter/basePaint.ts:69SWRConfiguration
Ƭ 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:257UseChainsOptions
Ƭ UseChainsOptions: {filter?: (item: Chain) => boolean ; pick?: "dexs" | "network_infos" | "token_infos" } & SWRConfiguration
Defined in
packages/hooks/src/orderly/useChains.ts:36UseChainsReturnObject
Ƭ UseChainsReturnObject:Object
Type declaration
Defined in
packages/hooks/src/orderly/useChains.ts:41UseOrderEntryMetaState
Ƭ UseOrderEntryMetaState:Object
Type declaration
Defined in
packages/hooks/src/orderly/useOrderEntry.ts:37chainFilter
Ƭ chainFilter:filteredChains | chainFilterFunc
Defined in
packages/hooks/src/orderlyContext.ts:18chainFilterFunc
Ƭ chainFilterFunc: (config: ConfigStore) => filteredChains
Type declaration
▸ (config): filteredChains
Parameters
Returns
filteredChains
Defined in
packages/hooks/src/orderlyContext.ts:16filteredChains
Ƭ filteredChains:Object
Type declaration
Defined in
packages/hooks/src/orderlyContext.ts:11Variables
DefaultLayoutConfig
•Const DefaultLayoutConfig: PosterLayoutConfig
Defined in
packages/hooks/src/services/painter/layout.config.ts:3OrderlyContext
•Const OrderlyContext: Context<OrderlyConfigContextState>
Defined in
packages/hooks/src/orderlyContext.ts:37StatusContext
•Const StatusContext: Context<StatusContextState>
Defined in
packages/hooks/src/statusProvider.tsx:8WalletConnectorContext
•Const WalletConnectorContext: Context<WalletConnectorContextState>
Defined in
packages/hooks/src/walletConnectorContext.tsx:36version
• version:"1.5.7"
Defined in
packages/hooks/src/version.ts:14Function 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:104useThrottledCallback
▸ 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:54Other Functions
OrderlyConfigProvider
▸ OrderlyConfigProvider(props): null | Element
Parameters
Returns
null | Element
Defined in
packages/hooks/src/configProvider.tsx:60OrderlyProvider
▸ 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:395SWRConfig
▸ SWRConfig(props, context?): ReactNode
Parameters
Returns
ReactNode
Defined in
node_modules/.pnpm/@types+react@18.2.21/node_modules/@types/react/index.d.ts:563StatusProvider
▸ StatusProvider(props, context?): ReactNode
Parameters
Returns
ReactNode
Defined in
node_modules/.pnpm/@types+react@18.2.38/node_modules/@types/react/index.d.ts:567checkNotional
▸ checkNotional(price?, qty?, minNotional?): string | undefined
Parameters
Returns
string | undefined
Defined in
packages/hooks/src/utils/createOrder.ts:3cleanStringStyle
▸ cleanStringStyle(str): string
Parameters
Returns
string
Defined in
packages/hooks/src/utils/orderEntryHelper.ts:29parseJSON
▸ parseJSON<T>(value): T | undefined
Type parameters
Parameters
Returns
T | undefined
Defined in
packages/hooks/src/utils/json.ts:1unstable_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:6useAccount
▸ useAccount():Object
Returns
Object
Defined in
packages/hooks/src/useAccount.ts:6useAccountInfo
▸ useAccountInfo():SWRResponse<AccountInfo, any, any>
Returns
SWRResponse<AccountInfo, any, any>
Defined in
packages/hooks/src/orderly/useAccountInfo.ts:4useAccountInstance
▸ useAccountInstance():Account
Returns
Account
Defined in
packages/hooks/src/useAccountInstance.ts:6useBoolean
▸ 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:3useChain
▸ useChain(token): Object
Parameters
Returns
Object
Defined in
packages/hooks/src/orderly/useChain.ts:5useChains
▸ 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:51useCheckReferralCode
▸ useCheckReferralCode(code?): Object
Parameters
Returns
Object
Defined in
packages/hooks/src/referral/useCheckReferralCode.ts:4useCollateral
▸ useCollateral(options?): CollateralOutputs
Parameters
Returns
CollateralOutputs
Defined in
packages/hooks/src/orderly/useCollateral.ts:30useCommission
▸ useCommission(options?): any[]
Parameters
Returns
any[]
Defined in
packages/hooks/src/referral/useCommission.ts:5useConfig
▸ 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:6useConstant
▸ 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:1useDaily
▸ useDaily(options?): Object
Parameters
Returns
Object
Defined in
packages/hooks/src/referral/useDaily.ts:5useDebounce
▸ 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:2useDeposit
▸ useDeposit(options?): Object
Parameters
Returns
Object
Defined in
packages/hooks/src/orderly/useDeposit.ts:27useDistribution
▸ useDistribution(params): any
Parameters
Returns
any
Defined in
packages/hooks/src/referral/useDistribution.ts:17useEventEmitter
▸ useEventEmitter():EventEmitter<string | symbol, any>
Returns
EventEmitter<string | symbol, any>
Defined in
packages/hooks/src/useEventEmitter.ts:4useFundingRate
▸ useFundingRate(symbol): Object
Parameters
Returns
Object
Defined in
packages/hooks/src/orderly/useFundingRate.ts:6useGetReferralCode
▸ useGetReferralCode(accountId?): Object
Parameters
Returns
Object
Defined in
packages/hooks/src/referral/useGetReferralCode.ts:3useHoldingStream
▸ useHoldingStream():Object
Returns
Object
Defined in
packages/hooks/src/orderly/useHoldingStream.ts:7useIndexPrice
▸ useIndexPrice(symbol): SWRSubscriptionResponse<any, any>
Parameters
Returns
SWRSubscriptionResponse<any, any>
Defined in
packages/hooks/src/orderly/useIndexPrice.ts:4useLazyQuery
▸ 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:15useLeverage
▸ useLeverage():any
Returns
any
Defined in
packages/hooks/src/orderly/useLeverage.ts:7useLocalStorage
▸ useLocalStorage<T>(key, initialValue): [any, (value: T) => void]
Type parameters
Parameters
Returns
[any, (value: T) => void]
Defined in
packages/hooks/src/useLocalStorage.ts:5useMarginRatio
▸ useMarginRatio():MarginRatioReturn
Returns
MarginRatioReturn
Defined in
packages/hooks/src/orderly/useMarginRatio.ts:17useMarkPrice
▸ useMarkPrice(symbol): Object
Parameters
Returns
Object
Defined in
packages/hooks/src/orderly/useMarkPrice.ts:5useMarkPricesStream
▸ useMarkPricesStream():SWRSubscriptionResponse<Record<string, number>, any>
Returns
SWRSubscriptionResponse<Record<string, number>, any>
Defined in
packages/hooks/src/orderly/useMarkPricesStream.ts:4useMarketTradeStream
▸ useMarketTradeStream(symbol, options?): Object
Parameters
Returns
Object
Defined in
packages/hooks/src/orderly/useMarketTradeStream.ts:9useMarkets
▸ 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:49useMarketsStream
▸ useMarketsStream():Object
Returns
Object
Defined in
packages/hooks/src/orderly/useMarketsStream.ts:8useMaxQty
▸ useMaxQty(symbol, side, reduceOnly?): number
Parameters
Returns
number
the maximum quantity available for trading in USD
Defined in
packages/hooks/src/orderly/useMaxQty.ts:23useMediaQuery
▸ useMediaQuery(query): boolean
Parameters
Returns
boolean
Defined in
packages/hooks/src/useMediaQuery.ts:3useMutation
▸ 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:53useOrderEntry
▸ 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:105useOrderStream
▸ 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:23useOrderbookStream
▸ 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:235usePositionStream
▸ 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:37usePoster
▸ 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:21usePreLoadData
▸ usePreLoadData():Object
Returns
Object
Defined in
packages/hooks/src/usePreloadData.ts:6usePrivateDataObserver
▸ usePrivateDataObserver(options): void
Parameters
Returns
void
Defined in
packages/hooks/src/orderly/usePrivateDataObserver.ts:14usePrivateInfiniteQuery
▸ usePrivateInfiniteQuery(getKey, options?): SWRInfiniteResponse<any, any>
Parameters
Returns
SWRInfiniteResponse<any, any>
Defined in
packages/hooks/src/usePrivateInfiniteQuery.ts:10usePrivateQuery
▸ 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:13useQuery
▸ 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:11useRefereeHistory
▸ useRefereeHistory(params): any[]
Parameters
Returns
any[]
Defined in
packages/hooks/src/referral/useRefereeHistory.ts:16useRefereeInfo
▸ useRefereeInfo(params): any[]
Parameters
Returns
any[]
Defined in
packages/hooks/src/referral/useRefereeInfo.ts:17useRefereeRebateSummary
▸ useRefereeRebateSummary(params): Object
Parameters
Returns
Object
Defined in
packages/hooks/src/referral/useRefereeRebateSummary.ts:10useReferralInfo
▸ useReferralInfo():Object
Returns
Object
Defined in
packages/hooks/src/referral/useReferralInfo.tsx:7useReferralRebateSummary
▸ useReferralRebateSummary(params): any[]
Parameters
Returns
any[]
Defined in
packages/hooks/src/referral/useReferralRebateSummary.ts:17useSWR
▸ 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:206useSWRConfig
▸ 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:356useSessionStorage
▸ useSessionStorage<T>(key, initialValue): [T, (data: any) => void]
Type parameters
Parameters
Returns
[T, (data: any) => void]
Defined in
packages/hooks/src/useSessionStorage.ts:4useSettleSubscription
▸ useSettleSubscription(options?): SWRSubscriptionResponse<any, any>
Parameters
Returns
SWRSubscriptionResponse<any, any>
Defined in
packages/hooks/src/orderly/useSettleSubscription.ts:4useSymbolLeverage
▸ useSymbolLeverage(symbol): number | "-"
Parameters
Returns
number | "-"
Defined in
packages/hooks/src/orderly/useSymbolLeverage.ts:5useSymbolPriceRange
▸ 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:19useSymbolsInfo
▸ useSymbolsInfo(): & {isNil: boolean }
Returns
& {isNil: boolean }
Defined in
packages/hooks/src/orderly/useSymbolsInfo.ts:6useTPSLOrder
▸ 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:4useTickerStream
▸ useTickerStream(symbol): MarketInfo & { 24h_change?: Decimal ; change?: Decimal }
Parameters
Returns
MarketInfo & { 24h_change?: Decimal ; change?: Decimal }
Defined in
packages/hooks/src/orderly/useTickerStream.ts:11useWS
▸ useWS():WS
Returns
WS
Defined in
packages/hooks/src/useWS.ts:11useWalletConnector
▸ useWalletConnector():WalletConnectorContextState
Returns
WalletConnectorContextState
Defined in
packages/hooks/src/walletConnectorContext.tsx:39useWalletSubscription
▸ useWalletSubscription(options?): SWRSubscriptionResponse<any, any>
Parameters
Returns
SWRSubscriptionResponse<any, any>
Defined in
packages/hooks/src/orderly/useWalletSubscription.ts:4useWithdraw
▸ useWithdraw(options?): Object
Parameters
Returns
Object
Defined in
packages/hooks/src/orderly/useWithdraw.ts:16useWsStatus
▸ useWsStatus():WsNetworkStatus
Returns
WsNetworkStatus