USDC request param typings
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
export * from './account-asset';
|
||||
export * from './usdt-perp';
|
||||
export * from './usdc-perp';
|
||||
export * from './usdc-options';
|
||||
export * from './usdc-shared';
|
||||
|
||||
135
src/types/request/usdc-options.ts
Normal file
135
src/types/request/usdc-options.ts
Normal file
@@ -0,0 +1,135 @@
|
||||
import { OrderSide } from '../shared';
|
||||
import { USDCOrderFilter } from './usdc-perp';
|
||||
import { USDCAPICategory, USDCOrderType, USDCTimeInForce } from './usdc-shared';
|
||||
|
||||
export interface USDCOptionsContractInfoRequest {
|
||||
symbol?: string;
|
||||
status?: 'WAITING_ONLINE' | 'ONLINE' | 'DELIVERING' | 'OFFLINE';
|
||||
baseCoin?: string;
|
||||
direction?: string;
|
||||
limit?: string;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
export interface USDCOptionsDeliveryPriceRequest {
|
||||
symbol?: string;
|
||||
baseCoin?: string;
|
||||
direction?: string;
|
||||
limit?: string;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
export interface USDCOptionsRecentTradesRequest {
|
||||
category: USDCAPICategory;
|
||||
symbol?: string;
|
||||
baseCoin?: string;
|
||||
optionType?: 'Call' | 'Put';
|
||||
limit?: string;
|
||||
}
|
||||
|
||||
export interface USDCOptionsHistoricalVolatilityRequest {
|
||||
baseCoin?: string;
|
||||
period?: string;
|
||||
startTime?: string;
|
||||
endTime?: string;
|
||||
}
|
||||
|
||||
export interface USDCOptionsOrderRequest {
|
||||
symbol: string;
|
||||
orderType: USDCOrderType;
|
||||
side: OrderSide;
|
||||
orderPrice?: string;
|
||||
orderQty: string;
|
||||
iv?: string;
|
||||
timeInForce?: USDCTimeInForce;
|
||||
orderLinkId?: string;
|
||||
reduceOnly?: boolean;
|
||||
}
|
||||
|
||||
export interface USDCOptionsModifyOrderRequest {
|
||||
symbol: string;
|
||||
orderId?: string;
|
||||
orderLinkId?: string;
|
||||
orderPrice?: string;
|
||||
orderQty?: string;
|
||||
iv?: string;
|
||||
}
|
||||
|
||||
export interface USDCOptionsCancelOrderRequest {
|
||||
symbol: string;
|
||||
orderId?: string;
|
||||
orderLinkId?: string;
|
||||
}
|
||||
|
||||
export interface USDCOptionsCancelAllOrdersRequest {
|
||||
symbol?: string;
|
||||
baseCoin?: string;
|
||||
}
|
||||
|
||||
export interface USDCOptionsActiveOrdersRealtimeRequest {
|
||||
orderId?: string;
|
||||
orderLinkId?: string;
|
||||
symbol?: string;
|
||||
baseCoin?: string;
|
||||
direction?: string;
|
||||
limit?: number;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
export interface USDCOptionsActiveOrdersRequest {
|
||||
category: 'OPTION';
|
||||
symbol?: string;
|
||||
baseCoin?: string;
|
||||
orderId?: string;
|
||||
orderLinkId?: string;
|
||||
direction?: string;
|
||||
limit?: number;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
export interface USDCOptionsHistoricOrdersRequest {
|
||||
category: 'OPTION';
|
||||
symbol?: string;
|
||||
baseCoin?: string;
|
||||
orderId?: string;
|
||||
orderLinkId?: string;
|
||||
orderStatus?: string;
|
||||
direction?: string;
|
||||
limit?: number;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
export interface USDCOptionsOrderExecutionRequest {
|
||||
category: 'OPTION';
|
||||
symbol?: string;
|
||||
baseCoin?: string;
|
||||
orderId?: string;
|
||||
orderLinkId?: string;
|
||||
startTime?: string;
|
||||
direction?: string;
|
||||
limit?: number;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
export interface USDCOptionsDeliveryHistoryRequest {
|
||||
symbol: string;
|
||||
expDate?: string;
|
||||
direction?: string;
|
||||
limit?: string;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
export interface USDCOptionsPositionsInfoExpiryRequest {
|
||||
expDate?: string;
|
||||
direction?: string;
|
||||
limit?: string;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
export interface USDCOptionsModifyMMPRequest {
|
||||
currency: string;
|
||||
windowMs: number;
|
||||
frozenPeriodMs: number;
|
||||
qtyLimit: string;
|
||||
deltaLimit: string;
|
||||
}
|
||||
@@ -1,9 +1,5 @@
|
||||
export interface USDCKlineRequest {
|
||||
symbol: string;
|
||||
period: string;
|
||||
startTime: number;
|
||||
limit?: string;
|
||||
}
|
||||
import { OrderSide } from '../shared';
|
||||
import { USDCAPICategory, USDCOrderType, USDCTimeInForce } from './usdc-shared';
|
||||
|
||||
export interface USDCOpenInterestRequest {
|
||||
symbol: string;
|
||||
@@ -12,8 +8,90 @@ export interface USDCOpenInterestRequest {
|
||||
}
|
||||
|
||||
export interface USDCLast500TradesRequest {
|
||||
category: string;
|
||||
category: USDCAPICategory;
|
||||
symbol?: string;
|
||||
baseCoin?: string;
|
||||
limit?: string;
|
||||
}
|
||||
|
||||
export interface USDCSymbolDirectionLimit {
|
||||
symbol?: string;
|
||||
direction?: string;
|
||||
limit?: string;
|
||||
}
|
||||
|
||||
export interface USDCSymbolDirectionLimitCursor {
|
||||
symbol?: string;
|
||||
direction?: string;
|
||||
limit?: string;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
export type USDCOrderFilter = 'Order' | 'StopOrder';
|
||||
|
||||
export interface USDCPerpOrderRequest {
|
||||
symbol: string;
|
||||
orderType: USDCOrderType;
|
||||
orderFilter: USDCOrderFilter;
|
||||
side: OrderSide;
|
||||
orderPrice?: string;
|
||||
orderQty: string;
|
||||
timeInForce?: USDCTimeInForce;
|
||||
orderLinkId?: string;
|
||||
reduceOnly?: boolean;
|
||||
closeOnTrigger?: boolean;
|
||||
takeProfit?: string;
|
||||
stopLoss?: string;
|
||||
tptriggerby?: string;
|
||||
slTriggerBy?: string;
|
||||
basePrice?: string;
|
||||
triggerPrice?: string;
|
||||
triggerBy?: string;
|
||||
mmp?: boolean;
|
||||
}
|
||||
|
||||
export interface USDCPerpModifyOrderRequest {
|
||||
symbol: string;
|
||||
orderFilter: USDCOrderFilter;
|
||||
orderId?: string;
|
||||
orderLinkId?: string;
|
||||
orderPrice?: string;
|
||||
orderQty?: string;
|
||||
takeProfit?: string;
|
||||
stopLoss?: string;
|
||||
tptriggerby?: string;
|
||||
slTriggerBy?: string;
|
||||
triggerPrice?: string;
|
||||
}
|
||||
|
||||
export interface USDCPerpCancelOrderRequest {
|
||||
symbol: string;
|
||||
orderFilter: USDCOrderFilter;
|
||||
orderId?: string;
|
||||
orderLinkId?: string;
|
||||
}
|
||||
|
||||
export interface USDCPerpActiveOrdersRequest {
|
||||
category: 'PERPETUAL';
|
||||
symbol?: string;
|
||||
baseCoin?: string;
|
||||
orderId?: string;
|
||||
orderLinkId?: string;
|
||||
orderFilter?: USDCOrderFilter;
|
||||
direction?: string;
|
||||
limit?: number;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
export interface USDCPerpHistoricOrdersRequest {
|
||||
category: 'PERPETUAL';
|
||||
symbol?: string;
|
||||
baseCoin?: string;
|
||||
orderId?: string;
|
||||
orderLinkId?: string;
|
||||
orderStatus?: string;
|
||||
orderFilter?: USDCOrderFilter;
|
||||
direction?: string;
|
||||
limit?: number;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
36
src/types/request/usdc-shared.ts
Normal file
36
src/types/request/usdc-shared.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
export type USDCAPICategory = 'PERPETUAL' | 'OPTION';
|
||||
|
||||
export type USDCOrderType = 'Limit' | 'Market';
|
||||
export type USDCTimeInForce =
|
||||
| 'GoodTillCancel'
|
||||
| 'ImmediateOrCancel'
|
||||
| 'FillOrKill'
|
||||
| 'PostOnly';
|
||||
|
||||
export interface USDCKlineRequest {
|
||||
symbol: string;
|
||||
period: string;
|
||||
startTime: number;
|
||||
limit?: string;
|
||||
}
|
||||
|
||||
export interface USDCTransactionLogRequest {
|
||||
type: string;
|
||||
baseCoin?: string;
|
||||
startTime?: string;
|
||||
endTime?: string;
|
||||
direction?: string;
|
||||
limit?: string;
|
||||
cursor?: string;
|
||||
category?: USDCAPICategory;
|
||||
}
|
||||
|
||||
export interface USDCPositionsRequest {
|
||||
category: USDCAPICategory;
|
||||
symbol?: string;
|
||||
baseCoin?: string;
|
||||
expDate?: string;
|
||||
direction?: string;
|
||||
limit?: string;
|
||||
cursor?: string;
|
||||
}
|
||||
@@ -1,4 +1,24 @@
|
||||
import { APIResponseWithTime } from './types';
|
||||
import {
|
||||
APIResponseWithTime,
|
||||
USDCAPIResponse,
|
||||
USDCOptionsActiveOrdersRealtimeRequest,
|
||||
USDCOptionsActiveOrdersRequest,
|
||||
USDCOptionsCancelAllOrdersRequest,
|
||||
USDCOptionsCancelOrderRequest,
|
||||
USDCOptionsContractInfoRequest,
|
||||
USDCOptionsDeliveryHistoryRequest,
|
||||
USDCOptionsDeliveryPriceRequest,
|
||||
USDCOptionsHistoricalVolatilityRequest,
|
||||
USDCOptionsHistoricOrdersRequest,
|
||||
USDCOptionsModifyMMPRequest,
|
||||
USDCOptionsModifyOrderRequest,
|
||||
USDCOptionsOrderExecutionRequest,
|
||||
USDCOptionsOrderRequest,
|
||||
USDCOptionsPositionsInfoExpiryRequest,
|
||||
USDCOptionsRecentTradesRequest,
|
||||
USDCPositionsRequest,
|
||||
USDCTransactionLogRequest,
|
||||
} from './types';
|
||||
import { REST_CLIENT_TYPE_ENUM } from './util';
|
||||
import BaseRestClient from './util/BaseRestClient';
|
||||
|
||||
@@ -22,27 +42,33 @@ export class USDCOptionsClient extends BaseRestClient {
|
||||
*/
|
||||
|
||||
/** Query order book info. Each side has a depth of 25 orders. */
|
||||
getOrderBook(symbol: string): Promise<APIResponseWithTime<any>> {
|
||||
getOrderBook(symbol: string): Promise<USDCAPIResponse<any>> {
|
||||
return this.get('/option/usdc/openapi/public/v1/order-book', { symbol });
|
||||
}
|
||||
|
||||
/** Fetch trading rules (such as min/max qty). Query for all if blank. */
|
||||
getContractInfo(params?: unknown): Promise<APIResponseWithTime<any>> {
|
||||
getContractInfo(
|
||||
params?: USDCOptionsContractInfoRequest
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.get('/option/usdc/openapi/public/v1/symbols', params);
|
||||
}
|
||||
|
||||
/** Get a symbol price/statistics ticker */
|
||||
getSymbolTicker(symbol: string): Promise<APIResponseWithTime<any>> {
|
||||
getSymbolTicker(symbol: string): Promise<USDCAPIResponse<any>> {
|
||||
return this.get('/option/usdc/openapi/public/v1/tick', { symbol });
|
||||
}
|
||||
|
||||
/** Get delivery information */
|
||||
getDeliveryPrice(params?: unknown): Promise<APIResponseWithTime<any>> {
|
||||
getDeliveryPrice(
|
||||
params?: USDCOptionsDeliveryPriceRequest
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.get('/option/usdc/openapi/public/v1/delivery-price', params);
|
||||
}
|
||||
|
||||
/** Returned records are Taker Buy in default. */
|
||||
getLastTrades(params: unknown): Promise<APIResponseWithTime<any>> {
|
||||
getLast500Trades(
|
||||
params: USDCOptionsRecentTradesRequest
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.get(
|
||||
'/option/usdc/openapi/public/v1/query-trade-latest',
|
||||
params
|
||||
@@ -56,7 +82,9 @@ export class USDCOptionsClient extends BaseRestClient {
|
||||
* It returns all data in 2 years when startTime & endTime are not passed.
|
||||
* Both startTime & endTime entered together or both are left blank
|
||||
*/
|
||||
getHistoricalVolatility(params?: unknown): Promise<APIResponseWithTime<any>> {
|
||||
getHistoricalVolatility(
|
||||
params?: USDCOptionsHistoricalVolatilityRequest
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.get(
|
||||
'/option/usdc/openapi/public/v1/query-historical-volatility',
|
||||
params
|
||||
@@ -76,7 +104,7 @@ export class USDCOptionsClient extends BaseRestClient {
|
||||
* The request status can be queried in real-time.
|
||||
* The response parameters must be queried through a query or a WebSocket response.
|
||||
*/
|
||||
submitOrder(params: unknown): Promise<APIResponseWithTime<any>> {
|
||||
submitOrder(params: USDCOptionsOrderRequest): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/place-order',
|
||||
params
|
||||
@@ -87,8 +115,8 @@ export class USDCOptionsClient extends BaseRestClient {
|
||||
* Each request supports a max. of four orders. The reduceOnly parameter should be separate and unique for each order in the request.
|
||||
*/
|
||||
batchSubmitOrders(
|
||||
orderRequest: unknown[]
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
orderRequest: USDCOptionsOrderRequest[]
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/batch-place-orders',
|
||||
{ orderRequest }
|
||||
@@ -96,7 +124,9 @@ export class USDCOptionsClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
/** For Options, at least one of the three parameters — price, quantity or implied volatility — must be input. */
|
||||
modifyOrder(params: unknown): Promise<APIResponseWithTime<any>> {
|
||||
modifyOrder(
|
||||
params: USDCOptionsModifyOrderRequest
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/replace-order',
|
||||
params
|
||||
@@ -105,8 +135,8 @@ export class USDCOptionsClient extends BaseRestClient {
|
||||
|
||||
/** Each request supports a max. of four orders. The reduceOnly parameter should be separate and unique for each order in the request. */
|
||||
batchModifyOrders(
|
||||
replaceOrderRequest: unknown[]
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
replaceOrderRequest: USDCOptionsModifyOrderRequest[]
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/batch-replace-orders',
|
||||
{ replaceOrderRequest }
|
||||
@@ -114,7 +144,9 @@ export class USDCOptionsClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
/** Cancel order */
|
||||
cancelOrder(params: unknown): Promise<APIResponseWithTime<any>> {
|
||||
cancelOrder(
|
||||
params: USDCOptionsCancelOrderRequest
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/cancel-order',
|
||||
params
|
||||
@@ -123,8 +155,8 @@ export class USDCOptionsClient extends BaseRestClient {
|
||||
|
||||
/** Batch cancel orders */
|
||||
batchCancelOrders(
|
||||
cancelRequest: unknown[]
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
cancelRequest: USDCOptionsCancelOrderRequest[]
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/batch-cancel-orders',
|
||||
{ cancelRequest }
|
||||
@@ -132,7 +164,9 @@ export class USDCOptionsClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
/** This is used to cancel all active orders. The real-time response indicates whether the request is successful, depending on retCode. */
|
||||
cancelActiveOrders(params?: unknown): Promise<APIResponseWithTime<any>> {
|
||||
cancelActiveOrders(
|
||||
params?: USDCOptionsCancelAllOrdersRequest
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/cancel-all',
|
||||
params
|
||||
@@ -140,7 +174,9 @@ export class USDCOptionsClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
/** Query Unfilled/Partially Filled Orders(real-time), up to last 7 days of partially filled/unfilled orders */
|
||||
getActiveRealtimeOrders(params?: unknown): Promise<APIResponseWithTime<any>> {
|
||||
getActiveRealtimeOrders(
|
||||
params?: USDCOptionsActiveOrdersRealtimeRequest
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.getPrivate(
|
||||
'/option/usdc/openapi/private/v1/trade/query-active-orders',
|
||||
params
|
||||
@@ -148,7 +184,9 @@ export class USDCOptionsClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
/** Query Unfilled/Partially Filled Orders */
|
||||
getActiveOrders(params: unknown): Promise<APIResponseWithTime<any>> {
|
||||
getActiveOrders(
|
||||
params: USDCOptionsActiveOrdersRequest
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-active-orders',
|
||||
params
|
||||
@@ -156,7 +194,9 @@ export class USDCOptionsClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
/** Query order history. The endpoint only supports up to 30 days of queried records */
|
||||
getHistoricOrders(params: unknown): Promise<APIResponseWithTime<any>> {
|
||||
getHistoricOrders(
|
||||
params: USDCOptionsHistoricOrdersRequest
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-order-history',
|
||||
params
|
||||
@@ -164,7 +204,9 @@ export class USDCOptionsClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
/** Query trade history. The endpoint only supports up to 30 days of queried records. An error will be returned if startTime is more than 30 days. */
|
||||
getOrderExecutionHistory(params: unknown): Promise<APIResponseWithTime<any>> {
|
||||
getOrderExecutionHistory(
|
||||
params: USDCOptionsOrderExecutionRequest
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/execution-list',
|
||||
params
|
||||
@@ -174,7 +216,9 @@ export class USDCOptionsClient extends BaseRestClient {
|
||||
/** -> Account API */
|
||||
|
||||
/** The endpoint only supports up to 30 days of queried records. An error will be returned if startTime is more than 30 days. */
|
||||
getTransactionLog(params: unknown): Promise<APIResponseWithTime<any>> {
|
||||
getTransactionLog(
|
||||
params: USDCTransactionLogRequest
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-transaction-log',
|
||||
params
|
||||
@@ -182,15 +226,14 @@ export class USDCOptionsClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
/** Wallet info for USDC account. */
|
||||
getBalance(params?: unknown): Promise<APIResponseWithTime<any>> {
|
||||
getBalance(): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-wallet-balance',
|
||||
params
|
||||
'/option/usdc/openapi/private/v1/query-wallet-balance'
|
||||
);
|
||||
}
|
||||
|
||||
/** Asset Info */
|
||||
getAssetInfo(baseCoin?: string): Promise<APIResponseWithTime<any>> {
|
||||
getAssetInfo(baseCoin?: string): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-asset-info',
|
||||
{ baseCoin }
|
||||
@@ -203,7 +246,7 @@ export class USDCOptionsClient extends BaseRestClient {
|
||||
*/
|
||||
setMarginMode(
|
||||
newMarginMode: 'REGULAR_MARGIN' | 'PORTFOLIO_MARGIN'
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/private/asset/account/setMarginMode',
|
||||
{ setMarginMode: newMarginMode }
|
||||
@@ -211,7 +254,7 @@ export class USDCOptionsClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
/** Query margin mode for USDC account. */
|
||||
getMarginMode(): Promise<APIResponseWithTime<any>> {
|
||||
getMarginMode(): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-margin-info'
|
||||
);
|
||||
@@ -220,7 +263,7 @@ export class USDCOptionsClient extends BaseRestClient {
|
||||
/** -> Positions API */
|
||||
|
||||
/** Query my positions */
|
||||
getPositions(params: unknown): Promise<APIResponseWithTime<any>> {
|
||||
getPositions(params: USDCPositionsRequest): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-position',
|
||||
params
|
||||
@@ -228,7 +271,9 @@ export class USDCOptionsClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
/** Query Delivery History */
|
||||
getDeliveryHistory(params: unknown): Promise<APIResponseWithTime<any>> {
|
||||
getDeliveryHistory(
|
||||
params: USDCOptionsDeliveryHistoryRequest
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-delivery-list',
|
||||
params
|
||||
@@ -237,8 +282,8 @@ export class USDCOptionsClient extends BaseRestClient {
|
||||
|
||||
/** Query Positions Info Upon Expiry */
|
||||
getPositionsInfoUponExpiry(
|
||||
params?: unknown
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
params?: USDCOptionsPositionsInfoExpiryRequest
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-position-exp-date',
|
||||
params
|
||||
@@ -248,7 +293,9 @@ export class USDCOptionsClient extends BaseRestClient {
|
||||
/** -> Market Maker Protection */
|
||||
|
||||
/** modifyMMP */
|
||||
modifyMMP(params?: unknown): Promise<APIResponseWithTime<any>> {
|
||||
modifyMMP(
|
||||
params: USDCOptionsModifyMMPRequest
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/mmp-modify',
|
||||
params
|
||||
@@ -256,14 +303,14 @@ export class USDCOptionsClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
/** resetMMP */
|
||||
resetMMP(currency: string): Promise<APIResponseWithTime<any>> {
|
||||
resetMMP(currency: string): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate('/option/usdc/openapi/private/v1/mmp-reset', {
|
||||
currency,
|
||||
});
|
||||
}
|
||||
|
||||
/** queryMMPState */
|
||||
queryMMPState(baseCoin: string): Promise<APIResponseWithTime<any>> {
|
||||
queryMMPState(baseCoin: string): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate('/option/usdc/openapi/private/v1/get-mmp-state', {
|
||||
baseCoin,
|
||||
});
|
||||
|
||||
@@ -6,6 +6,16 @@ import {
|
||||
USDCKlineRequest,
|
||||
USDCLast500TradesRequest,
|
||||
USDCOpenInterestRequest,
|
||||
USDCOrderFilter,
|
||||
USDCPerpActiveOrdersRequest,
|
||||
USDCPerpCancelOrderRequest,
|
||||
USDCPerpHistoricOrdersRequest,
|
||||
USDCPerpModifyOrderRequest,
|
||||
USDCPerpOrderRequest,
|
||||
USDCPositionsRequest,
|
||||
USDCSymbolDirectionLimit,
|
||||
USDCSymbolDirectionLimitCursor,
|
||||
USDCTransactionLogRequest,
|
||||
} from './types';
|
||||
import { REST_CLIENT_TYPE_ENUM } from './util';
|
||||
import BaseRestClient from './util/BaseRestClient';
|
||||
@@ -34,7 +44,9 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
/** Fetch trading rules (such as min/max qty). Query for all if blank. */
|
||||
getContractInfo(params?: unknown): Promise<USDCAPIResponse<any>> {
|
||||
getContractInfo(
|
||||
params?: USDCSymbolDirectionLimit
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.get('/perpetual/usdc/openapi/public/v1/symbols', params);
|
||||
}
|
||||
|
||||
@@ -108,7 +120,7 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
* The request status can be queried in real-time.
|
||||
* The response parameters must be queried through a query or a WebSocket response.
|
||||
*/
|
||||
submitOrder(params: unknown): Promise<USDCAPIResponse<any>> {
|
||||
submitOrder(params: USDCPerpOrderRequest): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/perpetual/usdc/openapi/private/v1/place-order',
|
||||
params
|
||||
@@ -116,7 +128,9 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
/** Active order parameters (such as quantity, price) and stop order parameters cannot be modified in one request at the same time. Please request modification separately. */
|
||||
modifyOrder(params: unknown): Promise<USDCAPIResponse<any>> {
|
||||
modifyOrder(
|
||||
params: USDCPerpModifyOrderRequest
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/perpetual/usdc/openapi/private/v1/replace-order',
|
||||
params
|
||||
@@ -124,7 +138,9 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
/** Cancel order */
|
||||
cancelOrder(params: unknown): Promise<USDCAPIResponse<any>> {
|
||||
cancelOrder(
|
||||
params: USDCPerpCancelOrderRequest
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/perpetual/usdc/openapi/private/v1/cancel-order',
|
||||
params
|
||||
@@ -134,7 +150,7 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
/** Cancel all active orders. The real-time response indicates whether the request is successful, depending on retCode. */
|
||||
cancelActiveOrders(
|
||||
symbol: string,
|
||||
orderFilter: string
|
||||
orderFilter: USDCOrderFilter
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate('/perpetual/usdc/openapi/private/v1/cancel-all', {
|
||||
symbol,
|
||||
@@ -143,7 +159,9 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
/** Query Unfilled/Partially Filled Orders */
|
||||
getActiveOrders(params: unknown): Promise<USDCAPIResponse<any>> {
|
||||
getActiveOrders(
|
||||
params: USDCPerpActiveOrdersRequest
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-active-orders',
|
||||
params
|
||||
@@ -151,7 +169,9 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
/** Query order history. The endpoint only supports up to 30 days of queried records */
|
||||
getHistoricOrders(params: unknown): Promise<USDCAPIResponse<any>> {
|
||||
getHistoricOrders(
|
||||
params: USDCPerpHistoricOrdersRequest
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-order-history',
|
||||
params
|
||||
@@ -159,7 +179,9 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
/** Query trade history. The endpoint only supports up to 30 days of queried records. An error will be returned if startTime is more than 30 days. */
|
||||
getOrderExecutionHistory(params: unknown): Promise<USDCAPIResponse<any>> {
|
||||
getOrderExecutionHistory(
|
||||
params: USDCPerpActiveOrdersRequest
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/execution-list',
|
||||
params
|
||||
@@ -169,7 +191,9 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
/** -> Account API */
|
||||
|
||||
/** The endpoint only supports up to 30 days of queried records. An error will be returned if startTime is more than 30 days. */
|
||||
getTransactionLog(params: unknown): Promise<USDCAPIResponse<any>> {
|
||||
getTransactionLog(
|
||||
params: USDCTransactionLogRequest
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-transaction-log',
|
||||
params
|
||||
@@ -177,10 +201,9 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
/** Wallet info for USDC account. */
|
||||
getBalance(params?: unknown): Promise<USDCAPIResponse<any>> {
|
||||
getBalance(): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-wallet-balance',
|
||||
params
|
||||
'/option/usdc/openapi/private/v1/query-wallet-balance'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -215,7 +238,7 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
/** -> Positions API */
|
||||
|
||||
/** Query my positions */
|
||||
getPositions(params: unknown): Promise<USDCAPIResponse<any>> {
|
||||
getPositions(params: USDCPositionsRequest): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-position',
|
||||
params
|
||||
@@ -231,7 +254,9 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
/** Query Settlement History */
|
||||
getSettlementHistory(params?: unknown): Promise<USDCAPIResponse<any>> {
|
||||
getSettlementHistory(
|
||||
params?: USDCSymbolDirectionLimitCursor
|
||||
): Promise<USDCAPIResponse<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/session-settlement',
|
||||
params
|
||||
|
||||
Reference in New Issue
Block a user