v1.0.4: feat(#6) add futures trailing stop endpoint, add missing types for new order endpoint

This commit is contained in:
Tiago Siebler
2023-02-10 18:26:55 +00:00
parent eb1f7ae4c2
commit 6f9981db15
4 changed files with 27 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "bitget-api",
"version": "1.0.3",
"version": "1.0.4",
"description": "Node.js connector for Bitget REST APIs and WebSockets, with TypeScript & end-to-end tests.",
"main": "lib/index.js",
"types": "lib/index.d.ts",

View File

@@ -19,6 +19,7 @@ import {
FuturesSymbolRule,
FuturesMarginMode,
FuturesPosition,
NewFuturesPlanTrailingStopOrder,
} from './types';
import { REST_CLIENT_TYPE_ENUM } from './util';
import BaseRestClient from './util/BaseRestClient';
@@ -417,6 +418,13 @@ export class FuturesClient extends BaseRestClient {
return this.postPrivate('/api/mix/v1/plan/placeTPSL', params);
}
/** Place Trailing Stop order */
submitTrailingStopOrder(
params: NewFuturesPlanTrailingStopOrder
): Promise<APIResponse<any>> {
return this.postPrivate('/api/mix/v1/plan/placeTrailStop', params);
}
/** Place Position TPSL */
submitPositionTPSL(
params: NewFuturesPlanPositionTPSL

View File

@@ -38,7 +38,9 @@ export type FuturesOrderSide =
| 'open_long'
| 'open_short'
| 'close_long'
| 'close_short';
| 'close_short'
| 'buy_single'
| 'sell_single';
export interface NewFuturesOrder {
symbol: string;
@@ -100,15 +102,27 @@ export interface ModifyFuturesPlanOrderTPSL {
presetStopLossPrice?: string;
}
export type FuturesPlanType = 'profit_plan' | 'loss_plan';
export type FuturesPlanType = 'profit_plan' | 'loss_plan' | 'moving_plan';
export interface NewFuturesPlanStopOrder {
symbol: string;
marginCoin: string;
planType: FuturesPlanType;
triggerPrice: string;
holdSide?: FuturesHoldSide;
triggerType?: 'fill_price' | 'market_price';
holdSide: FuturesHoldSide;
size?: string;
rangeRate?: string;
}
export interface NewFuturesPlanTrailingStopOrder {
symbol: string;
marginCoin: string;
triggerPrice: string;
triggerType?: 'fill_price' | 'market_price';
size?: string;
side: FuturesOrderSide;
rangeRate?: string;
}
export interface NewFuturesPlanPositionTPSL {

View File

@@ -227,6 +227,7 @@ describe('Private Futures REST API POST Endpoints', () => {
marginCoin,
symbol,
planType: 'profit_plan',
holdSide: 'long',
triggerPrice: '100',
})
).toMatchObject({