chore(): tidying, consolidate repetitive types
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
export * from './account-asset';
|
||||
export * from './copy-trading';
|
||||
export * from './contract';
|
||||
export * from './linear';
|
||||
export * from './inverse';
|
||||
export * from './spot';
|
||||
@@ -8,5 +9,5 @@ export * from './usdc-options';
|
||||
export * from './usdc-shared';
|
||||
export * from './unified-margin';
|
||||
export * from './v5-market';
|
||||
export * from './contract';
|
||||
export * from './v5-position';
|
||||
export * from './v5-trade';
|
||||
|
||||
10
src/types/request/v5-position.ts
Normal file
10
src/types/request/v5-position.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { CategoryV5 } from '../v5-shared';
|
||||
|
||||
export interface PositionInfoParamsV5 {
|
||||
category: CategoryV5;
|
||||
symbol?: string;
|
||||
baseCoin?: string;
|
||||
settleCoin?: string;
|
||||
limit?: number;
|
||||
cursor?: string;
|
||||
}
|
||||
@@ -5,4 +5,5 @@ export * from './spot';
|
||||
export * from './usdt-perp';
|
||||
export * from './unified-margin';
|
||||
export * from './v5-market';
|
||||
export * from './v5-position';
|
||||
export * from './v5-trade';
|
||||
|
||||
@@ -1,64 +1,37 @@
|
||||
import { CategoryV5 } from '../v5-shared';
|
||||
|
||||
/**
|
||||
* Next page cursor does not exist for spot!
|
||||
*/
|
||||
export interface PaginatedListV5<T> {
|
||||
nextPageCursor: string;
|
||||
list: T[];
|
||||
}
|
||||
|
||||
export interface CategoryListV5<T, TCategory extends CategoryV5> {
|
||||
category: TCategory;
|
||||
list: T[];
|
||||
}
|
||||
|
||||
/**
|
||||
* OHLCVT candle used by v5 APIs
|
||||
> list[0]: startTime string Start time of the candle (ms)
|
||||
> list[1]: openPrice string Open price
|
||||
> list[2]: highPrice string Highest price
|
||||
> list[3]: lowPrice string Lowest price
|
||||
> list[4]: closePrice string Close price. Is the last traded price when the candle is not closed
|
||||
> list[5]: volume string Trade volume. Unit of contract: pieces of contract. Unit of spot: quantity of coins
|
||||
> list[6]: turnover string Turnover. Unit of figure: quantity of quota coin
|
||||
*
|
||||
* > list[0]: startTime string Start time of the candle (ms)
|
||||
*
|
||||
* > list[1]: openPrice string Open price
|
||||
*
|
||||
* > list[2]: highPrice string Highest price
|
||||
*
|
||||
* > list[3]: lowPrice string Lowest price
|
||||
*
|
||||
* > list[4]: closePrice string Close price. Is the last traded price when the candle is not closed
|
||||
*
|
||||
* > list[5]: volume string Trade volume. Unit of contract: pieces of contract. Unit of spot: quantity of coins
|
||||
*
|
||||
* > list[6]: turnover string Turnover. Unit of figure: quantity of quota coin
|
||||
*/
|
||||
export type KlineV5 = [string, string, string, string, string, string, string];
|
||||
|
||||
export interface KlineResponseV5 {
|
||||
category: 'spot' | 'linear' | 'inverse';
|
||||
symbol: string;
|
||||
list: KlineV5[];
|
||||
}
|
||||
|
||||
/**
|
||||
* OHLC candle used by v5 APIs
|
||||
> list[0]: startTime string Start time of the candle (ms)
|
||||
> list[1]: openPrice string Open price
|
||||
> list[2]: highPrice string Highest price
|
||||
> list[3]: lowPrice string Lowest price
|
||||
> list[4]: closePrice string Close price. Is the last traded price when the candle is not closed
|
||||
*
|
||||
* > list[0]: startTime string Start time of the candle (ms)
|
||||
*
|
||||
* > list[1]: openPrice string Open price
|
||||
*
|
||||
* > list[2]: highPrice string Highest price
|
||||
*
|
||||
* > list[3]: lowPrice string Lowest price
|
||||
*
|
||||
* > list[4]: closePrice string Close price. Is the last traded price when the candle is not closed
|
||||
*/
|
||||
export type OHLCV5 = [string, string, string, string, string];
|
||||
|
||||
export interface MarkPriceKlineResponseV5 {
|
||||
category: 'linear' | 'inverse';
|
||||
symbol: string;
|
||||
list: OHLCV5[];
|
||||
}
|
||||
|
||||
export interface IndexPriceKlineResponseV5 {
|
||||
category: 'linear' | 'inverse';
|
||||
symbol: string;
|
||||
list: OHLCV5[];
|
||||
}
|
||||
|
||||
export interface PremiumIndexPriceKlineResponse {
|
||||
category: 'linear';
|
||||
symbol: string;
|
||||
list: OHLCV5[];
|
||||
}
|
||||
|
||||
export interface LinearInverseInstrumentInfoV5 {
|
||||
category: 'linear' | 'inverse';
|
||||
symbol: string;
|
||||
@@ -208,21 +181,6 @@ export interface TickerSpotV5 {
|
||||
usdIndexPrice: string;
|
||||
}
|
||||
|
||||
export interface TickersSpotResponseV5 {
|
||||
category: 'spot';
|
||||
list: TickerSpotV5[];
|
||||
}
|
||||
|
||||
export interface TickersLinearInverseResponseV5 {
|
||||
category: 'linear' | 'inverse';
|
||||
list: TickerLinearInverseV5[];
|
||||
}
|
||||
|
||||
export interface TickersOptionResponseV5 {
|
||||
category: 'option';
|
||||
list: TickerOptionV5[];
|
||||
}
|
||||
|
||||
export interface FundingRateHistoryResponseV5 {
|
||||
symbol: string;
|
||||
fundingRate: string;
|
||||
@@ -241,6 +199,7 @@ export interface PublicTradeV5 {
|
||||
|
||||
/**
|
||||
> openInterest string Open interest
|
||||
|
||||
> timestamp string The timestamp (ms)
|
||||
*/
|
||||
export type OpenInterestV5 = [string, string];
|
||||
@@ -280,19 +239,8 @@ export interface RiskLimitV5 {
|
||||
maxLeverage: string;
|
||||
}
|
||||
|
||||
export interface RiskLimitResponseV5 {
|
||||
category: CategoryV5;
|
||||
list: RiskLimitV5[];
|
||||
}
|
||||
|
||||
export interface OptionDeliveryPriceV5 {
|
||||
symbol: string;
|
||||
deliveryPrice: string;
|
||||
deliveryTime: string;
|
||||
}
|
||||
|
||||
export interface OptionDeliveryPriceResponseV5 {
|
||||
category: CategoryV5;
|
||||
list: OptionDeliveryPriceV5[];
|
||||
nextPageCursor?: string;
|
||||
}
|
||||
|
||||
29
src/types/response/v5-position.ts
Normal file
29
src/types/response/v5-position.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { CategoryV5 } from '../v5-shared';
|
||||
|
||||
export interface PositionV5 {
|
||||
positionIdx: number;
|
||||
riskId: number;
|
||||
riskLimitValue: string;
|
||||
symbol: string;
|
||||
side: 'Buy' | 'Sell' | 'None';
|
||||
size: string;
|
||||
avgPrice: string;
|
||||
positionValue: string;
|
||||
tradeMode: number;
|
||||
autoAddMargin?: number;
|
||||
positionStatus: 'Normal' | 'Liq' | 'Adl';
|
||||
leverage?: string;
|
||||
markPrice: string;
|
||||
liqPrice: string;
|
||||
bustPrice?: string;
|
||||
positionIM?: string;
|
||||
positionMM?: string;
|
||||
tpslMode?: 'Full' | 'Partial';
|
||||
takeProfit?: string;
|
||||
stopLoss?: string;
|
||||
trailingStop?: string;
|
||||
unrealisedPnl: string;
|
||||
cumRealisedPnl: string;
|
||||
createdTime: string;
|
||||
updatedTime: string;
|
||||
}
|
||||
@@ -49,12 +49,6 @@ export interface AccountOrderV5 {
|
||||
updatedTime: string;
|
||||
}
|
||||
|
||||
export interface AccountOrdersResultV5 {
|
||||
category: CategoryV5;
|
||||
nextPageCursor?: string;
|
||||
list: AccountOrderV5[];
|
||||
}
|
||||
|
||||
export interface BatchOrderResult {
|
||||
category: CategoryV5;
|
||||
symbol: string;
|
||||
|
||||
@@ -6,3 +6,34 @@ export type OrderTimeInForceV5 = 'GTC' | 'IOC' | 'FOK' | 'PostOnly';
|
||||
export type OrderTriggerByV5 = 'LastPrice' | 'IndexPrice' | 'MarkPrice';
|
||||
export type OrderTypeV5 = 'Market' | 'Limit';
|
||||
export type PositionIdx = 0 | 1 | 2;
|
||||
|
||||
export interface CategoryCursorListV5<T extends unknown[]> {
|
||||
category: CategoryV5;
|
||||
list: T;
|
||||
nextPageCursor?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Next page cursor does not exist for spot!
|
||||
*/
|
||||
export interface CursorListV5<T extends unknown[]> {
|
||||
nextPageCursor: string;
|
||||
list: T;
|
||||
}
|
||||
|
||||
export interface CategoryListV5<
|
||||
T extends unknown[],
|
||||
TCategory extends CategoryV5
|
||||
> {
|
||||
category: TCategory;
|
||||
list: T;
|
||||
}
|
||||
|
||||
export interface CategorySymbolListV5<
|
||||
T extends unknown[],
|
||||
TCategory extends CategoryV5
|
||||
> {
|
||||
category: TCategory;
|
||||
symbol: string;
|
||||
list: T;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user