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
| Name | Type |
|---|---|
T | extends NetworkId | undefined = undefined |
K | extends keyof Chain | undefined = undefined |
Defined in
packages/hooks/src/orderly/useChains.ts:19CollateralOutputs
Ƭ CollateralOutputs:Object
Type declaration
| Name | Type |
|---|---|
accountInfo? | AccountInfo |
availableBalance | number |
freeCollateral | number |
positions | Position[] |
totalCollateral | number |
totalValue | number |
unsettledPnL | number |
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
| Name | Type | Description |
|---|---|---|
backgroundColor? | string | - |
backgroundImg? | string | - |
brandColor? | string | The brand color of the application |
color? | string | Color of common text |
data? | posterDataSource | - |
fontFamily? | string | - |
layout? | PosterLayoutConfig | - |
lossColor? | string | Lose color |
profitColor? | string | Profit color |
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
| Name | Type |
|---|---|
asks | OrderBookItem[] |
bids | OrderBookItem[] |
Defined in
packages/hooks/src/orderly/useOrderbookStream.ts:14OrderbookOptions
Ƭ OrderbookOptions:Object
Configuration for the Order Book
Type declaration
| Name | Type | Description |
|---|---|---|
level? | number | Indicates the number of data entries to return for ask/bid, default is 10 |
padding? | boolean | Whether 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:222PosterLayoutConfig
Ƭ PosterLayoutConfig:Object
Type declaration
| Name | Type |
|---|---|
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:69SWRConfiguration
Ƭ SWRConfiguration<Data, Error, Fn>: Partial<PublicConfiguration<Data, Error, Fn>>
Type parameters
| Name | Type |
|---|---|
Data | any |
Error | any |
Fn | extends 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: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
| Name | Type |
|---|---|
error | any |
findByChainId | (chainId: number, field?: string) => Chain | undefined |
Defined in
packages/hooks/src/orderly/useChains.ts:41UseOrderEntryMetaState
Ƭ UseOrderEntryMetaState:Object
Type declaration
| Name | Type |
|---|---|
dirty | { [P in keyof OrderEntity]?: boolean } | null | undefined |
errors | { [P in keyof OrderEntity]?: Object } | null | undefined |
submitted | boolean |
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
| Name | Type |
|---|---|
config | ConfigStore |
Returns
filteredChains
Defined in
packages/hooks/src/orderlyContext.ts:16filteredChains
Ƭ filteredChains:Object
Type declaration
| Name | Type |
|---|---|
mainnet? | ChainConfig[] |
testnet? | ChainConfig[] |
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
| Name | Type |
|---|---|
T | extends (…args: any) => ReturnType<T> |
Parameters
| Name | Type | Description |
|---|---|---|
func | T | The function to debounce. |
wait? | number | The number of milliseconds to delay; if omitted, requestAnimationFrame is used (if available, otherwise it will be setTimeout(…,0)). |
options? | Options | The options object. Controls if func should be invoked on the leading edge of the timeout. |
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
| Name | Type |
|---|---|
T | extends (…args: any) => ReturnType<T> |
Parameters
| Name | Type | Description |
|---|---|---|
func | T | The function to throttle. |
wait? | number | The number of milliseconds to throttle invocations to; if omitted, requestAnimationFrame is used (if available, otherwise it will be setTimeout(…,0)). |
options? | CallOptions | The options object. |
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
| Name | Type |
|---|---|
props | PropsWithChildren<RequireAtLeastOne<ConfigProviderProps, "brokerId" | "configStore">> |
Returns
null | Element
Defined in
packages/hooks/src/configProvider.tsx:60OrderlyProvider
▸ OrderlyProvider(props): ReactNode
NOTE: Exotic components are not callable.
Parameters
| Name | Type |
|---|---|
props | ProviderProps<OrderlyConfigContextState> |
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
| Name | Type |
|---|---|
props | PropsWithChildren<{ 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:563StatusProvider
▸ StatusProvider(props, context?): ReactNode
Parameters
| Name | Type |
|---|---|
props | Object |
props.children? | ReactNode |
context? | any |
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
| Name | Type |
|---|---|
price? | string | number |
qty? | string | number |
minNotional? | number |
Returns
string | undefined
Defined in
packages/hooks/src/utils/createOrder.ts:3cleanStringStyle
▸ cleanStringStyle(str): string
Parameters
| Name | Type |
|---|---|
str | string | number |
Returns
string
Defined in
packages/hooks/src/utils/orderEntryHelper.ts:29parseJSON
▸ parseJSON<T>(value): T | undefined
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
value | null | string |
Returns
T | undefined
Defined in
packages/hooks/src/utils/json.ts:1unstable_serialize
▸ unstable_serialize(key): string
Parameters
| Name | Type |
|---|---|
key | Key |
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
| Name | Type |
|---|---|
account | Account |
createAccount | () => Promise<any> |
createOrderlyKey | (remember: boolean) => Promise<any> |
state | AccountState |
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
| Name | Type | Default value |
|---|---|---|
initialValue | boolean | false |
Returns
[boolean, { setFalse: () => void ; setTrue: () => void ; toggle: () => void }]
Defined in
packages/hooks/src/useBoolean.ts:3useChain
▸ useChain(token): Object
Parameters
| Name | Type |
|---|---|
token | string |
Returns
Object
| Name | Type |
|---|---|
chains | null | Chain |
isLoading | boolean |
Defined in
packages/hooks/src/orderly/useChain.ts:5useChains
▸ useChains(networkId?, options?): [Chains<undefined, undefined>, UseChainsReturnObject]
Parameters
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
T | extends undefined | NetworkId |
K | extends undefined | UseChainsOptions |
Parameters
| Name | Type |
|---|---|
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:51useCheckReferralCode
▸ useCheckReferralCode(code?): Object
Parameters
| Name | Type |
|---|---|
code? | string |
Returns
Object
| Name | Type |
|---|---|
error | any |
isExist? | boolean |
isLoading | boolean |
Defined in
packages/hooks/src/referral/useCheckReferralCode.ts:4useCollateral
▸ useCollateral(options?): CollateralOutputs
Parameters
| Name | Type | Description |
|---|---|---|
options | Object | - |
options.dp | number | decimal precision |
Returns
CollateralOutputs
Defined in
packages/hooks/src/orderly/useCollateral.ts:30useCommission
▸ useCommission(options?): any[]
Parameters
| Name | Type |
|---|---|
options? | Object |
options.size? | number |
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
| Name | Type |
|---|---|
T | string |
Parameters
| Name | Type |
|---|---|
key | ConfigKey |
defaultValue? | T |
Returns
T
Defined in
packages/hooks/src/useConfig.ts:6useConstant
▸ useConstant<T>(fn): T
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
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:1useDaily
▸ useDaily(options?): Object
Parameters
| Name | Type |
|---|---|
options? | Object |
options.endDate? | Date |
options.startDate? | Date |
Returns
Object
| Name | Type |
|---|---|
data? | DayliVolume[] |
mutate | any |
Defined in
packages/hooks/src/referral/useDaily.ts:5useDebounce
▸ useDebounce<T>(value, delay, options?): [T, DebouncedState<(value: T) => void>]
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
value | T |
delay | number |
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:2useDeposit
▸ useDeposit(options?): Object
Parameters
| Name | Type |
|---|---|
options? | useDepositOptions |
Returns
Object
| Name | Type |
|---|---|
allowance | string |
allowanceRevalidating | boolean |
approve | (amount?: string) => Promise<undefined | void> |
balance | string |
balanceRevalidating | boolean |
deposit | () => Promise<any> |
depositFee | bigint |
depositFeeRevalidating | boolean |
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.address | undefined | string |
dst.chainId | number |
dst.decimals | undefined | number |
dst.network | string |
dst.symbol | string |
fetchBalance | (address: string, decimals?: number) => Promise<string> |
fetchBalances | (tokens: TokenInfo[]) => Promise<void> |
isNativeToken | boolean |
quantity | string |
setQuantity | Dispatch<SetStateAction<string>> |
Defined in
packages/hooks/src/orderly/useDeposit.ts:27useDistribution
▸ useDistribution(params): any
Parameters
| Name | Type |
|---|---|
params | Params |
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
| Name | Type |
|---|---|
symbol | string |
Returns
Object
| Name | Type |
|---|---|
countDown | string |
est_funding_rate | string |
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:6useGetReferralCode
▸ useGetReferralCode(accountId?): Object
Parameters
| Name | Type |
|---|---|
accountId? | string |
Returns
Object
| Name | Type |
|---|---|
error | any |
isLoading | boolean |
referral_code? | string |
Defined in
packages/hooks/src/referral/useGetReferralCode.ts:3useHoldingStream
▸ useHoldingStream():Object
Returns
Object
| Name | Type |
|---|---|
data | undefined | Holding[] |
isLoading | boolean |
usdc | undefined | Holding |
Defined in
packages/hooks/src/orderly/useHoldingStream.ts:7useIndexPrice
▸ useIndexPrice(symbol): SWRSubscriptionResponse<any, any>
Parameters
| Name | Type |
|---|---|
symbol | string |
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
| Name | Type |
|---|---|
T | T |
R | any |
Parameters
| Name | Type |
|---|---|
query | Key |
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:15useLeverage
▸ useLeverage():any
Returns
any
Defined in
packages/hooks/src/orderly/useLeverage.ts:7useLocalStorage
▸ useLocalStorage<T>(key, initialValue): [any, (value: T) => void]
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
key | string |
initialValue | T |
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
| Name | Type |
|---|---|
symbol | string |
Returns
Object
| Name | Type |
|---|---|
data | number |
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
| Name | Type |
|---|---|
symbol | string |
options | MarketTradeStreamOptions |
Returns
Object
| Name | Type |
|---|---|
data | Trade[] |
isLoading | boolean |
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
| Name | Type |
|---|---|
type | MarketsType |
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
| Name | Type |
|---|---|
data | null | Ticker[] |
Defined in
packages/hooks/src/orderly/useMarketsStream.ts:8useMaxQty
▸ useMaxQty(symbol, side, reduceOnly?): number
Parameters
| Name | Type | Default value |
|---|---|---|
symbol | string | undefined |
side | OrderSide | undefined |
reduceOnly | boolean | false |
Returns
number
the maximum quantity available for trading in USD
Defined in
packages/hooks/src/orderly/useMaxQty.ts:23useMediaQuery
▸ useMediaQuery(query): boolean
Parameters
| Name | Type |
|---|---|
query | string |
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
| Name |
|---|
T |
E |
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
url | string | undefined | The URL to send the request to. If the URL does not start with “http”, it will be prefixed with the API base URL. |
method | HTTP_METHOD | "POST" | The HTTP method to use for the request. Defaults to “POST”. |
options? | SWRMutationConfiguration<T, E> | undefined | The 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:53useOrderEntry
▸ useOrderEntry(order, options?): UseOrderEntryReturn
Create Order
Parameters
| Name | Type |
|---|---|
order | OrderParams |
options? | UseOrderEntryOptions |
Returns
UseOrderEntryReturn
Example
Defined in
packages/hooks/src/orderly/useOrderEntry.ts:98 ▸ useOrderEntry(symbol, side, reduceOnly): UseOrderEntryReturn
Parameters
| Name | Type |
|---|---|
symbol | string |
side | OrderSide |
reduceOnly | boolean |
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
| Name | Type | Description |
|---|---|---|
params | Object | Orders 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? | boolean | Keep the state update alive |
options.stopOnUnmount? | boolean | Stop 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: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
| Name | Type | Default value |
|---|---|---|
symbol | string | undefined |
initial | OrderbookData | INIT_DATA |
options? | OrderbookOptions | undefined |
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
| Name | Type | Description |
|---|---|---|
symbol? | string | If 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: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
| Name | Type | Description |
|---|---|---|
data | DrawOptions | The options to draw the poster |
options? | Object | - |
options.ratio? | number | The ratio of the poster |
Returns
Object
| Name | Type |
|---|---|
canCopy | boolean |
copy | () => Promise<void> |
download | (filename: string, type: string, encoderOptions?: number) => void |
error | null | Error |
ref | (ref: null | HTMLCanvasElement) => void |
toBlob | (type?: string, encoderOptions?: number) => Promise<null | Blob> |
toDataURL | (type?: string, encoderOptions?: number) => string |
Example
Defined in
packages/hooks/src/usePoster.ts:21usePreLoadData
▸ usePreLoadData():Object
Returns
Object
| Name | Type |
|---|---|
done | boolean |
error | any |
Defined in
packages/hooks/src/usePreloadData.ts:6usePrivateDataObserver
▸ usePrivateDataObserver(options): void
Parameters
| Name | Type |
|---|---|
options | Object |
options.getKeysMap | (type: string) => Map<string, getKeyFunction> |
Returns
void
Defined in
packages/hooks/src/orderly/usePrivateDataObserver.ts:14usePrivateInfiniteQuery
▸ usePrivateInfiniteQuery(getKey, options?): SWRInfiniteResponse<any, any>
Parameters
| Name | Type |
|---|---|
getKey | SWRInfiniteKeyLoader |
options? | SWRInfiniteConfiguration<any, any, BareFetcher<any>> & { formatter?: (data: any) => any } |
Returns
SWRInfiniteResponse<any, any>
Defined in
packages/hooks/src/usePrivateInfiniteQuery.ts:10usePrivateQuery
▸ usePrivateQuery<T>(query, options?): SWRResponse<T, any, any>
usePrivateQuery
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
query | string |
options? | useQueryOptions<T> |
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
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
query | Key |
options? | useQueryOptions<T> |
Returns
SWRResponse<T, any, any>
Description
for public api
Defined in
packages/hooks/src/useQuery.ts:11useRefereeHistory
▸ useRefereeHistory(params): any[]
Parameters
| Name | Type |
|---|---|
params | Params |
Returns
any[]
Defined in
packages/hooks/src/referral/useRefereeHistory.ts:16useRefereeInfo
▸ useRefereeInfo(params): any[]
Parameters
| Name | Type |
|---|---|
params | Params |
Returns
any[]
Defined in
packages/hooks/src/referral/useRefereeInfo.ts:17useRefereeRebateSummary
▸ useRefereeRebateSummary(params): Object
Parameters
| Name | Type |
|---|---|
params | Params |
Returns
Object
| Name | Type |
|---|---|
data? | RefereeRebateSummary[] |
isLoading | boolean |
mutate | any |
Defined in
packages/hooks/src/referral/useRefereeRebateSummary.ts:10useReferralInfo
▸ useReferralInfo():Object
Returns
Object
| Name | Type |
|---|---|
data? | ReferralInfo |
error | any |
getFirstRefCode | () => undefined | ReferralCode |
isAffiliate? | boolean |
isLoading | boolean |
isTrader? | boolean |
Defined in
packages/hooks/src/referral/useReferralInfo.tsx:7useReferralRebateSummary
▸ useReferralRebateSummary(params): any[]
Parameters
| Name | Type |
|---|---|
params | Params |
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
| Name | Type |
|---|---|
Data | any |
Error | any |
SWRKey | extends Key = StrictKey |
Parameters
| Name | Type |
|---|---|
key | SWRKey |
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
| Name | Type |
|---|---|
Data | any |
Error | any |
SWRKey | extends Key = StrictKey |
Parameters
| Name | Type |
|---|---|
key | SWRKey |
fetcher | null | Fetcher<Data, SWRKey> |
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
| Name | Type |
|---|---|
Data | any |
Error | any |
SWRKey | extends Key = Key |
Parameters
| Name | Type |
|---|---|
key | SWRKey |
fetcher | null | Fetcher<Data, SWRKey> |
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
| Name | Type |
|---|---|
Data | any |
Error | any |
SWRKey | extends Key = StrictKey |
SWROptions | extends undefined | Partial<PublicConfiguration<Data, Error, Fetcher<Data, SWRKey>>> = undefined | Partial<PublicConfiguration<Data, Error, Fetcher<Data, SWRKey>>> |
Parameters
| Name | Type |
|---|---|
key | SWRKey |
config | SWROptions |
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
| Name | Type |
|---|---|
Data | any |
Error | any |
SWRKey | extends Key = StrictKey |
SWROptions | extends undefined | Partial<PublicConfiguration<Data, Error, Fetcher<Data, SWRKey>>> = undefined | Partial<PublicConfiguration<Data, Error, Fetcher<Data, SWRKey>>> |
Parameters
| Name | Type |
|---|---|
key | SWRKey |
fetcher | null | Fetcher<Data, SWRKey> |
config | SWROptions |
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
| Name | Type |
|---|---|
Data | any |
Error | any |
Parameters
| Name | Type |
|---|---|
key | Key |
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
| Name | Type |
|---|---|
Data | any |
Error | any |
SWROptions | extends undefined | Partial<PublicConfiguration<Data, Error, BareFetcher<Data>>> = undefined | Partial<PublicConfiguration<Data, Error, BareFetcher<Data>>> |
Parameters
| Name | Type |
|---|---|
key | Key |
config | SWROptions |
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
| Name | Type |
|---|---|
Data | any |
Error | any |
SWROptions | extends undefined | Partial<PublicConfiguration<Data, Error, BareFetcher<Data>>> = undefined | Partial<PublicConfiguration<Data, Error, BareFetcher<Data>>> |
Parameters
| Name | Type |
|---|---|
key | Key |
fetcher | null | BareFetcher<Data> |
config | SWROptions |
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
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
key | string |
initialValue | T |
Returns
[T, (data: any) => void]
Defined in
packages/hooks/src/useSessionStorage.ts:4useSettleSubscription
▸ useSettleSubscription(options?): SWRSubscriptionResponse<any, any>
Parameters
| Name | Type |
|---|---|
options? | Object |
options.onMessage? | (data: any) => void |
Returns
SWRSubscriptionResponse<any, any>
Defined in
packages/hooks/src/orderly/useSettleSubscription.ts:4useSymbolLeverage
▸ useSymbolLeverage(symbol): number | "-"
Parameters
| Name | Type |
|---|---|
symbol | string |
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
| Name | Type | Description |
|---|---|---|
symbol | string | The symbol to get the price range for |
side | "BUY" | "SELL" | - |
price? | number | Optional 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: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
| Name | Type | Description |
|---|---|---|
position | Partial<PositionTPSLExt> & Pick<PositionTPSLExt, "symbol" | "position_qty" | "average_open_price"> | Position that needs to set take profit and stop loss |
options? | Object | - |
options.defaultOrder? | AlgoOrder | You 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:4useTickerStream
▸ useTickerStream(symbol): MarketInfo & { 24h_change?: Decimal ; change?: Decimal }
Parameters
| Name | Type |
|---|---|
symbol | string |
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
| Name | Type |
|---|---|
options? | Object |
options.onMessage? | (data: any) => void |
Returns
SWRSubscriptionResponse<any, any>
Defined in
packages/hooks/src/orderly/useWalletSubscription.ts:4useWithdraw
▸ useWithdraw(options?): Object
Parameters
| Name | Type |
|---|---|
options? | UseWithdrawOptions |
Returns
Object
| Name | Type |
|---|---|
availableBalance | number |
availableWithdraw | number |
dst | { address: undefined | string = USDC.address; chainId: number = targetChain.network_infos.chain_id; decimals: number ; network: string = targetChain.network_infos.shortName; symbol: string } |
dst.address | undefined | string |
dst.chainId | number |
dst.decimals | number |
dst.network | string |
dst.symbol | string |
isLoading | boolean |
maxAmount | number |
unsettledPnL | number |
withdraw | (inputs: { allowCrossChainWithdraw: boolean ; amount: string ; chainId: number ; token: string }) => Promise<any> |
Defined in
packages/hooks/src/orderly/useWithdraw.ts:16useWsStatus
▸ useWsStatus():WsNetworkStatus
Returns
WsNetworkStatus