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

NameType
Textends NetworkId | undefined = undefined
Kextends keyof Chain | undefined = undefined

Defined in

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


CollateralOutputs

Ƭ CollateralOutputs: Object

Type declaration

NameType
accountInfo?AccountInfo
availableBalancenumber
freeCollateralnumber
positionsPosition[]
totalCollateralnumber
totalValuenumber
unsettledPnLnumber

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

NameTypeDescription
backgroundColor?string-
backgroundImg?string-
brandColor?stringThe brand color of the application
color?stringColor of common text
data?posterDataSource-
fontFamily?string-
layout?PosterLayoutConfig-
lossColor?stringLose color
profitColor?stringProfit color

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

NameType
asksOrderBookItem[]
bidsOrderBookItem[]

Defined in

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


OrderbookOptions

Ƭ OrderbookOptions: Object

Configuration for the Order Book

Type declaration

NameTypeDescription
level?numberIndicates the number of data entries to return for ask/bid, default is 10
padding?booleanWhether to fill in when the actual data entries are less than the level. If filled, it will add [nan, nan, nan, nan]. Default is true

Defined in

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


PosterLayoutConfig

Ƭ PosterLayoutConfig: Object

Type declaration

NameType
domain?layoutInfo
informations?layoutInfo & { labelColor?: string }
message?layoutInfo
position?layoutInfo
unrealizedPnl?layoutInfo & { secondaryColor: string ; secondaryFontSize: number }
updateTime?layoutInfo

Defined in

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


SWRConfiguration

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

Type parameters

NameType
Dataany
Errorany
Fnextends BareFetcher<any> = BareFetcher<any>

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

NameType
errorany
findByChainId(chainId: number, field?: string) => Chain | undefined

Defined in

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


UseOrderEntryMetaState

Ƭ UseOrderEntryMetaState: Object

Type declaration

NameType
dirty{ [P in keyof OrderEntity]?: boolean } | null | undefined
errors{ [P in keyof OrderEntity]?: Object } | null | undefined
submittedboolean

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
NameType
configConfigStore
Returns

filteredChains

Defined in

packages/hooks/src/orderlyContext.ts:16


filteredChains

Ƭ filteredChains: Object

Type declaration

NameType
mainnet?ChainConfig[]
testnet?ChainConfig[]

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

NameType
Textends (…args: any) => ReturnType<T>

Parameters

NameTypeDescription
funcTThe function to debounce.
wait?numberThe number of milliseconds to delay; if omitted, requestAnimationFrame is used (if available, otherwise it will be setTimeout(…,0)).
options?OptionsThe options object. Controls if func should be invoked on the leading edge of the timeout.

Returns

DebouncedState<T>

Returns the new debounced function.

Example

// Avoid costly calculations while the window size is in flux.

const resizeHandler = useDebouncedCallback(calculateLayout, 150);

window.addEventListener('resize', resizeHandler)

// Invoke `sendMail` when clicked, debouncing subsequent calls.

const clickHandler = useDebouncedCallback(sendMail, 300, {

  leading: true,

  trailing: false,

})

<button onClick={clickHandler}>click me</button>

// Ensure `batchLog` is invoked once after 1 second of debounced calls.

const debounced = useDebouncedCallback(batchLog, 250, { 'maxWait': 1000 })

const source = new EventSource('/stream')

source.addEventListener('message', debounced)

// Cancel the trailing debounced invocation.

window.addEventListener('popstate', debounced.cancel)

// Check for pending invocations.

const status = debounced.pending() ? "Pending..." : "Ready"

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

NameType
Textends (…args: any) => ReturnType<T>

Parameters

NameTypeDescription
funcTThe function to throttle.
wait?numberThe number of milliseconds to throttle invocations to; if omitted, requestAnimationFrame is used (if available, otherwise it will be setTimeout(…,0)).
options?CallOptionsThe options object.

Returns

DebouncedState<T>

Returns the new throttled function.

Example

// Avoid excessively updating the position while scrolling.

const scrollHandler = useThrottledCallback(updatePosition, 100)

window.addEventListener('scroll', scrollHandler)

// Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.

const { callback } = useThrottledCallback(renewToken, 300000, { 'trailing': false })

<button onClick={callback}>click</button>

// Cancel the trailing throttled invocation.

window.addEventListener('popstate', throttled.cancel);

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

NameType
propsPropsWithChildren<RequireAtLeastOne<ConfigProviderProps, "brokerId" | "configStore">>

Returns

null | Element

Defined in

packages/hooks/src/configProvider.tsx:60


OrderlyProvider

OrderlyProvider(props): ReactNode

NOTE: Exotic components are not callable.

Parameters

NameType
propsProviderProps<OrderlyConfigContextState>

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

NameType
propsPropsWithChildren<{ value?: Partial<PublicConfiguration<any, any, BareFetcher<any>>> & Partial<ProviderConfiguration> & { provider?: (cache: Readonly<Cache<any>>) => Cache<any> } | (parentConfig?: Partial<PublicConfiguration<any, any, BareFetcher<any>>> & Partial<ProviderConfiguration> & { provider?: (cache: Readonly<Cache<any>>) => Cache<any> }) => Partial<PublicConfiguration<any, any, BareFetcher<any>>> & Partial<ProviderConfiguration> & { provider?: (cache: Readonly<Cache<any>>) => Cache<any> } }>
context?any

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

NameType
propsObject
props.children?ReactNode
context?any

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

NameType
price?string | number
qty?string | number
minNotional?number

Returns

string | undefined

Defined in

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


cleanStringStyle

cleanStringStyle(str): string

Parameters

NameType
strstring | number

Returns

string

Defined in

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


parseJSON

parseJSON<T>(value): T | undefined

Type parameters

Name
T

Parameters

NameType
valuenull | string

Returns

T | undefined

Defined in

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


unstable_serialize

unstable_serialize(key): string

Parameters

NameType
keyKey

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

NameType
accountAccount
createAccount() => Promise<any>
createOrderlyKey(remember: boolean) => Promise<any>
stateAccountState

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

NameTypeDefault value
initialValuebooleanfalse

Returns

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

Defined in

packages/hooks/src/useBoolean.ts:3


useChain

useChain(token): Object

Parameters

NameType
tokenstring

Returns

Object

NameType
chainsnull | Chain
isLoadingboolean

Defined in

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


useChains

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

Parameters

NameType
networkId?undefined
options?undefined

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

NameType
Textends undefined | NetworkId
Kextends undefined | UseChainsOptions

Parameters

NameType
networkId?T
options?K

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

NameType
code?string

Returns

Object

NameType
errorany
isExist?boolean
isLoadingboolean

Defined in

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


useCollateral

useCollateral(options?): CollateralOutputs

Parameters

NameTypeDescription
optionsObject-
options.dpnumberdecimal precision

Returns

CollateralOutputs

Defined in

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


useCommission

useCommission(options?): any[]

Parameters

NameType
options?Object
options.size?number

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

NameType
Tstring

Parameters

NameType
keyConfigKey
defaultValue?T

Returns

T

Defined in

packages/hooks/src/useConfig.ts:6


useConstant

useConstant<T>(fn): T

Type parameters

Name
T

Parameters

NameType
fn() => T

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

NameType
options?Object
options.endDate?Date
options.startDate?Date

Returns

Object

NameType
data?DayliVolume[]
mutateany

Defined in

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


useDebounce

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

Type parameters

Name
T

Parameters

NameType
valueT
delaynumber
options?Object
options.equalityFn?(left: T, right: T) => boolean
options.leading?boolean
options.maxWait?number
options.trailing?boolean

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

NameType
options?useDepositOptions

Returns

Object

NameType
allowancestring
allowanceRevalidatingboolean
approve(amount?: string) => Promise<undefined | void>
balancestring
balanceRevalidatingboolean
deposit() => Promise<any>
depositFeebigint
depositFeeRevalidatingboolean
dst{ address: undefined | string = USDC.address; chainId: number = targetChain.network_infos.chain_id; decimals: undefined | number = USDC.decimals; network: string = targetChain.network_infos.shortName; symbol: string = “USDC” }
dst.addressundefined | string
dst.chainIdnumber
dst.decimalsundefined | number
dst.networkstring
dst.symbolstring
fetchBalance(address: string, decimals?: number) => Promise<string>
fetchBalances(tokens: TokenInfo[]) => Promise<void>
isNativeTokenboolean
quantitystring
setQuantityDispatch<SetStateAction<string>>

Defined in

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


useDistribution

useDistribution(params): any

Parameters

NameType
paramsParams

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

NameType
symbolstring

Returns

Object

NameType
countDownstring
est_funding_ratestring
est_funding_rate_timestamp?number
last_funding_rate?number
last_funding_rate_timestamp?number
next_funding_time?number
sum_unitary_funding?number
symbol?string

Defined in

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


useGetReferralCode

useGetReferralCode(accountId?): Object

Parameters

NameType
accountId?string

Returns

Object

NameType
errorany
isLoadingboolean
referral_code?string

Defined in

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


useHoldingStream

useHoldingStream(): Object

Returns

Object

NameType
dataundefined | Holding[]
isLoadingboolean
usdcundefined | Holding

Defined in

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


useIndexPrice

useIndexPrice(symbol): SWRSubscriptionResponse<any, any>

Parameters

NameType
symbolstring

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

NameType
TT
Rany

Parameters

NameType
queryKey
options?SWRMutationConfiguration<any, any> & { formatter?: (data: any) => R ; init?: RequestInit }

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

Name
T

Parameters

NameType
keystring
initialValueT

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

NameType
symbolstring

Returns

Object

NameType
datanumber

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

NameType
symbolstring
optionsMarketTradeStreamOptions

Returns

Object

NameType
dataTrade[]
isLoadingboolean

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

NameType
typeMarketsType

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

NameType
datanull | Ticker[]

Defined in

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


useMaxQty

useMaxQty(symbol, side, reduceOnly?): number

Parameters

NameTypeDefault value
symbolstringundefined
sideOrderSideundefined
reduceOnlybooleanfalse

Returns

number

the maximum quantity available for trading in USD

Defined in

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


useMediaQuery

useMediaQuery(query): boolean

Parameters

NameType
querystring

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

Name
T
E

Parameters

NameTypeDefault valueDescription
urlstringundefinedThe URL to send the request to. If the URL does not start with “http”, it will be prefixed with the API base URL.
methodHTTP_METHOD"POST"The HTTP method to use for the request. Defaults to “POST”.
options?SWRMutationConfiguration<T, E>undefinedThe configuration object for the mutation. See useSWRMutation Link https://swr.vercel.app/docs/mutation#api

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

NameType
orderOrderParams
options?UseOrderEntryOptions

Returns

UseOrderEntryReturn

Example

import { useOrderEntry } from "@orderly.network/hooks";
import {OrderSide, OrderType} from '@orderly.network/types';

const { formattedOrder, onSubmit, helper } = useOrderEntry({
 symbol: "PERP_ETH_USDC",
 side: OrderSide.BUY,
 order_type: OrderType.LIMIT,
 order_price: 10000,
 order_quantity: 1,
},{
 // **Note:** it's required
 watchOrderbook: true,
});

Defined in

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

useOrderEntry(symbol, side, reduceOnly): UseOrderEntryReturn

Parameters

NameType
symbolstring
sideOrderSide
reduceOnlyboolean

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

NameTypeDescription
paramsObjectOrders query params
params.excludes?CombineOrderType[]Exclude the order type Default ts []
params.includes?CombineOrderType[]Include the order type Default ts ["ALL"]
params.side?OrderSide-
params.size?number-
params.status?OrderStatus-
params.symbol?string-
options?Object-
options.keeplive?booleanKeep the state update alive
options.stopOnUnmount?booleanStop the state update when the component unmount

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

NameTypeDefault value
symbolstringundefined
initialOrderbookDataINIT_DATA
options?OrderbookOptionsundefined

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

NameTypeDescription
symbol?stringIf symbol is passed, only the position of that symbol will be returned.
options?Partial<PublicConfiguration<any, any, BareFetcher<any>>> & { calcMode?: PriceMode ; includedPendingOrder?: boolean }-

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

NameTypeDescription
dataDrawOptionsThe options to draw the poster
options?Object-
options.ratio?numberThe ratio of the poster

Returns

Object

NameType
canCopyboolean
copy() => Promise<void>
download(filename: string, type: string, encoderOptions?: number) => void
errornull | Error
ref(ref: null | HTMLCanvasElement) => void
toBlob(type?: string, encoderOptions?: number) => Promise<null | Blob>
toDataURL(type?: string, encoderOptions?: number) => string

Example

const { ref, toDataURL, toBlob, download, copy } = usePoster({
  backgroundColor: "#0b8c70",
  backgroundImg: "/images/poster_bg.png",
  color: "rgba(255, 255, 255, 0.98)",
  profitColor: "rgb(0,181,159)",
  // ...
});

Defined in

packages/hooks/src/usePoster.ts:21


usePreLoadData

usePreLoadData(): Object

Returns

Object

NameType
doneboolean
errorany

Defined in

packages/hooks/src/usePreloadData.ts:6


usePrivateDataObserver

usePrivateDataObserver(options): void

Parameters

NameType
optionsObject
options.getKeysMap(type: string) => Map<string, getKeyFunction>

Returns

void

Defined in

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


usePrivateInfiniteQuery

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

Parameters

NameType
getKeySWRInfiniteKeyLoader
options?SWRInfiniteConfiguration<any, any, BareFetcher<any>> & { formatter?: (data: any) => any }

Returns

SWRInfiniteResponse<any, any>

Defined in

packages/hooks/src/usePrivateInfiniteQuery.ts:10


usePrivateQuery

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

usePrivateQuery

Type parameters

Name
T

Parameters

NameType
querystring
options?useQueryOptions<T>

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

Name
T

Parameters

NameType
queryKey
options?useQueryOptions<T>

Returns

SWRResponse<T, any, any>

Description

for public api

Defined in

packages/hooks/src/useQuery.ts:11


useRefereeHistory

useRefereeHistory(params): any[]

Parameters

NameType
paramsParams

Returns

any[]

Defined in

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


useRefereeInfo

useRefereeInfo(params): any[]

Parameters

NameType
paramsParams

Returns

any[]

Defined in

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


useRefereeRebateSummary

useRefereeRebateSummary(params): Object

Parameters

NameType
paramsParams

Returns

Object

NameType
data?RefereeRebateSummary[]
isLoadingboolean
mutateany

Defined in

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


useReferralInfo

useReferralInfo(): Object

Returns

Object

NameType
data?ReferralInfo
errorany
getFirstRefCode() => undefined | ReferralCode
isAffiliate?boolean
isLoadingboolean
isTrader?boolean

Defined in

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


useReferralRebateSummary

useReferralRebateSummary(params): any[]

Parameters

NameType
paramsParams

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

NameType
Dataany
Errorany
SWRKeyextends Key = StrictKey

Parameters

NameType
keySWRKey

Returns

SWRResponse<Data, Error, any>

Link

https://swr.vercel.app

Example

import useSWR from 'swr'
function Profile() {
  const { data, error, isLoading } = useSWR('/api/user', fetcher)
  if (error) return <div>failed to load</div>
  if (isLoading) return <div>loading...</div>
  return <div>hello {data.name}!</div>
}

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

NameType
Dataany
Errorany
SWRKeyextends Key = StrictKey

Parameters

NameType
keySWRKey
fetchernull | Fetcher<Data, SWRKey>

Returns

SWRResponse<Data, Error, any>

Link

https://swr.vercel.app

Example

import useSWR from 'swr'
function Profile() {
  const { data, error, isLoading } = useSWR('/api/user', fetcher)
  if (error) return <div>failed to load</div>
  if (isLoading) return <div>loading...</div>
  return <div>hello {data.name}!</div>
}

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

NameType
Dataany
Errorany
SWRKeyextends Key = Key

Parameters

NameType
keySWRKey
fetchernull | Fetcher<Data, SWRKey>

Returns

SWRResponse<Data, Error, any>

Link

https://swr.vercel.app

Example

import useSWR from 'swr'
function Profile() {
  const { data, error, isLoading } = useSWR('/api/user', fetcher)
  if (error) return <div>failed to load</div>
  if (isLoading) return <div>loading...</div>
  return <div>hello {data.name}!</div>
}

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

NameType
Dataany
Errorany
SWRKeyextends Key = StrictKey
SWROptionsextends undefined | Partial<PublicConfiguration<Data, Error, Fetcher<Data, SWRKey>>> = undefined | Partial<PublicConfiguration<Data, Error, Fetcher<Data, SWRKey>>>

Parameters

NameType
keySWRKey
configSWROptions

Returns

SWRResponse<Data, Error, SWROptions>

Link

https://swr.vercel.app

Example

import useSWR from 'swr'
function Profile() {
  const { data, error, isLoading } = useSWR('/api/user', fetcher)
  if (error) return <div>failed to load</div>
  if (isLoading) return <div>loading...</div>
  return <div>hello {data.name}!</div>
}

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

NameType
Dataany
Errorany
SWRKeyextends Key = StrictKey
SWROptionsextends undefined | Partial<PublicConfiguration<Data, Error, Fetcher<Data, SWRKey>>> = undefined | Partial<PublicConfiguration<Data, Error, Fetcher<Data, SWRKey>>>

Parameters

NameType
keySWRKey
fetchernull | Fetcher<Data, SWRKey>
configSWROptions

Returns

SWRResponse<Data, Error, SWROptions>

Link

https://swr.vercel.app

Example

import useSWR from 'swr'
function Profile() {
  const { data, error, isLoading } = useSWR('/api/user', fetcher)
  if (error) return <div>failed to load</div>
  if (isLoading) return <div>loading...</div>
  return <div>hello {data.name}!</div>
}

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

NameType
Dataany
Errorany

Parameters

NameType
keyKey

Returns

SWRResponse<Data, Error, any>

Link

https://swr.vercel.app

Example

import useSWR from 'swr'
function Profile() {
  const { data, error, isLoading } = useSWR('/api/user', fetcher)
  if (error) return <div>failed to load</div>
  if (isLoading) return <div>loading...</div>
  return <div>hello {data.name}!</div>
}

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

NameType
Dataany
Errorany
SWROptionsextends undefined | Partial<PublicConfiguration<Data, Error, BareFetcher<Data>>> = undefined | Partial<PublicConfiguration<Data, Error, BareFetcher<Data>>>

Parameters

NameType
keyKey
configSWROptions

Returns

SWRResponse<Data, Error, SWROptions>

Link

https://swr.vercel.app

Example

import useSWR from 'swr'
function Profile() {
  const { data, error, isLoading } = useSWR('/api/user', fetcher)
  if (error) return <div>failed to load</div>
  if (isLoading) return <div>loading...</div>
  return <div>hello {data.name}!</div>
}

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

NameType
Dataany
Errorany
SWROptionsextends undefined | Partial<PublicConfiguration<Data, Error, BareFetcher<Data>>> = undefined | Partial<PublicConfiguration<Data, Error, BareFetcher<Data>>>

Parameters

NameType
keyKey
fetchernull | BareFetcher<Data>
configSWROptions

Returns

SWRResponse<Data, Error, SWROptions>

Link

https://swr.vercel.app

Example

import useSWR from 'swr'
function Profile() {
  const { data, error, isLoading } = useSWR('/api/user', fetcher)
  if (error) return <div>failed to load</div>
  if (isLoading) return <div>loading...</div>
  return <div>hello {data.name}!</div>
}

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

Name
T

Parameters

NameType
keystring
initialValueT

Returns

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

Defined in

packages/hooks/src/useSessionStorage.ts:4


useSettleSubscription

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

Parameters

NameType
options?Object
options.onMessage?(data: any) => void

Returns

SWRSubscriptionResponse<any, any>

Defined in

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


useSymbolLeverage

useSymbolLeverage(symbol): number | "-"

Parameters

NameType
symbolstring

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

NameTypeDescription
symbolstringThe symbol to get the price range for
side"BUY" | "SELL"-
price?numberOptional parameter to set the price

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

NameTypeDescription
positionPartial<PositionTPSLExt> & Pick<PositionTPSLExt, "symbol" | "position_qty" | "average_open_price">Position that needs to set take profit and stop loss
options?Object-
options.defaultOrder?AlgoOrderYou can set the default value for the take profit and stop loss order, it is usually used when editing order

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

NameType
symbolstring

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

NameType
options?Object
options.onMessage?(data: any) => void

Returns

SWRSubscriptionResponse<any, any>

Defined in

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


useWithdraw

useWithdraw(options?): Object

Parameters

NameType
options?UseWithdrawOptions

Returns

Object

NameType
availableBalancenumber
availableWithdrawnumber
dst{ address: undefined | string = USDC.address; chainId: number = targetChain.network_infos.chain_id; decimals: number ; network: string = targetChain.network_infos.shortName; symbol: string }
dst.addressundefined | string
dst.chainIdnumber
dst.decimalsnumber
dst.networkstring
dst.symbolstring
isLoadingboolean
maxAmountnumber
unsettledPnLnumber
withdraw(inputs: { allowCrossChainWithdraw: boolean ; amount: string ; chainId: number ; token: string }) => Promise<any>

Defined in

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


useWsStatus

useWsStatus(): WsNetworkStatus

Returns

WsNetworkStatus

Defined in

packages/hooks/src/useWsStatus.ts:10