mexc-futures-sdk
Version:
Unofficial TypeScript SDK for MEXC Futures trading with maintenance bypass. Uses browser session tokens to work 24/7 even during API downtime.
104 lines • 4.35 kB
TypeScript
import { LogLevelString } from "./utils/logger";
import { OrderHistoryParams, OrderHistoryResponse, OrderDealsParams, OrderDealsResponse, CancelOrderResponse, CancelOrderByExternalIdRequest, CancelOrderByExternalIdResponse, CancelAllOrdersRequest, CancelAllOrdersResponse, SubmitOrderRequest, SubmitOrderResponse, GetOrderResponse } from "./types/orders";
import { RiskLimit, FeeRate, AccountResponse, AccountAssetResponse, OpenPositionsResponse, PositionHistoryParams, PositionHistoryResponse } from "./types/account";
import { TickerResponse, ContractDetailResponse, ContractDepthResponse } from "./types/market";
export interface MexcFuturesSDKConfig {
authToken: string;
baseURL?: string;
timeout?: number;
userAgent?: string;
customHeaders?: Record<string, string>;
logLevel?: LogLevelString;
}
export declare class MexcFuturesSDK {
private httpClient;
private config;
private logger;
constructor(config: MexcFuturesSDKConfig);
/**
* Submit order using /api/v1/private/order/submit endpoint
* This is the alternative order submission method used by MEXC browser
*/
submitOrder(orderParams: SubmitOrderRequest): Promise<SubmitOrderResponse>;
/**
* Cancel orders by order IDs (up to 50 orders at once)
*/
cancelOrder(orderIds: number[]): Promise<CancelOrderResponse>;
/**
* Cancel order by external order ID
*/
cancelOrderByExternalId(params: CancelOrderByExternalIdRequest): Promise<CancelOrderByExternalIdResponse>;
/**
* Cancel all orders under a contract (or all orders if no symbol provided)
*/
cancelAllOrders(params?: CancelAllOrdersRequest): Promise<CancelAllOrdersResponse>;
/**
* Get order history
*/
getOrderHistory(params: OrderHistoryParams): Promise<OrderHistoryResponse>;
/**
* Get all transaction details of the user's orders
*/
getOrderDeals(params: OrderDealsParams): Promise<OrderDealsResponse>;
/**
* Get order information by order ID
* @param orderId Order ID to query
* @returns Detailed order information
*/
getOrder(orderId: number | string): Promise<GetOrderResponse>;
/**
* Get order information by external order ID
* @param symbol Contract symbol (e.g., "BTC_USDT")
* @param externalOid External order ID
* @returns Detailed order information
*/
getOrderByExternalId(symbol: string, externalOid: string): Promise<GetOrderResponse>;
/**
* Get risk limits for account
*/
getRiskLimit(): Promise<AccountResponse<RiskLimit[]>>;
/**
* Get fee rates for contracts
*/
getFeeRate(): Promise<AccountResponse<FeeRate[]>>;
/**
* Get user's single currency asset information
* @param currency Currency symbol (e.g., "USDT", "BTC")
* @returns Account asset information for the specified currency
*/
getAccountAsset(currency: string): Promise<AccountAssetResponse>;
/**
* Get user's current holding positions
* @param symbol Optional: specific contract symbol to filter positions
* @returns List of open positions
*/
getOpenPositions(symbol?: string): Promise<OpenPositionsResponse>;
/**
* Get user's history position information
* @param params Parameters for filtering position history
* @returns List of historical positions
*/
getPositionHistory(params: PositionHistoryParams): Promise<PositionHistoryResponse>;
/**
* Get ticker data for a specific symbol
*/
getTicker(symbol: string): Promise<TickerResponse>;
/**
* Get contract information
* @param symbol Optional: specific contract symbol (e.g., "BTC_USDT"). If not provided, returns all contracts
* @returns Contract details for specified symbol or all contracts
*/
getContractDetail(symbol?: string): Promise<ContractDetailResponse>;
/**
* Get contract's depth information (order book)
* @param symbol Contract symbol (e.g., "BTC_USDT")
* @param limit Optional: depth tier limit
* @returns Order book with bids and asks
*/
getContractDepth(symbol: string, limit?: number): Promise<ContractDepthResponse>;
/**
* Test connection to the API (using public endpoint)
*/
testConnection(): Promise<boolean>;
}
//# sourceMappingURL=client.d.ts.map