Chain
& { nativeToken?
: TokenInfo
}
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
[] }
Name | Type |
---|---|
T | extends NetworkId | undefined = undefined |
K | extends keyof Chain | undefined = undefined |
Object
Name | Type |
---|---|
accountInfo? | AccountInfo |
availableBalance | number |
freeCollateral | number |
positions | Position [] |
totalCollateral | number |
totalValue | number |
unsettledPnL | number |
Partial
<AlgoOrderEntity
<TP_SL
> & { sl_offset
: number
; sl_offset_percentage
: number
; sl_pnl
: number
; tp_offset
: number
; tp_offset_percentage
: number
; tp_pnl
: number
}>
Object
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 |
number
[]
Required
<Pick
<OrderEntity
, "side"
| "order_type"
| "symbol"
>> & Partial
<Omit
<OrderEntity
, "side"
| "symbol"
| "order_type"
>>
Object
Name | Type |
---|---|
asks | OrderBookItem [] |
bids | OrderBookItem [] |
Object
Configuration for the Order Book
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 |
Object
Name | Type |
---|---|
domain? | layoutInfo |
informations? | layoutInfo & { labelColor? : string } |
message? | layoutInfo |
position? | layoutInfo |
unrealizedPnl? | layoutInfo & { secondaryColor : string ; secondaryFontSize : number } |
updateTime? | layoutInfo |
Data
, Error
, Fn
>: Partial
<PublicConfiguration
<Data
, Error
, Fn
>>
Name | Type |
---|---|
Data | any |
Error | any |
Fn | extends BareFetcher <any > = BareFetcher <any > |
filter?
: (item
: Chain
) => boolean
; pick?
: "dexs"
| "network_infos"
| "token_infos"
} & SWRConfiguration
Object
Name | Type |
---|---|
error | any |
findByChainId | (chainId : number , field? : string ) => Chain | undefined |
Object
Name | Type |
---|---|
dirty | { [P in keyof OrderEntity]?: boolean } | null | undefined |
errors | { [P in keyof OrderEntity]?: Object } | null | undefined |
submitted | boolean |
filteredChains
| chainFilterFunc
config
: ConfigStore
) => filteredChains
config
): filteredChains
Name | Type |
---|---|
config | ConfigStore |
filteredChains
Object
Name | Type |
---|---|
mainnet? | ChainConfig [] |
testnet? | ChainConfig [] |
Const
DefaultLayoutConfig: PosterLayoutConfig
Const
OrderlyContext: Context
<OrderlyConfigContextState
>
Const
StatusContext: Context
<StatusContextState
>
Const
WalletConnectorContext: Context
<WalletConnectorContextState
>
"1.5.7"
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
.
Name | Type |
---|---|
T | extends (…args : any ) => ReturnType <T > |
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. |
DebouncedState
<T
>
Returns the new debounced function.
Example
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
.
Name | Type |
---|---|
T | extends (…args : any ) => ReturnType <T > |
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. |
DebouncedState
<T
>
Returns the new throttled function.
Example
props
): null
| Element
Name | Type |
---|---|
props | PropsWithChildren <RequireAtLeastOne <ConfigProviderProps , "brokerId" | "configStore" >> |
null
| Element
props
): ReactNode
NOTE: Exotic components are not callable.
Name | Type |
---|---|
props | ProviderProps <OrderlyConfigContextState > |
ReactNode
props
, context?
): ReactNode
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 |
ReactNode
props
, context?
): ReactNode
Name | Type |
---|---|
props | Object |
props.children? | ReactNode |
context? | any |
ReactNode
price?
, qty?
, minNotional?
): string
| undefined
Name | Type |
---|---|
price? | string | number |
qty? | string | number |
minNotional? | number |
string
| undefined
str
): string
Name | Type |
---|---|
str | string | number |
string
T
>(value
): T
| undefined
Name |
---|
T |
Name | Type |
---|---|
value | null | string |
T
| undefined
key
): string
Name | Type |
---|---|
key | Key |
string
Object
Object
Name | Type |
---|---|
account | Account |
createAccount | () => Promise <any > |
createOrderlyKey | (remember : boolean ) => Promise <any > |
state | AccountState |
SWRResponse
<AccountInfo
, any
, any
>
SWRResponse
<AccountInfo
, any
, any
>
Account
Account
initialValue?
): [boolean
, { setFalse
: () => void
; setTrue
: () => void
; toggle
: () => void
}]
Name | Type | Default value |
---|---|---|
initialValue | boolean | false |
boolean
, { setFalse
: () => void
; setTrue
: () => void
; toggle
: () => void
}]
token
): Object
Name | Type |
---|---|
token | string |
Object
Name | Type |
---|---|
chains | null | Chain |
isLoading | boolean |
networkId?
, options?
): [Chains
<undefined
, undefined
>, UseChainsReturnObject
]
Name | Type |
---|---|
networkId? | undefined |
options? | undefined |
Chains
<undefined
, undefined
>, UseChainsReturnObject
]
T
, K
>(networkId?
, options?
): [Chains
<T
, K
extends UseChainsOptions
? K
["pick"
] extends keyof Chain
? K
["pick"
] : undefined
: undefined
>, UseChainsReturnObject
]
Name | Type |
---|---|
T | extends undefined | NetworkId |
K | extends undefined | UseChainsOptions |
Name | Type |
---|---|
networkId? | T |
options? | K |
Chains
<T
, K
extends UseChainsOptions
? K
["pick"
] extends keyof Chain
? K
["pick"
] : undefined
: undefined
>, UseChainsReturnObject
]
code?
): Object
Name | Type |
---|---|
code? | string |
Object
Name | Type |
---|---|
error | any |
isExist? | boolean |
isLoading | boolean |
options?
): CollateralOutputs
Name | Type | Description |
---|---|---|
options | Object | - |
options.dp | number | decimal precision |
CollateralOutputs
options?
): any
[]
Name | Type |
---|---|
options? | Object |
options.size? | number |
any
[]
ConfigStore
ConfigStore
T
>(key
, defaultValue?
): T
Name | Type |
---|---|
T | string |
Name | Type |
---|---|
key | ConfigKey |
defaultValue? | T |
T
T
>(fn
): T
Name |
---|
T |
Name | Type |
---|---|
fn | () => T |
T
options?
): Object
Name | Type |
---|---|
options? | Object |
options.endDate? | Date |
options.startDate? | Date |
Object
Name | Type |
---|---|
data? | DayliVolume [] |
mutate | any |
T
>(value
, delay
, options?
): [T
, DebouncedState
<(value
: T
) => void
>]
Name |
---|
T |
Name | Type |
---|---|
value | T |
delay | number |
options? | Object |
options.equalityFn? | (left : T , right : T ) => boolean |
options.leading? | boolean |
options.maxWait? | number |
options.trailing? | boolean |
T
, DebouncedState
<(value
: T
) => void
>]
options?
): Object
Name | Type |
---|---|
options? | useDepositOptions |
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 >> |
params
): any
Name | Type |
---|---|
params | Params |
any
EventEmitter
<string
| symbol
, any
>
EventEmitter
<string
| symbol
, any
>
symbol
): Object
Name | Type |
---|---|
symbol | string |
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 |
accountId?
): Object
Name | Type |
---|---|
accountId? | string |
Object
Name | Type |
---|---|
error | any |
isLoading | boolean |
referral_code? | string |
Object
Object
Name | Type |
---|---|
data | undefined | Holding [] |
isLoading | boolean |
usdc | undefined | Holding |
symbol
): SWRSubscriptionResponse
<any
, any
>
Name | Type |
---|---|
symbol | string |
SWRSubscriptionResponse
<any
, any
>
T
, R
>(query
, options?
): SWRMutationResponse
<any
, any
, Key
, never
>
useQuery
Name | Type |
---|---|
T | T |
R | any |
Name | Type |
---|---|
query | Key |
options? | SWRMutationConfiguration <any , any > & { formatter? : (data : any ) => R ; init? : RequestInit } |
SWRMutationResponse
<any
, any
, Key
, never
>
Description
for public api
any
any
T
>(key
, initialValue
): [any
, (value
: T
) => void
]
Name |
---|
T |
Name | Type |
---|---|
key | string |
initialValue | T |
any
, (value
: T
) => void
]
MarginRatioReturn
MarginRatioReturn
symbol
): Object
Name | Type |
---|---|
symbol | string |
Object
Name | Type |
---|---|
data | number |
SWRSubscriptionResponse
<Record
<string
, number
>, any
>
SWRSubscriptionResponse
<Record
<string
, number
>, any
>
symbol
, options?
): Object
Name | Type |
---|---|
symbol | string |
options | MarketTradeStreamOptions |
Object
Name | Type |
---|---|
data | Trade [] |
isLoading | boolean |
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
}]
Name | Type |
---|---|
type | MarketsType |
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
}]
Object
Object
Name | Type |
---|---|
data | null | Ticker [] |
symbol
, side
, reduceOnly?
): number
Name | Type | Default value |
---|---|---|
symbol | string | undefined |
side | OrderSide | undefined |
reduceOnly | boolean | false |
number
the maximum quantity available for trading in USD
query
): boolean
Name | Type |
---|---|
query | string |
boolean
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.
Name |
---|
T |
E |
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 |
data
: null
| Record
<string
, any
>, params?
: Record
<string
, any
>, options?
: SWRMutationConfiguration
<T
, E
>) => Promise
<any
>, { data
: any
; error
: undefined
| E
; isMutating
: boolean
; reset
: () => void
}]
order
, options?
): UseOrderEntryReturn
Create Order
Name | Type |
---|---|
order | OrderParams |
options? | UseOrderEntryOptions |
UseOrderEntryReturn
Example
symbol
, side
, reduceOnly
): UseOrderEntryReturn
Name | Type |
---|---|
symbol | string |
side | OrderSide |
reduceOnly | boolean |
UseOrderEntryReturn
Deprecated
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
> }]
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 |
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
> }]
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
})[]
Name | Type | Default value |
---|---|---|
symbol | string | undefined |
initial | OrderbookData | INIT_DATA |
options? | OrderbookOptions | undefined |
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
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 }]
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 } | - |
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 }]
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.
Name | Type | Description |
---|---|---|
data | DrawOptions | The options to draw the poster |
options? | Object | - |
options.ratio? | number | The ratio of the poster |
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
Object
Object
Name | Type |
---|---|
done | boolean |
error | any |
options
): void
Name | Type |
---|---|
options | Object |
options.getKeysMap | (type : string ) => Map <string , getKeyFunction > |
void
getKey
, options?
): SWRInfiniteResponse
<any
, any
>
Name | Type |
---|---|
getKey | SWRInfiniteKeyLoader |
options? | SWRInfiniteConfiguration <any , any , BareFetcher <any >> & { formatter? : (data : any ) => any } |
SWRInfiniteResponse
<any
, any
>
T
>(query
, options?
): SWRResponse
<T
, any
, any
>
usePrivateQuery
Name |
---|
T |
Name | Type |
---|---|
query | string |
options? | useQueryOptions <T > |
SWRResponse
<T
, any
, any
>
Description
for private api
T
>(query
, options?
): SWRResponse
<T
, any
, any
>
useQuery
Name |
---|
T |
Name | Type |
---|---|
query | Key |
options? | useQueryOptions <T > |
SWRResponse
<T
, any
, any
>
Description
for public api
params
): any
[]
Name | Type |
---|---|
params | Params |
any
[]
params
): any
[]
Name | Type |
---|---|
params | Params |
any
[]
params
): Object
Name | Type |
---|---|
params | Params |
Object
Name | Type |
---|---|
data? | RefereeRebateSummary [] |
isLoading | boolean |
mutate | any |
Object
Object
Name | Type |
---|---|
data? | ReferralInfo |
error | any |
getFirstRefCode | () => undefined | ReferralCode |
isAffiliate? | boolean |
isLoading | boolean |
isTrader? | boolean |
params
): any
[]
Name | Type |
---|---|
params | Params |
any
[]
Data
, Error
, SWRKey
>(key
): SWRResponse
<Data
, Error
, any
>
A hook to fetch data.
Name | Type |
---|---|
Data | any |
Error | any |
SWRKey | extends Key = StrictKey |
Name | Type |
---|---|
key | SWRKey |
SWRResponse
<Data
, Error
, any
>
Link
https://swr.vercel.app
Example
Data
, Error
, SWRKey
>(key
, fetcher
): SWRResponse
<Data
, Error
, any
>
A hook to fetch data.
Name | Type |
---|---|
Data | any |
Error | any |
SWRKey | extends Key = StrictKey |
Name | Type |
---|---|
key | SWRKey |
fetcher | null | Fetcher <Data , SWRKey > |
SWRResponse
<Data
, Error
, any
>
Link
https://swr.vercel.app
Example
Data
, Error
, SWRKey
>(key
, fetcher
): SWRResponse
<Data
, Error
, any
>
A hook to fetch data.
Name | Type |
---|---|
Data | any |
Error | any |
SWRKey | extends Key = Key |
Name | Type |
---|---|
key | SWRKey |
fetcher | null | Fetcher <Data , SWRKey > |
SWRResponse
<Data
, Error
, any
>
Link
https://swr.vercel.app
Example
Data
, Error
, SWRKey
, SWROptions
>(key
, config
): SWRResponse
<Data
, Error
, SWROptions
>
A hook to fetch data.
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 >>> |
Name | Type |
---|---|
key | SWRKey |
config | SWROptions |
SWRResponse
<Data
, Error
, SWROptions
>
Link
https://swr.vercel.app
Example
Data
, Error
, SWRKey
, SWROptions
>(key
, fetcher
, config
): SWRResponse
<Data
, Error
, SWROptions
>
A hook to fetch data.
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 >>> |
Name | Type |
---|---|
key | SWRKey |
fetcher | null | Fetcher <Data , SWRKey > |
config | SWROptions |
SWRResponse
<Data
, Error
, SWROptions
>
Link
https://swr.vercel.app
Example
Data
, Error
>(key
): SWRResponse
<Data
, Error
, any
>
A hook to fetch data.
Name | Type |
---|---|
Data | any |
Error | any |
Name | Type |
---|---|
key | Key |
SWRResponse
<Data
, Error
, any
>
Link
https://swr.vercel.app
Example
Data
, Error
, SWROptions
>(key
, config
): SWRResponse
<Data
, Error
, SWROptions
>
A hook to fetch data.
Name | Type |
---|---|
Data | any |
Error | any |
SWROptions | extends undefined | Partial <PublicConfiguration <Data , Error , BareFetcher <Data >>> = undefined | Partial <PublicConfiguration <Data , Error , BareFetcher <Data >>> |
Name | Type |
---|---|
key | Key |
config | SWROptions |
SWRResponse
<Data
, Error
, SWROptions
>
Link
https://swr.vercel.app
Example
Data
, Error
, SWROptions
>(key
, fetcher
, config
): SWRResponse
<Data
, Error
, SWROptions
>
A hook to fetch data.
Name | Type |
---|---|
Data | any |
Error | any |
SWROptions | extends undefined | Partial <PublicConfiguration <Data , Error , BareFetcher <Data >>> = undefined | Partial <PublicConfiguration <Data , Error , BareFetcher <Data >>> |
Name | Type |
---|---|
key | Key |
fetcher | null | BareFetcher <Data > |
config | SWROptions |
SWRResponse
<Data
, Error
, SWROptions
>
Link
https://swr.vercel.app
Example
FullConfiguration
<any
, any
, BareFetcher
<unknown
>>
FullConfiguration
<any
, any
, BareFetcher
<unknown
>>
T
>(key
, initialValue
): [T
, (data
: any
) => void
]
Name |
---|
T |
Name | Type |
---|---|
key | string |
initialValue | T |
T
, (data
: any
) => void
]
options?
): SWRSubscriptionResponse
<any
, any
>
Name | Type |
---|---|
options? | Object |
options.onMessage? | (data : any ) => void |
SWRSubscriptionResponse
<any
, any
>
symbol
): number
| "-"
Name | Type |
---|---|
symbol | string |
number
| "-"
symbol
, side
, price?
): undefined
| PriceRange
Get the price range for the specified symbol with an optional price
Name | Type | Description |
---|---|---|
symbol | string | The symbol to get the price range for |
side | "BUY" | "SELL" | - |
price? | number | Optional parameter to set the price |
undefined
| PriceRange
PriceRange | undefined - Returns the PriceRange representing the price range or undefined
isNil
: boolean
}
isNil
: boolean
}
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
>> }]
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 |
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
>> }]
symbol
): MarketInfo
& { 24h_change?
: Decimal
; change?
: Decimal
}
Name | Type |
---|---|
symbol | string |
MarketInfo
& { 24h_change?
: Decimal
; change?
: Decimal
}
WS
WS
WalletConnectorContextState
WalletConnectorContextState
options?
): SWRSubscriptionResponse
<any
, any
>
Name | Type |
---|---|
options? | Object |
options.onMessage? | (data : any ) => void |
SWRSubscriptionResponse
<any
, any
>
options?
): Object
Name | Type |
---|---|
options? | UseWithdrawOptions |
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 > |
WsNetworkStatus
WsNetworkStatus