rest v1 spot & futures update
- add plan order symbol canceling - fix candles data params (spot & futures) - fix futures filter data (data in api-doc dither from real request!
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "bitget-api",
|
"name": "bitget-api",
|
||||||
"version": "2.0.2",
|
"version": "2.0.3",
|
||||||
"description": "Node.js & JavaScript SDK for Bitget REST APIs & WebSockets, with TypeScript & end-to-end tests.",
|
"description": "Node.js & JavaScript SDK for Bitget REST APIs & WebSockets, with TypeScript & end-to-end tests.",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import {
|
|||||||
FuturesKlineInterval,
|
FuturesKlineInterval,
|
||||||
FuturesHistoricPositions,
|
FuturesHistoricPositions,
|
||||||
ModifyFuturesOrder,
|
ModifyFuturesOrder,
|
||||||
|
FuturesCandleData,
|
||||||
} from './types';
|
} from './types';
|
||||||
import { REST_CLIENT_TYPE_ENUM } from './util';
|
import { REST_CLIENT_TYPE_ENUM } from './util';
|
||||||
import BaseRestClient from './util/BaseRestClient';
|
import BaseRestClient from './util/BaseRestClient';
|
||||||
@@ -106,12 +107,14 @@ export class FuturesClient extends BaseRestClient {
|
|||||||
startTime: string,
|
startTime: string,
|
||||||
endTime: string,
|
endTime: string,
|
||||||
limit?: string,
|
limit?: string,
|
||||||
): Promise<any> {
|
kLineType?: 'market' | 'mark' | 'index'
|
||||||
|
): Promise<FuturesCandleData[]> {
|
||||||
return this.get('/api/mix/v1/market/candles', {
|
return this.get('/api/mix/v1/market/candles', {
|
||||||
symbol,
|
symbol,
|
||||||
granularity,
|
granularity,
|
||||||
startTime,
|
startTime,
|
||||||
endTime,
|
endTime,
|
||||||
|
kLineType,
|
||||||
limit,
|
limit,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -559,13 +562,24 @@ export class FuturesClient extends BaseRestClient {
|
|||||||
return this.postPrivate('/api/mix/v1/plan/modifyTPSLPlan', params);
|
return this.postPrivate('/api/mix/v1/plan/modifyTPSLPlan', params);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Cancel Plan Order TPSL */
|
/** Cancel Plan Order (TPSL) */
|
||||||
cancelPlanOrderTPSL(
|
cancelPlanOrderTPSL(
|
||||||
params: CancelFuturesPlanTPSL,
|
params: CancelFuturesPlanTPSL,
|
||||||
): Promise<APIResponse<any>> {
|
): Promise<APIResponse<any>> {
|
||||||
return this.postPrivate('/api/mix/v1/plan/cancelPlan', params);
|
return this.postPrivate('/api/mix/v1/plan/cancelPlan', params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Cancel Symbol Plan Order (TPSL) */
|
||||||
|
cancelSymbolPlanOrders(
|
||||||
|
symbol: string,
|
||||||
|
planType: FuturesPlanType,
|
||||||
|
): Promise<APIResponse<any>> {
|
||||||
|
return this.postPrivate('/api/mix/v1/plan/cancelSymbolPlan', {
|
||||||
|
symbol,
|
||||||
|
planType,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/** Cancel All Trigger Order (TPSL) */
|
/** Cancel All Trigger Order (TPSL) */
|
||||||
cancelAllPlanOrders(
|
cancelAllPlanOrders(
|
||||||
productType: FuturesProductType,
|
productType: FuturesProductType,
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import {
|
|||||||
GetHistoricTradesParams,
|
GetHistoricTradesParams,
|
||||||
VIPFeeRate,
|
VIPFeeRate,
|
||||||
SpotKlineInterval,
|
SpotKlineInterval,
|
||||||
|
SpotCandleData,
|
||||||
} from './types';
|
} from './types';
|
||||||
import { REST_CLIENT_TYPE_ENUM } from './util';
|
import { REST_CLIENT_TYPE_ENUM } from './util';
|
||||||
import BaseRestClient from './util/BaseRestClient';
|
import BaseRestClient from './util/BaseRestClient';
|
||||||
@@ -111,12 +112,16 @@ export class SpotClient extends BaseRestClient {
|
|||||||
getCandles(
|
getCandles(
|
||||||
symbol: string,
|
symbol: string,
|
||||||
period: SpotKlineInterval,
|
period: SpotKlineInterval,
|
||||||
pagination?: Pagination,
|
limit?: string,
|
||||||
): Promise<APIResponse<any>> {
|
after?: string,
|
||||||
|
before?: string,
|
||||||
|
): Promise<APIResponse<SpotCandleData[]>> {
|
||||||
return this.get('/api/spot/v1/market/candles', {
|
return this.get('/api/spot/v1/market/candles', {
|
||||||
symbol,
|
symbol,
|
||||||
period,
|
period,
|
||||||
...pagination,
|
limit,
|
||||||
|
after,
|
||||||
|
before
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -215,3 +215,5 @@ export interface HistoricPlanOrderTPSLRequest {
|
|||||||
isPre?: boolean;
|
isPre?: boolean;
|
||||||
isPlan?: string;
|
isPlan?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type FuturesCandleData = string[6];
|
||||||
@@ -11,9 +11,10 @@ export type SpotKlineInterval =
|
|||||||
| '4h'
|
| '4h'
|
||||||
| '6h'
|
| '6h'
|
||||||
| '12h'
|
| '12h'
|
||||||
| '1M'
|
| '1day'
|
||||||
| '1W'
|
| '3day'
|
||||||
| '1week'
|
| '1week'
|
||||||
|
| '1M'
|
||||||
| '6Hutc'
|
| '6Hutc'
|
||||||
| '12Hutc'
|
| '12Hutc'
|
||||||
| '1Dutc'
|
| '1Dutc'
|
||||||
@@ -124,3 +125,14 @@ export interface GetHistoricPlanOrdersParams {
|
|||||||
startTime: string;
|
startTime: string;
|
||||||
endTime: string;
|
endTime: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SpotCandleData {
|
||||||
|
open: string
|
||||||
|
high: string
|
||||||
|
low: string
|
||||||
|
close: string
|
||||||
|
quoteVol: string
|
||||||
|
baseVol: string
|
||||||
|
usdtVol: string
|
||||||
|
ts: string
|
||||||
|
}
|
||||||
@@ -32,21 +32,30 @@ export interface FuturesAccount {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface FuturesSymbolRule {
|
export interface FuturesSymbolRule {
|
||||||
baseCoin: string;
|
baseCoin: string
|
||||||
buyLimitPriceRatio: string;
|
buyLimitPriceRatio: string
|
||||||
feeRateUpRatio: string;
|
feeRateUpRatio: string
|
||||||
makerFeeRate: string;
|
limitOpenTime: string
|
||||||
minTradeNum: string;
|
maintainTime: string
|
||||||
openCostUpRatio: string;
|
makerFeeRate: string
|
||||||
priceEndStep: string;
|
maxOrderNum: string
|
||||||
pricePlace: string;
|
maxPositionNum: string
|
||||||
quoteCoin: string;
|
minTradeNum: string
|
||||||
sellLimitPriceRatio: string;
|
minTradeUSDT: string
|
||||||
sizeMultiplier: string;
|
offTime: string
|
||||||
supportMarginCoins: string[];
|
openCostUpRatio: string
|
||||||
symbol: string;
|
priceEndStep: string
|
||||||
takerFeeRate: string;
|
pricePlace: string
|
||||||
volumePlace: string;
|
quoteCoin: string
|
||||||
|
sellLimitPriceRatio: string
|
||||||
|
sizeMultiplier: string
|
||||||
|
supportMarginCoins: string[]
|
||||||
|
symbol: string
|
||||||
|
symbolName: string
|
||||||
|
symbolStatus: string
|
||||||
|
symbolType: string
|
||||||
|
takerFeeRate: string
|
||||||
|
volumePlace: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FuturesPosition {
|
export interface FuturesPosition {
|
||||||
|
|||||||
Reference in New Issue
Block a user