add unified margin client with request types
This commit is contained in:
@@ -5,3 +5,4 @@ export * from './usdt-perp';
|
||||
export * from './usdc-perp';
|
||||
export * from './usdc-options';
|
||||
export * from './usdc-shared';
|
||||
export * from './unified-margin';
|
||||
|
||||
247
src/types/request/unified-margin.ts
Normal file
247
src/types/request/unified-margin.ts
Normal file
@@ -0,0 +1,247 @@
|
||||
import { KlineIntervalV3, OrderSide } from '../shared';
|
||||
import { USDCOrderFilter, USDCTimeInForce } from './usdc-shared';
|
||||
|
||||
export type UMCategory = 'linear' | 'inverse' | 'option';
|
||||
export type UMOrderType = 'Limit' | 'Market';
|
||||
export type UMDirection = 'prev' | 'next';
|
||||
|
||||
export interface UMCandlesRequest {
|
||||
category: UMCategory;
|
||||
symbol: string;
|
||||
interval: KlineIntervalV3;
|
||||
start: number;
|
||||
end: number;
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export interface UMInstrumentInfoRequest {
|
||||
category: UMCategory;
|
||||
symbol?: string;
|
||||
baseCoin?: string;
|
||||
limit?: string;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
export interface UMFundingRateHistoryRequest {
|
||||
category: UMCategory;
|
||||
symbol: string;
|
||||
startTime?: number;
|
||||
endTime?: number;
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export interface UMOptionDeliveryPriceRequest {
|
||||
category: UMCategory;
|
||||
symbol?: string;
|
||||
baseCoin?: string;
|
||||
direction?: UMDirection;
|
||||
limit?: string;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
export interface UMPublicTradesRequest {
|
||||
category: UMCategory;
|
||||
symbol: string;
|
||||
baseCoin?: string;
|
||||
optionType?: 'Call' | 'Put';
|
||||
limit?: string;
|
||||
}
|
||||
|
||||
export interface UMOpenInterestRequest {
|
||||
category: UMCategory;
|
||||
symbol: string;
|
||||
interval: '5min' | '15min' | '30min' | '1h' | '4h' | '1d';
|
||||
startTime?: number;
|
||||
endTime?: number;
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export interface UMOrderRequest {
|
||||
category: UMCategory;
|
||||
symbol: string;
|
||||
side: OrderSide;
|
||||
positionIdx?: '0';
|
||||
orderType: UMOrderType;
|
||||
qty: string;
|
||||
price?: string;
|
||||
basePrice?: string;
|
||||
triggerPrice?: string;
|
||||
triggerBy?: string;
|
||||
iv?: string;
|
||||
timeInForce: USDCTimeInForce;
|
||||
orderLinkId?: string;
|
||||
takeProfit?: number;
|
||||
stopLoss?: number;
|
||||
tpTriggerBy?: string;
|
||||
slTriggerBy?: string;
|
||||
reduceOnly?: boolean;
|
||||
closeOnTrigger?: boolean;
|
||||
mmp?: boolean;
|
||||
}
|
||||
|
||||
export interface UMModifyOrderRequest {
|
||||
category: UMCategory;
|
||||
symbol: string;
|
||||
orderId?: string;
|
||||
orderLinkId?: string;
|
||||
iv?: string;
|
||||
triggerPrice?: string;
|
||||
qty?: string;
|
||||
price?: string;
|
||||
takeProfit?: number;
|
||||
stopLoss?: number;
|
||||
tpTriggerBy?: string;
|
||||
slTriggerBy?: string;
|
||||
triggerBy?: string;
|
||||
}
|
||||
|
||||
export interface UMCancelOrderRequest {
|
||||
category: UMCategory;
|
||||
symbol: string;
|
||||
orderId?: string;
|
||||
orderLinkId?: string;
|
||||
orderFilter?: USDCOrderFilter;
|
||||
}
|
||||
|
||||
export interface UMActiveOrdersRequest {
|
||||
category: UMCategory;
|
||||
symbol?: string;
|
||||
baseCoin?: string;
|
||||
orderId?: string;
|
||||
orderLinkId?: string;
|
||||
orderFilter?: USDCOrderFilter;
|
||||
direction?: UMDirection;
|
||||
limit?: number;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
export interface UMHistoricOrdersRequest {
|
||||
category: UMCategory;
|
||||
symbol?: string;
|
||||
baseCoin?: string;
|
||||
orderId?: string;
|
||||
orderLinkId?: string;
|
||||
orderStatus?: string;
|
||||
orderFilter?: USDCOrderFilter;
|
||||
direction?: UMDirection;
|
||||
limit?: number;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
export interface UMBatchOrder {
|
||||
symbol: string;
|
||||
side: OrderSide;
|
||||
positionIdx?: '0';
|
||||
orderType: UMOrderType;
|
||||
qty: string;
|
||||
price?: string;
|
||||
iv?: string;
|
||||
timeInForce: USDCTimeInForce;
|
||||
orderLinkId?: string;
|
||||
reduceOnly?: boolean;
|
||||
closeOnTrigger?: boolean;
|
||||
mmp?: boolean;
|
||||
}
|
||||
|
||||
export interface UMBatchOrderReplace {
|
||||
symbol: string;
|
||||
orderId?: string;
|
||||
orderLinkId?: string;
|
||||
iv?: string;
|
||||
qty?: string;
|
||||
price?: string;
|
||||
}
|
||||
|
||||
export interface UMBatchOrderCancel {
|
||||
symbol: string;
|
||||
orderId?: string;
|
||||
orderLinkId?: string;
|
||||
}
|
||||
|
||||
export interface UMCancelAllOrdersRequest {
|
||||
category: UMCategory;
|
||||
baseCoin?: string;
|
||||
settleCoin?: string;
|
||||
symbol?: string;
|
||||
orderFilter?: USDCOrderFilter;
|
||||
}
|
||||
|
||||
export interface UMPositionsRequest {
|
||||
category: UMCategory;
|
||||
symbol?: string;
|
||||
baseCoin?: string;
|
||||
direction?: UMDirection;
|
||||
limit?: number;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
export interface UMSetTPSLRequest {
|
||||
category: UMCategory;
|
||||
symbol: string;
|
||||
takeProfit?: string;
|
||||
stopLoss?: string;
|
||||
trailingStop?: string;
|
||||
tpTriggerBy?: string;
|
||||
slTriggerBy?: string;
|
||||
activePrice?: string;
|
||||
slSize?: string;
|
||||
tpSize?: string;
|
||||
positionIdx?: '0';
|
||||
}
|
||||
|
||||
export interface UM7DayTradingHistoryRequest {
|
||||
category: UMCategory;
|
||||
symbol: string;
|
||||
baseCoin?: string;
|
||||
orderId?: string;
|
||||
orderLinkId?: string;
|
||||
startTime?: number;
|
||||
endTime?: number;
|
||||
direction?: UMDirection;
|
||||
limit?: number;
|
||||
cursor?: string;
|
||||
execType?: string;
|
||||
}
|
||||
|
||||
export interface UMOptionsSettlementHistoryRequest {
|
||||
category: UMCategory;
|
||||
symbol: string;
|
||||
expDate?: string;
|
||||
direction?: UMDirection;
|
||||
limit?: number;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
export interface UMPerpSettlementHistoryRequest {
|
||||
category: UMCategory;
|
||||
symbol: string;
|
||||
direction?: UMDirection;
|
||||
limit?: number;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
export interface UMTransactionLogRequest {
|
||||
category: UMCategory;
|
||||
currency: string;
|
||||
baseCoin?: string;
|
||||
type?: string;
|
||||
startTime?: number;
|
||||
endTime?: number;
|
||||
direction?: UMDirection;
|
||||
limit?: number;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
export interface UMExchangeCoinsRequest {
|
||||
fromCoin?: string;
|
||||
toCoin?: string;
|
||||
}
|
||||
|
||||
export interface UMBorrowHistoryRequest {
|
||||
currency: string;
|
||||
startTime?: number;
|
||||
endTime?: number;
|
||||
direction?: UMDirection;
|
||||
limit?: number;
|
||||
cursor?: string;
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
import { OrderSide } from '../shared';
|
||||
import { USDCAPICategory, USDCOrderType, USDCTimeInForce } from './usdc-shared';
|
||||
import {
|
||||
USDCAPICategory,
|
||||
USDCOrderFilter,
|
||||
USDCOrderType,
|
||||
USDCTimeInForce,
|
||||
} from './usdc-shared';
|
||||
|
||||
export interface USDCOpenInterestRequest {
|
||||
symbol: string;
|
||||
@@ -27,8 +32,6 @@ export interface USDCSymbolDirectionLimitCursor {
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
export type USDCOrderFilter = 'Order' | 'StopOrder';
|
||||
|
||||
export interface USDCPerpOrderRequest {
|
||||
symbol: string;
|
||||
orderType: USDCOrderType;
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
export type USDCAPICategory = 'PERPETUAL' | 'OPTION';
|
||||
|
||||
export type USDCOrderType = 'Limit' | 'Market';
|
||||
|
||||
export type USDCTimeInForce =
|
||||
| 'GoodTillCancel'
|
||||
| 'ImmediateOrCancel'
|
||||
| 'FillOrKill'
|
||||
| 'PostOnly';
|
||||
|
||||
export type USDCOrderFilter = 'Order' | 'StopOrder';
|
||||
|
||||
export interface USDCKlineRequest {
|
||||
symbol: string;
|
||||
period: string;
|
||||
|
||||
@@ -17,6 +17,21 @@ export type KlineInterval =
|
||||
| '1w'
|
||||
| '1M';
|
||||
|
||||
export type KlineIntervalV3 =
|
||||
| '1'
|
||||
| '3'
|
||||
| '5'
|
||||
| '15'
|
||||
| '30'
|
||||
| '60'
|
||||
| '120'
|
||||
| '240'
|
||||
| '360'
|
||||
| '720'
|
||||
| 'D'
|
||||
| 'W'
|
||||
| 'M';
|
||||
|
||||
export interface APIResponse<T> {
|
||||
ret_code: number;
|
||||
ret_msg: 'OK' | string;
|
||||
|
||||
Reference in New Issue
Block a user