feat(#261): add tpsl params missing from position endpoints. add new endpoint for add/reduce margin. add doc examples
This commit is contained in:
@@ -6,6 +6,8 @@ import {
|
||||
AccountMarginModeV5,
|
||||
AccountOrderV5,
|
||||
AccountTypeV5,
|
||||
AddOrReduceMarginParamsV5,
|
||||
AddOrReduceMarginResultV5,
|
||||
AllCoinsBalanceV5,
|
||||
AllowedDepositCoinInfoV5,
|
||||
AmendOrderParamsV5,
|
||||
@@ -618,6 +620,18 @@ export class RestClientV5 extends BaseRestClient {
|
||||
return this.postPrivate('/v5/position/set-auto-add-margin', params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manually add or reduce margin for isolated margin position
|
||||
*
|
||||
* Unified account covers: USDT perpetual / USDC perpetual / USDC futures / Inverse contract
|
||||
* Normal account covers: USDT perpetual / Inverse contract
|
||||
*/
|
||||
addOrReduceMargin(
|
||||
params: AddOrReduceMarginParamsV5,
|
||||
): Promise<APIResponseV3WithTime<AddOrReduceMarginResultV5>> {
|
||||
return this.postPrivate('/v5/position/add-margin', params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query users' execution records, sorted by execTime in descending order
|
||||
*
|
||||
|
||||
@@ -2,6 +2,7 @@ import {
|
||||
CategoryV5,
|
||||
ExecTypeV5,
|
||||
OrderTriggerByV5,
|
||||
OrderTypeV5,
|
||||
PositionIdx,
|
||||
TPSLModeV5,
|
||||
} from '../v5-shared';
|
||||
@@ -51,16 +52,21 @@ export interface SetRiskLimitParamsV5 {
|
||||
}
|
||||
|
||||
export interface SetTradingStopParamsV5 {
|
||||
symbol: string;
|
||||
category: CategoryV5;
|
||||
symbol: string;
|
||||
takeProfit?: string;
|
||||
stopLoss?: string;
|
||||
trailingStop?: string;
|
||||
tpTriggerBy?: OrderTriggerByV5;
|
||||
slTriggerBy?: OrderTriggerByV5;
|
||||
activePrice?: string;
|
||||
tpslMode?: TPSLModeV5;
|
||||
tpSize?: string;
|
||||
slSize?: string;
|
||||
tpLimitPrice?: string;
|
||||
slLimitPrice?: string;
|
||||
tpOrderType?: OrderTypeV5;
|
||||
slOrderType?: OrderTypeV5;
|
||||
positionIdx: PositionIdx;
|
||||
}
|
||||
|
||||
@@ -71,6 +77,13 @@ export interface SetAutoAddMarginParamsV5 {
|
||||
positionIdx?: PositionIdx;
|
||||
}
|
||||
|
||||
export interface AddOrReduceMarginParamsV5 {
|
||||
category: 'linear' | 'inverse';
|
||||
symbol: string;
|
||||
margin: string;
|
||||
positionIDex?: PositionIdx;
|
||||
}
|
||||
|
||||
export interface GetExecutionListParamsV5 {
|
||||
category: CategoryV5;
|
||||
symbol?: string;
|
||||
|
||||
@@ -43,6 +43,32 @@ export interface SetRiskLimitResultV5 {
|
||||
riskLimitValue: string;
|
||||
}
|
||||
|
||||
export interface AddOrReduceMarginResultV5 {
|
||||
category: CategoryV5;
|
||||
symbol: string;
|
||||
positionIdx: PositionIdx;
|
||||
riskId: number;
|
||||
riskLimitValue: string;
|
||||
size: string;
|
||||
avgPrice: string;
|
||||
liqPrice: string;
|
||||
bustPrice: string;
|
||||
markPrice: string;
|
||||
positionValue: string;
|
||||
leverage: string;
|
||||
autoAddMargin: 0 | 1;
|
||||
positionStatus: 'Normal' | 'Liq' | 'Adl';
|
||||
positionIM: string;
|
||||
positionMM: string;
|
||||
takeProfit: string;
|
||||
stopLoss: string;
|
||||
trailingStop: string;
|
||||
unrealisedPnl: string;
|
||||
cumRealisedPnl: string;
|
||||
createdTime: string;
|
||||
updatedTime: string;
|
||||
}
|
||||
|
||||
export interface ExecutionV5 {
|
||||
symbol: string;
|
||||
orderId: string;
|
||||
|
||||
Reference in New Issue
Block a user