v3.5.0: feat(): add market endpoints for v5 REST APIs, with tests

This commit is contained in:
tiagosiebler
2023-02-14 17:31:11 +00:00
parent a852fd1c63
commit 5b44e31207
9 changed files with 798 additions and 1 deletions

View File

@@ -7,4 +7,5 @@ export * from './usdc-perp';
export * from './usdc-options';
export * from './usdc-shared';
export * from './unified-margin';
export * from './v5-market';
export * from './contract';

View File

@@ -0,0 +1,120 @@
import { KlineIntervalV3 } from '../shared';
import { CategoryV5 } from '../v5-shared';
export interface GetKlineParamsV5 {
category: 'spot' | 'linear' | 'inverse';
symbol: string;
interval: KlineIntervalV3;
start?: number;
end?: number;
limit?: number;
}
export interface GetMarkPriceKlineParamsV5 {
category: 'linear' | 'inverse';
symbol: string;
interval: KlineIntervalV3;
start?: number;
end?: number;
limit?: number;
}
export interface GetIndexPriceKlineParamsV5 {
category: 'linear' | 'inverse';
symbol: string;
interval: KlineIntervalV3;
start?: number;
end?: number;
limit?: number;
}
export interface GetPremiumIndexPriceKlineParams {
category: 'linear';
symbol: string;
interval: KlineIntervalV3;
start?: number;
end?: number;
limit?: number;
}
export interface GetInstrumentsInfoParamsV5 {
category: CategoryV5;
symbol?: string;
baseCoin?: string;
limit?: number;
cursor?: string;
}
export interface GetOrderbookParamsV5 {
category: CategoryV5;
symbol: string;
limit?: number;
}
export interface GetTickersParamsV5 {
category: CategoryV5;
symbol?: string;
baseCoin?: string;
expDate?: string;
}
export interface GetFundingRateHistoryParamsV5 {
category: 'linear' | 'inverse';
symbol: string;
startTime?: number;
endTime?: number;
limit?: number;
}
export type OptionType = 'Call' | 'Put';
export interface GetPublicTradingHistoryParamsV5 {
category: CategoryV5;
symbol: string;
baseCoin?: string;
optionType?: OptionType;
limit?: number;
}
export type OpenInterestIntervalV5 =
| '5min'
| '15min'
| '30min'
| '1h'
| '4h'
| '1d';
export interface GetOpenInterestParamsV5 {
category: 'linear' | 'inverse';
symbol: string;
intervalTime: OpenInterestIntervalV5;
startTime?: number;
endTime?: number;
limit?: number;
cursor?: string;
}
export interface GetHistoricalVolatilityParamsV5 {
category: 'option';
baseCoin?: string;
period?: number;
startTime?: number;
endTime?: number;
}
export interface GetInsuranceParamsV5 {
coin?: string;
}
export interface GetRiskLimitParamsV5 {
category?: 'linear' | 'inverse';
symbol?: string;
}
export interface GetOptionDeliveryPriceParamsV5 {
category: 'option';
symbol?: string;
baseCoin?: string;
limit?: number;
cursor?: string;
}