add position v5 rest apis
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { CategoryV5 } from '../v5-shared';
|
||||
import { CategoryV5, TPSLModeV5 } from '../v5-shared';
|
||||
|
||||
export interface PositionInfoParamsV5 {
|
||||
category: CategoryV5;
|
||||
@@ -8,3 +8,81 @@ export interface PositionInfoParamsV5 {
|
||||
limit?: number;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
export interface SetLeverageParamsV5 {
|
||||
category: 'linear' | 'inverse';
|
||||
symbol: string;
|
||||
buyLeverage: string;
|
||||
sellLeverage: string;
|
||||
}
|
||||
|
||||
export interface SwitchIsolatedMarginParamsV5 {
|
||||
category: 'linear' | 'inverse';
|
||||
symbol: string;
|
||||
tradeMode: 0 | 1;
|
||||
buyLeverage: string;
|
||||
sellLeverage: string;
|
||||
}
|
||||
|
||||
export interface SetTPSLModeParamsV5 {
|
||||
category: 'linear' | 'inverse';
|
||||
symbol: string;
|
||||
tpSlMode: TPSLModeV5;
|
||||
}
|
||||
|
||||
export interface SwitchPositionModeParamsV5 {
|
||||
category: 'linear' | 'inverse';
|
||||
symbol?: string;
|
||||
coin?: string;
|
||||
mode: 0 | 3;
|
||||
}
|
||||
|
||||
export interface SetRiskLimitParamsV5 {
|
||||
category: 'linear' | 'inverse';
|
||||
symbol: string;
|
||||
riskId: number;
|
||||
positionIdx?: number;
|
||||
}
|
||||
|
||||
export interface SetTradingStopParamsV5 {
|
||||
symbol: string;
|
||||
category: CategoryV5;
|
||||
takeProfit?: string;
|
||||
stopLoss?: string;
|
||||
trailingStop?: string;
|
||||
tpTriggerBy?: string;
|
||||
slTriggerBy?: string;
|
||||
activePrice?: string;
|
||||
tpSize?: string;
|
||||
slSize?: string;
|
||||
positionIdx: number;
|
||||
}
|
||||
|
||||
export interface SetAutoAddMarginParamsV5 {
|
||||
category: 'linear';
|
||||
symbol: string;
|
||||
autoAddMargin: 0 | 1;
|
||||
positionIdx?: number;
|
||||
}
|
||||
|
||||
export interface GetExecutionListParamsV5 {
|
||||
category: CategoryV5;
|
||||
symbol?: string;
|
||||
orderId?: string;
|
||||
orderLinkId?: string;
|
||||
baseCoin?: string;
|
||||
startTime?: number;
|
||||
endTime?: number;
|
||||
execType?: string;
|
||||
limit?: number;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
export interface GetClosedPnLParamsV5 {
|
||||
category: CategoryV5;
|
||||
symbol?: string;
|
||||
startTime?: number;
|
||||
endTime?: number;
|
||||
limit?: number;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
import { CategoryV5 } from '../v5-shared';
|
||||
import {
|
||||
CategoryV5,
|
||||
OrderSideV5,
|
||||
OrderTypeV5,
|
||||
PositionIdx,
|
||||
TPSLModeV5,
|
||||
TradeModeV5,
|
||||
} from '../v5-shared';
|
||||
|
||||
export interface PositionV5 {
|
||||
positionIdx: number;
|
||||
positionIdx: PositionIdx;
|
||||
riskId: number;
|
||||
riskLimitValue: string;
|
||||
symbol: string;
|
||||
@@ -9,7 +16,7 @@ export interface PositionV5 {
|
||||
size: string;
|
||||
avgPrice: string;
|
||||
positionValue: string;
|
||||
tradeMode: number;
|
||||
tradeMode: TradeModeV5;
|
||||
autoAddMargin?: number;
|
||||
positionStatus: 'Normal' | 'Liq' | 'Adl';
|
||||
leverage?: string;
|
||||
@@ -18,7 +25,7 @@ export interface PositionV5 {
|
||||
bustPrice?: string;
|
||||
positionIM?: string;
|
||||
positionMM?: string;
|
||||
tpslMode?: 'Full' | 'Partial';
|
||||
tpslMode?: TPSLModeV5;
|
||||
takeProfit?: string;
|
||||
stopLoss?: string;
|
||||
trailingStop?: string;
|
||||
@@ -27,3 +34,56 @@ export interface PositionV5 {
|
||||
createdTime: string;
|
||||
updatedTime: string;
|
||||
}
|
||||
|
||||
export interface SetRiskLimitResultV5 {
|
||||
category: CategoryV5;
|
||||
riskId: number;
|
||||
riskLimitValue: string;
|
||||
}
|
||||
|
||||
export interface ExecutionV5 {
|
||||
symbol: string;
|
||||
orderId: string;
|
||||
orderLinkId: string;
|
||||
side: OrderSideV5;
|
||||
orderPrice: string;
|
||||
orderQty: string;
|
||||
leavesQty: string;
|
||||
orderType: OrderTypeV5;
|
||||
stopOrderType?: string;
|
||||
execFee: string;
|
||||
execId: string;
|
||||
execPrice: string;
|
||||
execQty: string;
|
||||
execType: string;
|
||||
execValue: string;
|
||||
execTime: string;
|
||||
isMaker: boolean;
|
||||
feeRate: string;
|
||||
tradeIv?: string;
|
||||
markIv?: string;
|
||||
markPrice: string;
|
||||
indexPrice: string;
|
||||
underlyingPrice?: string;
|
||||
blockTradeId?: string;
|
||||
}
|
||||
|
||||
export interface ClosedPnLV5 {
|
||||
symbol: string;
|
||||
orderId: string;
|
||||
side: string;
|
||||
qty: string;
|
||||
orderPrice: string;
|
||||
orderType: string;
|
||||
execType: string;
|
||||
closedSize: string;
|
||||
cumEntryValue: string;
|
||||
avgEntryPrice: string;
|
||||
cumExitValue: string;
|
||||
avgExitPrice: string;
|
||||
closedPnl: string;
|
||||
fillCount: string;
|
||||
leverage: string;
|
||||
createdTime: string;
|
||||
updatedTime: string;
|
||||
}
|
||||
|
||||
@@ -2,10 +2,15 @@ export type CategoryV5 = 'spot' | 'linear' | 'inverse' | 'option';
|
||||
|
||||
export type OrderFilterV5 = 'Order' | 'tpslOrder';
|
||||
export type OrderSideV5 = 'Buy' | 'Sell';
|
||||
export type OrderTypeV5 = 'Market' | 'Limit';
|
||||
export type OrderTimeInForceV5 = 'GTC' | 'IOC' | 'FOK' | 'PostOnly';
|
||||
export type OrderTriggerByV5 = 'LastPrice' | 'IndexPrice' | 'MarkPrice';
|
||||
export type OrderTypeV5 = 'Market' | 'Limit';
|
||||
export type PositionIdx = 0 | 1 | 2;
|
||||
/**
|
||||
* Trade mode. 0: cross-margin, 1: isolated margin
|
||||
*/
|
||||
export type TradeModeV5 = 0 | 1;
|
||||
export type TPSLModeV5 = 'Full' | 'Partial';
|
||||
|
||||
export interface CategoryCursorListV5<T extends unknown[]> {
|
||||
category: CategoryV5;
|
||||
|
||||
Reference in New Issue
Block a user