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:
t0chk
2023-11-25 09:00:24 +03:00
parent 3b4b7c98cd
commit d6718c4af5
6 changed files with 80 additions and 38 deletions

View File

@@ -26,6 +26,7 @@ import {
FuturesKlineInterval,
FuturesHistoricPositions,
ModifyFuturesOrder,
FuturesCandleData,
} from './types';
import { REST_CLIENT_TYPE_ENUM } from './util';
import BaseRestClient from './util/BaseRestClient';
@@ -104,14 +105,16 @@ export class FuturesClient extends BaseRestClient {
symbol: string,
granularity: FuturesKlineInterval,
startTime: string,
endTime: string,
endTime: string,
limit?: string,
): Promise<any> {
kLineType?: 'market' | 'mark' | 'index'
): Promise<FuturesCandleData[]> {
return this.get('/api/mix/v1/market/candles', {
symbol,
granularity,
startTime,
endTime,
kLineType,
limit,
});
}
@@ -559,13 +562,24 @@ export class FuturesClient extends BaseRestClient {
return this.postPrivate('/api/mix/v1/plan/modifyTPSLPlan', params);
}
/** Cancel Plan Order TPSL */
/** Cancel Plan Order (TPSL) */
cancelPlanOrderTPSL(
params: CancelFuturesPlanTPSL,
): Promise<APIResponse<any>> {
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) */
cancelAllPlanOrders(
productType: FuturesProductType,

View File

@@ -21,6 +21,7 @@ import {
GetHistoricTradesParams,
VIPFeeRate,
SpotKlineInterval,
SpotCandleData,
} from './types';
import { REST_CLIENT_TYPE_ENUM } from './util';
import BaseRestClient from './util/BaseRestClient';
@@ -111,12 +112,16 @@ export class SpotClient extends BaseRestClient {
getCandles(
symbol: string,
period: SpotKlineInterval,
pagination?: Pagination,
): Promise<APIResponse<any>> {
limit?: string,
after?: string,
before?: string,
): Promise<APIResponse<SpotCandleData[]>> {
return this.get('/api/spot/v1/market/candles', {
symbol,
period,
...pagination,
limit,
after,
before
});
}

View File

@@ -215,3 +215,5 @@ export interface HistoricPlanOrderTPSLRequest {
isPre?: boolean;
isPlan?: string;
}
export type FuturesCandleData = string[6];

View File

@@ -3,22 +3,23 @@ import { OrderTimeInForce } from '../shared';
export type WalletType = 'spot' | 'mix_usdt' | 'mix_usd';
export type SpotKlineInterval =
| '1min'
| '5min'
| '15min'
| '30min'
| '1h'
| '4h'
| '6h'
| '12h'
| '1M'
| '1W'
| '1week'
| '6Hutc'
| '12Hutc'
| '1Dutc'
| '3Dutc'
| '1Wutc'
| '1min'
| '5min'
| '15min'
| '30min'
| '1h'
| '4h'
| '6h'
| '12h'
| '1day'
| '3day'
| '1week'
| '1M'
| '6Hutc'
| '12Hutc'
| '1Dutc'
| '3Dutc'
| '1Wutc'
| '1Mutc';
export interface NewWalletTransfer {
@@ -124,3 +125,14 @@ export interface GetHistoricPlanOrdersParams {
startTime: string;
endTime: string;
}
export interface SpotCandleData {
open: string
high: string
low: string
close: string
quoteVol: string
baseVol: string
usdtVol: string
ts: string
}

View File

@@ -32,21 +32,30 @@ export interface FuturesAccount {
}
export interface FuturesSymbolRule {
baseCoin: string;
buyLimitPriceRatio: string;
feeRateUpRatio: string;
makerFeeRate: string;
minTradeNum: string;
openCostUpRatio: string;
priceEndStep: string;
pricePlace: string;
quoteCoin: string;
sellLimitPriceRatio: string;
sizeMultiplier: string;
supportMarginCoins: string[];
symbol: string;
takerFeeRate: string;
volumePlace: string;
baseCoin: string
buyLimitPriceRatio: string
feeRateUpRatio: string
limitOpenTime: string
maintainTime: string
makerFeeRate: string
maxOrderNum: string
maxPositionNum: string
minTradeNum: string
minTradeUSDT: string
offTime: string
openCostUpRatio: string
priceEndStep: string
pricePlace: string
quoteCoin: string
sellLimitPriceRatio: string
sizeMultiplier: string
supportMarginCoins: string[]
symbol: string
symbolName: string
symbolStatus: string
symbolType: string
takerFeeRate: string
volumePlace: string
}
export interface FuturesPosition {