diff --git a/src/RestClient.ts b/src/RestClient.ts index b32861c..d66a77a 100644 --- a/src/RestClient.ts +++ b/src/RestClient.ts @@ -17,7 +17,7 @@ import { import { GetDeliveryAutoOrdersReq, GetDeliveryBookReq, - GetDeliveryCandlesticksReq, + GetDeliveryCandlesReq, GetDeliveryClosedPositionsReq, GetDeliveryLiquidationHistoryReq, GetDeliveryOrderBookReq, @@ -26,7 +26,6 @@ import { GetDeliveryTradesReq, GetDeliveryTradingHistoryReq, SubmitDeliveryFuturesOrderReq, - submitDeliveryTriggeredOrderReq, } from './types/request/delivery.js'; import { GetStructuredProductListReq, @@ -60,7 +59,7 @@ import { GetLiquidationHistoryReq, GetRiskLimitTiersReq, SubmitFuturesOrderReq, - SubmitFuturesPriceTriggeredOrderReq, + SubmitFuturesTriggeredOrderReq, UpdateDualModePositionLeverageReq, UpdateDualModePositionMarginReq, UpdateFuturesOrderReq, @@ -89,14 +88,14 @@ import { } from './types/request/multicollateralLoan.js'; import { GetOptionsAccountChangeReq, - GetOptionsCandlesticksReq, + GetOptionsCandlesReq, GetOptionsMySettlementsReq, GetOptionsOrderBookReq, GetOptionsOrdersReq, GetOptionsPersonalHistoryReq, GetOptionsSettlementHistoryReq, GetOptionsTradesReq, - GetOptionsUnderlyingCandlesticksReq, + GetOptionsUnderlyingCandlesReq, SubmitOptionsOrderReq, } from './types/request/options.js'; import { @@ -145,126 +144,126 @@ import { } from './types/request/wallet.js'; import { SubmitWithdrawReq } from './types/request/withdrawal.js'; import { - CreateStpGroupResp, - GetAccountDetailResp, - StpResp, + AccountDetail, + StpGroup, + StpGroupUser, } from './types/response/account.js'; import { - GetLoanCollateralizationRatioResp, - GetLoanCollateralRecordsResp, - GetLoanOrdersResp, - GetLoanRepaymentHistoryResp, + LoanCollateralRatio, + LoanCollateralRecord, + LoanOrder, + LoanRepaymentHistoryRecord, } from './types/response/collateralloan.js'; import { - GetDeliveryAccountResp, - GetDeliveryBookResp, - GetDeliveryCandlesticksResp, - GetDeliveryClosedPositionsResp, - GetDeliveryLiquidationHistoryResp, - GetDeliveryOrderBookResp, - GetDeliverySettlementHistoryResp, - GetDeliveryTickersResp, - GetDeliveryTradesResp, - GetDeliveryTradingHistoryResp, + DeliveryAccount, + DeliveryBook, + DeliveryCandle, + DeliveryClosedPosition, + DeliveryLiquidationHistoryRecord, + DeliveryOrderBook, + DeliverySettlementHistoryRecord, + DeliveryTicker, + DeliveryTrade, + DeliveryTradingHistoryRecord, } from './types/response/delivery.js'; import { - GetDualInvestmentOrdersResp, - GetDualInvestmentProductsResp, - GetStructuredProductListResp, - GetStructuredProductOrdersResp, + DualInvestmentOrder, + DualInvestmentProduct, + StructuredProduct, + StructuredProductOrder, } from './types/response/earn.js'; import { - GetLendingCurrenciesResp, - GetLendingInterestRecordsResp, - GetLendingOrdersResp, - GetLendingRecordsResp, + LendingCurrency, + LendingInterestRecord, + LendingOrder, + LendingRecord, } from './types/response/earnuni.js'; import { - FlashSwapOrderResp, - GetFlashSwapCurrencyPairsResp, + FlashSwapCurrencyPair, + FlashSwapOrder, SubmitFlashSwapOrderPreviewResp, } from './types/response/flashswap.js'; import { DeleteFuturesBatchOrdersResp, + FuturesAccount, + FuturesAutoDeleveragingHistoryRecord, FuturesCandle, FuturesContract, FuturesDeliveryContract, + FuturesLiquidationHistoryRecord, FuturesOrder, FuturesOrderBook, FuturesPosition, + FuturesPositionHistoryRecord, FuturesPriceTriggeredOrder, + FuturesStats, FuturesTicker, FuturesTrade, - GetFuturesAccountResp, - GetFuturesAutoDeleveragingHistoryResp, - GetFuturesLiquidationHistoryResp, - GetFuturesPositionHistoryResp, - GetFuturesStatsResp, - GetFuturesTradingHistoryResp, - GetIndexConstituentsResp, - GetLiquidationHistoryResp, - GetRiskLimitTiersResp, + FuturesTradingHistoryRecord, + IndexConstituents, + LiquidationHistoryRecord, PremiumIndexKLine, + RiskLimitTier, UpdateFuturesDualModeResp, } from './types/response/futures.js'; import { - GetCrossMarginAccountHistoryResp, - GetCrossMarginAccountResp, - GetCrossMarginCurrenciesResp, - GetMarginAccountsResp, - GetMarginBalanceHistoryResp, + CrossMarginAccount, + CrossMarginAccountHistoryRecord, + CrossMarginCurrency, + MarginAccount, + MarginBalanceHistoryRecord, SubmitCrossMarginBorrowLoanResp, } from './types/response/margin.js'; import { - GetLendingMarketsResp, - GetMarginUNIInterestRecordsResp, - GetMarginUNILoanRecordsResp, - GetMarginUNILoansResp, - GetMarginUNIMaxBorrowResp, + LendingMarket, + MarginUNIInterestRecord, + MarginUNILoan, + MarginUNILoanRecord, + MarginUNIMaxBorrowable, } from './types/response/marginuni.js'; import { - GetMultiLoanAdjustmentRecordsResp, - GetMultiLoanCurrencyQuotaResp, - GetMultiLoanFixedRatesResp, - GetMultiLoanOrdersResp, - GetMultiLoanRatioResp, - GetMultiLoanRepayRecordsResp, - GetMultiLoanSupportedCurrenciesResp, + MultiLoanAdjustmentRecord, + MultiLoanCurrencyQuota, + MultiLoanFixedRate, + MultiLoanOrder, + MultiLoanRatio, + MultiLoanRepayRecord, + MultiLoanSupportedCurrencies, RepayMultiLoanResp, UpdateMultiLoanResp, } from './types/response/multicollateralLoan.js'; import { - GetOptionsAccountChangeResp, - GetOptionsAccountResp, - GetOptionsCandlesticksResp, - GetOptionsContractsResp, GetOptionsLiquidationResp, - GetOptionsMySettlementsResp, - GetOptionsOrderBookResp, - GetOptionsPersonalHistoryResp, - GetOptionsPositionsUnderlyingResp, - GetOptionsSettlementHistoryResp, - GetOptionsTickersResp, - GetOptionsTradesResp, - GetOptionsUnderlyingCandlesticksResp, + OptionsAccount, + OptionsAccountChangeRecord, + OptionsCandle, + OptionsContract, + OptionsOrderBook, + OptionsPositionsUnderlying, + OptionsSettlementHistoryRecord, + OptionsTicker, + OptionsTrade, + OptionsUnderlyingCandle, + OptionsUserHistoryRecord, + OptionsUserSettlement, SubmitOptionsOrderResp, } from './types/response/options.js'; import { - GetAgencyCommissionHistoryResp, - GetAgencyTransactionHistoryResp, - GetBrokerCommissionHistoryResp, - GetBrokerTransactionHistoryResp, + AgencyCommissionHistoryRecord, + AgencyTransactionHistoryRecord, + BrokerCommissionHistoryRecord, + BrokerTransactionHistoryRecord, } from './types/response/rebate.js'; import { APIResponse } from './types/response/shared.types.js'; import { DeleteSpotBatchOrdersResp, GetSpotOpenOrdersResp, - GetSpotTradingHistoryResp, SpotAccount, SpotAccountBook, SpotCandle, SpotCurrency, SpotFeeRates, + SpotHistoricTradeRecord, SpotOrder, SpotOrderBook, SpotPriceTriggeredOrder, @@ -278,27 +277,27 @@ import { SubAccountAPIKey, } from './types/response/subaccount.js'; import { - GetUnifiedCurrencyDiscountTiersResp, - GetUnifiedRiskUnitDetailsResp, PortfolioMarginCalculation, UnifiedAccountInfo, + UnifiedCurrencyDiscountTiers, UnifiedInterestRecord, UnifiedLoan, UnifiedLoanRecord, + UnifiedRiskUnitDetails, } from './types/response/unified.js'; import { CreateDepositAddressResp, CurrencyChain, GetBalancesResp, - GetSmallBalanceHistoryResp, - GetTradingFeesResp, - GetWithdrawalStatusResp, SavedAddress, + SmallBalanceHistoryRecord, SmallBalanceRecord, SubAccountCrossMarginBalancesResp, SubAccountFuturesBalancesResp, - SubAccountMarginBalancesResp, + SubAccountMarginBalance, SubAccountTransferRecord, + TradingFees, + WithdrawalStatus, } from './types/response/wallet.js'; import { WithdrawalRecord } from './types/response/withdrawal.js'; import { CurrencyPair } from './types/shared.js'; @@ -484,7 +483,7 @@ export class RestClient extends BaseRestClient { */ getWithdrawalStatus(params?: { currency?: string; - }): Promise> { + }): Promise> { return this.getPrivate('/wallet/withdraw_status', params); } @@ -516,7 +515,9 @@ export class RestClient extends BaseRestClient { */ getSubMarginBalances(params?: { sub_uid?: string; - }): Promise> { + }): Promise< + APIResponse<{ uid: string; available: SubAccountMarginBalance[] }> + > { return this.getPrivate('/wallet/sub_account_margin_balances', params); } @@ -566,7 +567,7 @@ export class RestClient extends BaseRestClient { getTradingFees(params?: { currency_pair?: string; settle?: 'BTC' | 'USDT' | 'USD'; - }): Promise> { + }): Promise> { return this.getPrivate('/wallet/fee', params); } @@ -619,7 +620,7 @@ export class RestClient extends BaseRestClient { */ getSmallBalanceHistory( params?: GetSmallBalanceHistoryReq, - ): Promise> { + ): Promise> { return this.getPrivate('/wallet/small_balance_history', params); } @@ -863,9 +864,7 @@ export class RestClient extends BaseRestClient { * * @returns Promise> */ - getUnifiedRiskUnitDetails(): Promise< - APIResponse - > { + getUnifiedRiskUnitDetails(): Promise> { return this.getPrivate('/unified/risk_units'); } @@ -918,7 +917,7 @@ export class RestClient extends BaseRestClient { * @returns Promise> */ getUnifiedCurrencyDiscountTiers(): Promise< - APIResponse + APIResponse > { return this.get('/unified/currency_discount_tiers'); } @@ -1033,15 +1032,15 @@ export class RestClient extends BaseRestClient { } /** - * Market candlesticks + * Market Candles * * Maximum of 1000 points can be returned in a query. Be sure not to exceed the limit when specifying from, to and interval. * - * @param params Parameters for retrieving market candlesticks - * @returns Promise> + * @param params Parameters for retrieving market Candles + * @returns Promise> */ getSpotCandle(params: GetSpotCandlesReq): Promise> { - return this.get('/spot/candlesticks', params); + return this.get('/spot/Candles', params); } /** @@ -1264,7 +1263,7 @@ export class RestClient extends BaseRestClient { */ getSpotTradingHistory( params?: GetSpotTradingHistoryReq, - ): Promise> { + ): Promise> { return this.getPrivate('/spot/my_trades', params); } @@ -1396,7 +1395,7 @@ export class RestClient extends BaseRestClient { */ getMarginAccounts(params?: { currency_pair?: string; - }): Promise> { + }): Promise> { return this.getPrivate('/margin/accounts', params); } @@ -1410,7 +1409,7 @@ export class RestClient extends BaseRestClient { */ getMarginBalanceHistory( params?: GetMarginBalanceHistoryReq, - ): Promise> { + ): Promise> { return this.getPrivate('/margin/account_book', params); } @@ -1489,9 +1488,7 @@ export class RestClient extends BaseRestClient { * * @returns Promise> */ - getCrossMarginCurrencies(): Promise< - APIResponse - > { + getCrossMarginCurrencies(): Promise> { return this.get('/margin/cross/currencies'); } @@ -1503,7 +1500,7 @@ export class RestClient extends BaseRestClient { */ getCrossMarginCurrency(params: { currency: string; - }): Promise> { + }): Promise> { return this.get(`/margin/cross/currencies/${params.currency}`); } @@ -1512,7 +1509,7 @@ export class RestClient extends BaseRestClient { * * @returns Promise> */ - getCrossMarginAccount(): Promise> { + getCrossMarginAccount(): Promise> { return this.getPrivate('/margin/cross/accounts'); } @@ -1526,7 +1523,7 @@ export class RestClient extends BaseRestClient { */ getCrossMarginAccountHistory( params?: GetCrossMarginAccountHistoryReq, - ): Promise> { + ): Promise> { return this.getPrivate('/margin/cross/account_book', params); } @@ -1594,7 +1591,7 @@ export class RestClient extends BaseRestClient { */ getCrossMarginRepayments( params?: GetCrossMarginRepaymentsReq, - ): Promise> { + ): Promise> { return this.getPrivate('/margin/cross/repayments', params); } @@ -1669,7 +1666,7 @@ export class RestClient extends BaseRestClient { * * @returns Promise> */ - getLendingMarkets(): Promise> { + getLendingMarkets(): Promise> { return this.get('/margin/uni/currency_pairs'); } @@ -1686,7 +1683,7 @@ export class RestClient extends BaseRestClient { */ getLendingMarket(params: { currency_pair: string; - }): Promise> { + }): Promise> { return this.get(`/margin/uni/currency_pairs/${params.currency_pair}`); } @@ -1728,7 +1725,7 @@ export class RestClient extends BaseRestClient { */ getMarginUNILoans( params?: GetMarginUNILoansReq, - ): Promise> { + ): Promise> { return this.getPrivate('/margin/uni/loans', params); } @@ -1740,7 +1737,7 @@ export class RestClient extends BaseRestClient { */ getMarginUNILoanRecords( params?: GetMarginUNILoanRecordsReq, - ): Promise> { + ): Promise> { return this.getPrivate('/margin/uni/loan_records', params); } @@ -1752,7 +1749,7 @@ export class RestClient extends BaseRestClient { */ getMarginUNIInterestRecords( params?: GetMarginUNIInterestRecordsReq, - ): Promise> { + ): Promise> { return this.getPrivate('/margin/uni/interest_records', params); } @@ -1764,7 +1761,7 @@ export class RestClient extends BaseRestClient { */ getMarginUNIMaxBorrow( params: GetMarginUNIMaxBorrowReq, - ): Promise> { + ): Promise> { return this.getPrivate('/margin/uni/borrowable', params); } /**========================================================================================================================== @@ -1780,7 +1777,7 @@ export class RestClient extends BaseRestClient { */ getFlashSwapCurrencyPairs(params?: { currency?: string; - }): Promise> { + }): Promise> { return this.get('/flash_swap/currency_pairs', params); } @@ -1794,7 +1791,7 @@ export class RestClient extends BaseRestClient { */ submitFlashSwapOrder( params: SubmitFlashSwapOrderReq, - ): Promise> { + ): Promise> { return this.postPrivate('/flash_swap/orders', { body: params }); } @@ -1806,7 +1803,7 @@ export class RestClient extends BaseRestClient { */ getFlashSwapOrders( params?: GetFlashSwapOrdersReq, - ): Promise> { + ): Promise> { return this.getPrivate('/flash_swap/orders', params); } @@ -1818,7 +1815,7 @@ export class RestClient extends BaseRestClient { */ getFlashSwapOrder(params: { order_id: number; - }): Promise> { + }): Promise> { return this.getPrivate(`/flash_swap/orders/${params.order_id}`); } @@ -1896,20 +1893,20 @@ export class RestClient extends BaseRestClient { } /** - * Get futures candlesticks + * Get futures Candles * - * Return specified contract candlesticks. If prefix contract with mark_, the contract's mark price candlesticks are returned; if prefix with index_, index price candlesticks will be returned. + * Return specified contract Candles. If prefix contract with mark_, the contract's mark price Candles are returned; if prefix with index_, index price Candles will be returned. * * Maximum of 2000 points are returned in one query. Be sure not to exceed the limit when specifying from, to and interval. * - * @param params Parameters for retrieving futures candlesticks - * @returns Promise> + * @param params Parameters for retrieving futures Candles + * @returns Promise> */ getFuturesCandles( params: GetFuturesCandlesReq, ): Promise> { const { settle, ...query } = params; - return this.get(`/futures/${settle}/candlesticks`, query); + return this.get(`/futures/${settle}/Candles`, query); } /** @@ -1998,7 +1995,7 @@ export class RestClient extends BaseRestClient { */ getFuturesStats( params: GetFuturesStatsReq, - ): Promise> { + ): Promise> { const { settle, ...query } = params; return this.get(`/futures/${settle}/contract_stats`, query); } @@ -2012,7 +2009,7 @@ export class RestClient extends BaseRestClient { getIndexConstituents(params: { settle: 'btc' | 'usdt' | 'usd'; index: string; - }): Promise> { + }): Promise> { return this.get( `/futures/${params.settle}/index_constituents/${params.index}`, ); @@ -2028,7 +2025,7 @@ export class RestClient extends BaseRestClient { */ getLiquidationHistory( params: GetLiquidationHistoryReq, - ): Promise> { + ): Promise> { const { settle, ...query } = params; return this.get(`/futures/${settle}/liq_orders`, query); } @@ -2045,7 +2042,7 @@ export class RestClient extends BaseRestClient { */ getRiskLimitTiers( params: GetRiskLimitTiersReq, - ): Promise> { + ): Promise> { const { settle, ...query } = params; return this.get(`/futures/${settle}/risk_limit_tiers`, query); } @@ -2058,7 +2055,7 @@ export class RestClient extends BaseRestClient { */ getFuturesAccount(params: { settle: 'btc' | 'usdt' | 'usd'; - }): Promise> { + }): Promise> { return this.getPrivate(`/futures/${params.settle}/accounts`); } @@ -2389,7 +2386,7 @@ export class RestClient extends BaseRestClient { */ getFuturesTradingHistory( params: GetFuturesTradingHistoryReq, - ): Promise> { + ): Promise> { const { settle, ...query } = params; return this.getPrivate(`/futures/${settle}/my_trades`, query); } @@ -2402,7 +2399,7 @@ export class RestClient extends BaseRestClient { */ getFuturesPositionHistory( params: GetFuturesPositionHistoryReq, - ): Promise> { + ): Promise> { const { settle, ...query } = params; return this.getPrivate(`/futures/${settle}/position_close`, query); } @@ -2415,7 +2412,7 @@ export class RestClient extends BaseRestClient { */ getFuturesLiquidationHistory( params: GetFuturesLiquidationHistoryReq, - ): Promise> { + ): Promise> { const { settle, ...query } = params; return this.getPrivate(`/futures/${settle}/liquidates`, query); } @@ -2428,7 +2425,7 @@ export class RestClient extends BaseRestClient { */ getFuturesAutoDeleveragingHistory( params: GetFuturesLiquidationHistoryReq, - ): Promise> { + ): Promise> { const { settle, ...query } = params; return this.getPrivate(`/futures/${settle}/auto_deleverages`, query); } @@ -2493,7 +2490,7 @@ export class RestClient extends BaseRestClient { * @returns Promise> */ submitFuturesPriceTriggeredOrder( - params: SubmitFuturesPriceTriggeredOrderReq, + params: SubmitFuturesTriggeredOrderReq, ): Promise> { const { settle, ...body } = params; return this.postPrivate(`/futures/${settle}/price_orders`, { body: body }); @@ -2598,7 +2595,7 @@ export class RestClient extends BaseRestClient { */ getDeliveryOrderBook( params: GetDeliveryOrderBookReq, - ): Promise> { + ): Promise> { const { settle, ...query } = params; return this.get(`/delivery/${settle}/order_book`, query); } @@ -2611,25 +2608,25 @@ export class RestClient extends BaseRestClient { */ getDeliveryTrades( params: GetDeliveryTradesReq, - ): Promise> { + ): Promise> { const { settle, ...query } = params; return this.get(`/delivery/${settle}/trades`, query); } /** - * Get futures candlesticks + * Get futures Candles * - * Return specified contract candlesticks. If prefix contract with mark_, the contract's mark price candlesticks are returned; if prefix with index_, index price candlesticks will be returned. + * Return specified contract Candles. If prefix contract with mark_, the contract's mark price Candles are returned; if prefix with index_, index price Candles will be returned. * Maximum of 2000 points are returned in one query. Be sure not to exceed the limit when specifying from, to and interval. * - * @param params Parameters for retrieving futures candlesticks - * @returns Promise> + * @param params Parameters for retrieving futures Candles + * @returns Promise> */ - getDeliveryCandlesticks( - params: GetDeliveryCandlesticksReq, - ): Promise> { + getDeliveryCandles( + params: GetDeliveryCandlesReq, + ): Promise> { const { settle, ...query } = params; - return this.get(`/delivery/${settle}/candlesticks`, query); + return this.get(`/delivery/${settle}/Candles`, query); } /** @@ -2641,7 +2638,7 @@ export class RestClient extends BaseRestClient { getDeliveryTickers(params: { settle: 'usdt'; contract?: string; - }): Promise> { + }): Promise> { const { settle, ...query } = params; return this.get(`/delivery/${settle}/tickers`, query); } @@ -2678,7 +2675,7 @@ export class RestClient extends BaseRestClient { */ getDeliveryAccount(params: { settle: 'usdt'; - }): Promise> { + }): Promise> { const { settle, ...query } = params; return this.getPrivate(`/delivery/${settle}/accounts`, query); } @@ -2691,7 +2688,7 @@ export class RestClient extends BaseRestClient { */ getDeliveryBook( params: GetDeliveryBookReq, - ): Promise> { + ): Promise> { const { settle, ...query } = params; return this.getPrivate(`/delivery/${settle}/account_book`, query); } @@ -2865,7 +2862,7 @@ export class RestClient extends BaseRestClient { */ getDeliveryTradingHistory( params: GetDeliveryTradingHistoryReq, - ): Promise> { + ): Promise> { const { settle, ...query } = params; return this.getPrivate(`/delivery/${settle}/my_trades`, query); } @@ -2878,7 +2875,7 @@ export class RestClient extends BaseRestClient { */ getDeliveryClosedPositions( params: GetDeliveryClosedPositionsReq, - ): Promise> { + ): Promise> { const { settle, ...query } = params; return this.getPrivate(`/delivery/${settle}/position_close`, query); } @@ -2891,7 +2888,7 @@ export class RestClient extends BaseRestClient { */ getDeliveryLiquidationHistory( params: GetDeliveryLiquidationHistoryReq, - ): Promise> { + ): Promise> { const { settle, ...query } = params; return this.getPrivate(`/delivery/${settle}/liquidates`, query); } @@ -2904,7 +2901,7 @@ export class RestClient extends BaseRestClient { */ getDeliverySettlementHistory( params: GetDeliverySettlementHistoryReq, - ): Promise> { + ): Promise> { const { settle, ...query } = params; return this.getPrivate(`/delivery/${settle}/settlements`, query); } @@ -2916,7 +2913,7 @@ export class RestClient extends BaseRestClient { * @returns Promise> */ submitDeliveryTriggeredOrder( - params: submitDeliveryTriggeredOrderReq, + params: SubmitFuturesTriggeredOrderReq, ): Promise> { const { settle, ...body } = params; return this.postPrivate(`/delivery/${settle}/price_orders`, { @@ -3020,7 +3017,7 @@ export class RestClient extends BaseRestClient { getOptionsContracts(params: { underlying: string; expiration?: number; - }): Promise> { + }): Promise> { return this.get(`/options/contracts`, params); } @@ -3032,7 +3029,7 @@ export class RestClient extends BaseRestClient { */ getOptionsContract(params: { contract: string; - }): Promise> { + }): Promise> { return this.get(`/options/contracts/${params.contract}`); } @@ -3044,7 +3041,7 @@ export class RestClient extends BaseRestClient { */ getOptionsSettlementHistory( params: GetOptionsSettlementHistoryReq, - ): Promise> { + ): Promise> { return this.get(`/options/settlements`, params); } @@ -3058,7 +3055,7 @@ export class RestClient extends BaseRestClient { contract: string; underlying: string; at: number; - }): Promise> { + }): Promise> { const { contract, ...query } = params; return this.get(`/options/settlements/${contract}`, query); } @@ -3071,7 +3068,7 @@ export class RestClient extends BaseRestClient { */ getOptionsMySettlements( params: GetOptionsMySettlementsReq, - ): Promise> { + ): Promise> { return this.getPrivate(`/options/my_settlements`, params); } @@ -3085,7 +3082,7 @@ export class RestClient extends BaseRestClient { */ getOptionsOrderBook( params: GetOptionsOrderBookReq, - ): Promise> { + ): Promise> { return this.get(`/options/order_book`, params); } @@ -3097,7 +3094,7 @@ export class RestClient extends BaseRestClient { */ getOptionsTickers(params: { underlying: string; - }): Promise> { + }): Promise> { return this.get(`/options/tickers`, params); } @@ -3122,27 +3119,27 @@ export class RestClient extends BaseRestClient { } /** - * Get options candlesticks + * Get options Candles * - * @param params Parameters for retrieving options candlesticks - * @returns Promise> + * @param params Parameters for retrieving options Candles + * @returns Promise> */ - getOptionsCandlesticks( - params: GetOptionsCandlesticksReq, - ): Promise> { - return this.get(`/options/candlesticks`, params); + getOptionsCandles( + params: GetOptionsCandlesReq, + ): Promise> { + return this.get(`/options/Candles`, params); } /** - * Mark price candlesticks of an underlying + * Mark price Candles of an underlying * - * @param params Parameters for retrieving mark price candlesticks of an underlying - * @returns Promise> + * @param params Parameters for retrieving mark price Candles of an underlying + * @returns Promise> */ - getOptionsUnderlyingCandlesticks( - params: GetOptionsUnderlyingCandlesticksReq, - ): Promise> { - return this.get(`/options/underlying/candlesticks`, params); + getOptionsUnderlyingCandles( + params: GetOptionsUnderlyingCandlesReq, + ): Promise> { + return this.get(`/options/underlying/Candles`, params); } /** @@ -3153,7 +3150,7 @@ export class RestClient extends BaseRestClient { */ getOptionsTrades( params: GetOptionsTradesReq, - ): Promise> { + ): Promise> { return this.get(`/options/trades`, params); } @@ -3162,7 +3159,7 @@ export class RestClient extends BaseRestClient { * * @returns Promise> */ - getOptionsAccount(): Promise> { + getOptionsAccount(): Promise> { return this.getPrivate(`/options/accounts`); } @@ -3174,7 +3171,7 @@ export class RestClient extends BaseRestClient { */ getOptionsAccountChange( params?: GetOptionsAccountChangeReq, - ): Promise> { + ): Promise> { return this.getPrivate(`/options/account_book`, params); } @@ -3186,7 +3183,7 @@ export class RestClient extends BaseRestClient { */ getOptionsPositionsUnderlying(params: { underlying?: string; - }): Promise> { + }): Promise> { return this.getPrivate(`/options/positions`, params); } @@ -3198,7 +3195,7 @@ export class RestClient extends BaseRestClient { */ getOptionsPositionContract(params: { contract: string; - }): Promise> { + }): Promise> { return this.getPrivate(`/options/positions/${params.contract}`); } @@ -3285,7 +3282,7 @@ export class RestClient extends BaseRestClient { */ getOptionsPersonalHistory( params: GetOptionsPersonalHistoryReq, - ): Promise> { + ): Promise> { return this.getPrivate(`/options/my_trades`, params); } @@ -3299,7 +3296,7 @@ export class RestClient extends BaseRestClient { * * @returns Promise> */ - getLendingCurrencies(): Promise> { + getLendingCurrencies(): Promise> { return this.get(`/earn/uni/currencies`); } @@ -3311,7 +3308,7 @@ export class RestClient extends BaseRestClient { */ getLendingCurrency(params: { currency: string; - }): Promise> { + }): Promise> { return this.get(`/earn/uni/currencies/${params.currency}`); } @@ -3333,7 +3330,7 @@ export class RestClient extends BaseRestClient { */ getLendingOrders( params?: GetLendingOrdersReq, - ): Promise> { + ): Promise> { return this.getPrivate(`/earn/uni/lends`, params); } @@ -3360,7 +3357,7 @@ export class RestClient extends BaseRestClient { */ getLendingRecords( params?: GetLendingRecordsReq, - ): Promise> { + ): Promise> { return this.getPrivate(`/earn/uni/lend_records`, params); } @@ -3390,7 +3387,7 @@ export class RestClient extends BaseRestClient { */ getLendingInterestRecords( params?: GetLendingInterestRecordsReq, - ): Promise> { + ): Promise> { return this.getPrivate(`/earn/uni/interest_records`, params); } @@ -3448,9 +3445,7 @@ export class RestClient extends BaseRestClient { * @param params Parameters for listing orders * @returns Promise> */ - getLoanOrders( - params?: GetLoanOrdersReq, - ): Promise> { + getLoanOrders(params?: GetLoanOrdersReq): Promise> { return this.getPrivate(`/loan/collateral/orders`, params); } /** @@ -3459,9 +3454,7 @@ export class RestClient extends BaseRestClient { * @param params Parameters for retrieving a single order * @returns Promise> */ - getLoanOrder(params: { - order_id: number; - }): Promise> { + getLoanOrder(params: { order_id: number }): Promise> { return this.getPrivate(`/loan/collateral/orders/${params.order_id}`); } @@ -3495,7 +3488,7 @@ export class RestClient extends BaseRestClient { */ getLoanRepaymentHistory( params: GetLoanRepaymentHistoryReq, - ): Promise> { + ): Promise> { return this.getPrivate(`/loan/collateral/repay_records`, params); } @@ -3519,7 +3512,7 @@ export class RestClient extends BaseRestClient { */ getLoanCollateralRecords( params?: GetLoanCollateralRecordsReq, - ): Promise> { + ): Promise> { return this.getPrivate(`/loan/collateral/collaterals`, params); } @@ -3549,7 +3542,7 @@ export class RestClient extends BaseRestClient { getLoanCollateralizationRatio(params: { collateral_currency: string; borrow_currency: string; - }): Promise> { + }): Promise> { return this.getPrivate(`/loan/collateral/ltv`, params); } @@ -3598,7 +3591,7 @@ export class RestClient extends BaseRestClient { */ getMultiLoanOrders( params?: GetMultiLoanOrdersReq, - ): Promise> { + ): Promise> { return this.getPrivate(`/loan/multi_collateral/orders`, params); } @@ -3610,7 +3603,7 @@ export class RestClient extends BaseRestClient { */ getMultiLoanOrder(params: { order_id: string; - }): Promise> { + }): Promise> { return this.getPrivate(`/loan/multi_collateral/orders/${params.order_id}`); } @@ -3634,7 +3627,7 @@ export class RestClient extends BaseRestClient { */ getMultiLoanRepayRecords( params: GetMultiLoanRepayRecordsReq, - ): Promise> { + ): Promise> { return this.getPrivate(`/loan/multi_collateral/repay`, params); } @@ -3660,7 +3653,7 @@ export class RestClient extends BaseRestClient { */ getMultiLoanAdjustmentRecords( params?: GetMultiLoanAdjustmentRecordsReq, - ): Promise> { + ): Promise> { return this.getPrivate(`/loan/multi_collateral/mortgage`, params); } @@ -3673,7 +3666,7 @@ export class RestClient extends BaseRestClient { getMultiLoanCurrencyQuota(params: { type: 'collateral' | 'borrow'; currency: string; - }): Promise> { + }): Promise> { return this.getPrivate(`/loan/multi_collateral/currency_quota`, params); } @@ -3683,7 +3676,7 @@ export class RestClient extends BaseRestClient { * @returns Promise> */ getMultiLoanSupportedCurrencies(): Promise< - APIResponse + APIResponse > { return this.get(`/loan/multi_collateral/currencies`); } @@ -3693,7 +3686,7 @@ export class RestClient extends BaseRestClient { * * @returns Promise> */ - getMultiLoanRatio(): Promise> { + getMultiLoanRatio(): Promise> { return this.get(`/loan/multi_collateral/ltv`); } @@ -3702,7 +3695,7 @@ export class RestClient extends BaseRestClient { * * @returns Promise> */ - getMultiLoanFixedRates(): Promise> { + getMultiLoanFixedRates(): Promise> { return this.get(`/loan/multi_collateral/fixed_rate`); } @@ -3729,9 +3722,7 @@ export class RestClient extends BaseRestClient { * * @returns Promise> */ - getDualInvestmentProducts(): Promise< - APIResponse - > { + getDualInvestmentProducts(): Promise> { return this.get(`/earn/dual/investment_plan`); } @@ -3740,9 +3731,7 @@ export class RestClient extends BaseRestClient { * * @returns Promise> */ - getDualInvestmentOrders(): Promise< - APIResponse - > { + getDualInvestmentOrders(): Promise> { return this.getPrivate(`/earn/dual/orders`); } /** @@ -3766,7 +3755,7 @@ export class RestClient extends BaseRestClient { */ getStructuredProductList( params: GetStructuredProductListReq, - ): Promise> { + ): Promise> { return this.get(`/earn/structured/products`, params); } @@ -3778,7 +3767,7 @@ export class RestClient extends BaseRestClient { */ getStructuredProductOrders( params?: GetStructuredProductOrdersReq, - ): Promise> { + ): Promise> { return this.getPrivate(`/earn/structured/orders`, params); } /** @@ -3804,7 +3793,7 @@ export class RestClient extends BaseRestClient { * * @returns Promise> */ - getAccountDetail(): Promise> { + getAccountDetail(): Promise> { return this.getPrivate(`/account/detail`); } @@ -3814,9 +3803,7 @@ export class RestClient extends BaseRestClient { * @param params Parameters for creating an STP group * @returns Promise> */ - createStpGroup( - params: CreateStpGroupReq, - ): Promise> { + createStpGroup(params: CreateStpGroupReq): Promise> { return this.postPrivate(`/account/stp_groups`, { body: params }); } @@ -3826,9 +3813,7 @@ export class RestClient extends BaseRestClient { * @param params Parameters for listing STP groups * @returns Promise> */ - getStpGroups(params?: { - name?: string; - }): Promise> { + getStpGroups(params?: { name?: string }): Promise> { return this.getPrivate(`/account/stp_groups`, params); } @@ -3840,7 +3825,7 @@ export class RestClient extends BaseRestClient { */ getStpGroupUsers(params: { stp_id: number; - }): Promise> { + }): Promise> { return this.getPrivate(`/account/stp_groups/${params.stp_id}/users`); } @@ -3853,7 +3838,7 @@ export class RestClient extends BaseRestClient { addUsersToStpGroup(params: { stp_id: number; body: number[]; - }): Promise> { + }): Promise> { const { stp_id, ...body } = params; return this.postPrivate(`/account/stp_groups/${stp_id}/users`, { body: body, @@ -3869,7 +3854,7 @@ export class RestClient extends BaseRestClient { deleteUserFromStpGroup(params: { stp_id: number; user_id: number; - }): Promise> { + }): Promise> { const { stp_id, ...query } = params; return this.deletePrivate(`/account/stp_groups/${stp_id}/users`, { query: query, @@ -3890,7 +3875,9 @@ export class RestClient extends BaseRestClient { */ getAgencyTransactionHistory( params: GetAgencyTransactionHistoryReq, - ): Promise> { + ): Promise< + APIResponse<{ total: number; list: AgencyTransactionHistoryRecord[] }> + > { return this.getPrivate('/rebate/agency/transaction_history', params); } @@ -3903,7 +3890,9 @@ export class RestClient extends BaseRestClient { */ getAgencyCommissionHistory( params: GetAgencyCommissionHistoryReq, - ): Promise> { + ): Promise< + APIResponse<{ total: number; list: AgencyCommissionHistoryRecord[] }> + > { return this.getPrivate('/rebate/agency/commission_history', params); } @@ -3916,7 +3905,9 @@ export class RestClient extends BaseRestClient { */ getBrokerCommissionHistory( params: GetBrokerCommissionHistoryReq, - ): Promise> { + ): Promise< + APIResponse<{ total: number; list: BrokerCommissionHistoryRecord[] }> + > { return this.getPrivate('/rebate/broker/commission_history', params); } @@ -3929,7 +3920,9 @@ export class RestClient extends BaseRestClient { */ getBrokerTransactionHistory( params: GetBrokerTransactionHistoryReq, - ): Promise> { + ): Promise< + APIResponse<{ total: number; list: BrokerTransactionHistoryRecord[] }> + > { return this.getPrivate('/rebate/broker/transaction_history', params); } diff --git a/src/types/request/delivery.ts b/src/types/request/delivery.ts index 8dbed11..ca621c3 100644 --- a/src/types/request/delivery.ts +++ b/src/types/request/delivery.ts @@ -3,8 +3,6 @@ * ========================================================================================================================== */ -import { FuturesPriceTriggeredOrder } from '../shared'; - export interface GetDeliveryOrderBookReq { settle: 'usdt'; contract: string; @@ -22,7 +20,7 @@ export interface GetDeliveryTradesReq { to?: number; } -export interface GetDeliveryCandlesticksReq { +export interface GetDeliveryCandlesReq { settle: 'usdt'; contract: string; from?: number; @@ -117,12 +115,6 @@ export interface GetDeliverySettlementHistoryReq { limit?: number; at?: number; } - -export interface submitDeliveryTriggeredOrderReq - extends FuturesPriceTriggeredOrder { - settle: 'usdt'; -} - export interface GetDeliveryAutoOrdersReq { settle: 'usdt'; status: 'open' | 'finished'; diff --git a/src/types/request/futures.ts b/src/types/request/futures.ts index 37aa0c1..f20bf7d 100644 --- a/src/types/request/futures.ts +++ b/src/types/request/futures.ts @@ -3,8 +3,6 @@ * ========================================================================================================================== */ -import { FuturesPriceTriggeredOrder } from '../response/futures'; - export interface GetFuturesOrderBookReq { settle: 'btc' | 'usdt' | 'usd'; contract: string; @@ -168,8 +166,31 @@ export interface GetFuturesLiquidationHistoryReq { at?: number; } -export interface SubmitFuturesPriceTriggeredOrderReq - extends FuturesPriceTriggeredOrder { +export interface SubmitFuturesTriggeredOrderReq { + initial: { + contract: string; + size?: number; + price?: string; + close?: boolean; + tif?: 'gtc' | 'ioc'; + text?: string; + reduce_only?: boolean; + auto_size?: string; + }; + trigger: { + strategy_type?: 0 | 1; + price_type?: 0 | 1 | 2; + price?: string; + rule?: 1 | 2; + expiration?: number; + }; + order_type?: + | 'close-long-order' + | 'close-short-order' + | 'close-long-position' + | 'close-short-position' + | 'plan-close-long-position' + | 'plan-close-short-position'; settle: 'btc' | 'usdt' | 'usd'; } diff --git a/src/types/request/options.ts b/src/types/request/options.ts index 98f4a85..977bd21 100644 --- a/src/types/request/options.ts +++ b/src/types/request/options.ts @@ -25,7 +25,7 @@ export interface GetOptionsOrderBookReq { with_id?: boolean; } -export interface GetOptionsCandlesticksReq { +export interface GetOptionsCandlesReq { contract: string; limit?: number; from?: number; @@ -33,7 +33,7 @@ export interface GetOptionsCandlesticksReq { interval?: '1m' | '5m' | '15m' | '30m' | '1h'; } -export interface GetOptionsUnderlyingCandlesticksReq { +export interface GetOptionsUnderlyingCandlesReq { underlying: string; limit?: number; from?: number; diff --git a/src/types/request/shared.types.ts b/src/types/request/shared.types.ts deleted file mode 100644 index e69de29..0000000 diff --git a/src/types/request/subaccount.ts b/src/types/request/subaccount.ts index 8f3c00a..ff9de9d 100644 --- a/src/types/request/subaccount.ts +++ b/src/types/request/subaccount.ts @@ -25,6 +25,6 @@ export interface CreateSubAccountApiKeyReq { ip_whitelist?: string[]; // IP white list } -export interface UpdateSubAccountApiKeyReq extends CreateSubAccountApiKeyReq { +export type UpdateSubAccountApiKeyReq = { key: string; -} +} & CreateSubAccountApiKeyReq; diff --git a/src/types/response/account.ts b/src/types/response/account.ts index 64cf16a..e43925f 100644 --- a/src/types/response/account.ts +++ b/src/types/response/account.ts @@ -3,7 +3,7 @@ * ========================================================================================================================== */ -export interface GetAccountDetailResp { +export interface AccountDetail { user_id: number; ip_whitelist: string[]; currency_pairs: string[]; @@ -13,14 +13,14 @@ export interface GetAccountDetailResp { tier: number; } -export interface CreateStpGroupResp { +export interface StpGroup { id: number; name: string; creator_id: number; create_time: number; } -export interface StpResp { +export interface StpGroupUser { user_id: number; stp_id: number; create_time: number; diff --git a/src/types/response/collateralloan.ts b/src/types/response/collateralloan.ts index ceac447..6050e16 100644 --- a/src/types/response/collateralloan.ts +++ b/src/types/response/collateralloan.ts @@ -3,7 +3,7 @@ * ========================================================================================================================== */ -export interface GetLoanOrdersResp { +export interface LoanOrder { order_id: number; collateral_currency: string; collateral_amount: string; @@ -22,7 +22,7 @@ export interface GetLoanOrdersResp { left_repay_interest: string; } -export interface GetLoanRepaymentHistoryResp { +export interface LoanRepaymentHistoryRecord { order_id: number; record_id: number; repaid_amount: string; @@ -38,7 +38,7 @@ export interface GetLoanRepaymentHistoryResp { after_left_collateral: string; } -export interface GetLoanCollateralRecordsResp { +export interface LoanCollateralRecord { order_id: number; record_id: number; borrow_currency: string; @@ -51,7 +51,7 @@ export interface GetLoanCollateralRecordsResp { operate_time: number; } -export interface GetLoanCollateralizationRatioResp { +export interface LoanCollateralRatio { collateral_currency: string; borrow_currency: string; init_ltv: string; diff --git a/src/types/response/delivery.ts b/src/types/response/delivery.ts index 9681f67..5d8b42f 100644 --- a/src/types/response/delivery.ts +++ b/src/types/response/delivery.ts @@ -3,7 +3,7 @@ * ========================================================================================================================== */ -export interface GetDeliveryOrderBookResp { +export interface DeliveryOrderBook { id?: number; current: number; update: number; @@ -11,7 +11,7 @@ export interface GetDeliveryOrderBookResp { bids: { p: string; s: number }[]; } -export interface GetDeliveryTradesResp { +export interface DeliveryTrade { id: number; create_time: number; create_time_ms: number; @@ -21,7 +21,7 @@ export interface GetDeliveryTradesResp { is_internal?: boolean; } -export interface GetDeliveryCandlesticksResp { +export interface DeliveryCandle { t: number; v?: number; c: string; @@ -30,7 +30,7 @@ export interface GetDeliveryCandlesticksResp { o: string; } -export interface GetDeliveryTickersResp { +export interface DeliveryTicker { contract: string; last: string; change_percentage: string; @@ -54,7 +54,7 @@ export interface GetDeliveryTickersResp { highest_bid: string; } -export interface GetDeliveryAccountResp { +export interface DeliveryAccount { total: string; unrealised_pnl: string; position_margin: string; @@ -82,7 +82,7 @@ export interface GetDeliveryAccountResp { }; } -export interface GetDeliveryBookResp { +export interface DeliveryBook { time: number; change: string; balance: string; @@ -101,7 +101,7 @@ export interface GetDeliveryBookResp { trade_id?: string; } -export interface GetDeliveryTradingHistoryResp { +export interface DeliveryTradingHistoryRecord { id: number; create_time: number; contract: string; @@ -114,7 +114,7 @@ export interface GetDeliveryTradingHistoryResp { point_fee: string; } -export interface GetDeliveryClosedPositionsResp { +export interface DeliveryClosedPosition { time: number; contract: string; side: 'long' | 'short'; @@ -129,7 +129,7 @@ export interface GetDeliveryClosedPositionsResp { short_price: string; } -export interface GetDeliveryLiquidationHistoryResp { +export interface DeliveryLiquidationHistoryRecord { time: number; contract: string; leverage?: string; @@ -144,7 +144,7 @@ export interface GetDeliveryLiquidationHistoryResp { left: number; } -export interface GetDeliverySettlementHistoryResp { +export interface DeliverySettlementHistoryRecord { time: number; contract: string; leverage: string; diff --git a/src/types/response/earn.ts b/src/types/response/earn.ts index 2311cc7..808c3d8 100644 --- a/src/types/response/earn.ts +++ b/src/types/response/earn.ts @@ -3,7 +3,7 @@ * ========================================================================================================================== */ -export interface GetDualInvestmentProductsResp { +export interface DualInvestmentProduct { id: number; instrument_name: string; invest_currency: string; @@ -19,7 +19,7 @@ export interface GetDualInvestmentProductsResp { status: 'NOTSTARTED' | 'ONGOING' | 'ENDED'; } -export interface GetDualInvestmentOrdersResp { +export interface DualInvestmentOrder { id: number; plan_id: number; copies: string; @@ -43,7 +43,7 @@ export interface GetDualInvestmentOrdersResp { delivery_time: number; } -export interface GetStructuredProductListResp { +export interface StructuredProduct { id: number; type: string; name_en: string; @@ -58,7 +58,7 @@ export interface GetStructuredProductListResp { status: 'in_process' | 'will_begin' | 'wait_settlement' | 'done'; } -export interface GetStructuredProductOrdersResp { +export interface StructuredProductOrder { id: number; pid: string; lock_coin: string; diff --git a/src/types/response/earnuni.ts b/src/types/response/earnuni.ts index dea8e49..922bafc 100644 --- a/src/types/response/earnuni.ts +++ b/src/types/response/earnuni.ts @@ -3,7 +3,7 @@ * ========================================================================================================================== */ -export interface GetLendingCurrenciesResp { +export interface LendingCurrency { currency: string; min_lend_amount: string; max_lend_amount: string; @@ -11,7 +11,7 @@ export interface GetLendingCurrenciesResp { min_rate: string; } -export interface GetLendingOrdersResp { +export interface LendingOrder { currency: string; current_amount: string; amount: string; @@ -24,7 +24,7 @@ export interface GetLendingOrdersResp { update_time: number; } -export interface GetLendingRecordsResp { +export interface LendingRecord { currency: string; amount: string; last_wallet_amount: string; @@ -34,7 +34,7 @@ export interface GetLendingRecordsResp { create_time: number; } -export interface GetLendingInterestRecordsResp { +export interface LendingInterestRecord { status: number; currency: string; actual_rate: string; diff --git a/src/types/response/flashswap.ts b/src/types/response/flashswap.ts index 08e9b5e..74f43ff 100644 --- a/src/types/response/flashswap.ts +++ b/src/types/response/flashswap.ts @@ -3,7 +3,7 @@ * ========================================================================================================================== */ -export interface GetFlashSwapCurrencyPairsResp { +export interface FlashSwapCurrencyPair { currency_pair: string; sell_currency: string; buy_currency: string; @@ -13,7 +13,7 @@ export interface GetFlashSwapCurrencyPairsResp { buy_max_amount: string; } -export interface FlashSwapOrderResp { +export interface FlashSwapOrder { id: number; create_time: number; user_id: number; diff --git a/src/types/response/futures.ts b/src/types/response/futures.ts index 6bd4c96..59c70c1 100644 --- a/src/types/response/futures.ts +++ b/src/types/response/futures.ts @@ -63,7 +63,7 @@ export interface FuturesTicker { highest_bid: string; } -export interface GetFuturesStatsResp { +export interface FuturesStats { time: number; lsr_taker: number; lsr_account: number; @@ -79,7 +79,7 @@ export interface GetFuturesStatsResp { top_lsr_size: number; } -export interface GetIndexConstituentsResp { +export interface IndexConstituents { index: string; constituents: { exchange: string; @@ -87,7 +87,7 @@ export interface GetIndexConstituentsResp { }[]; } -export interface GetLiquidationHistoryResp { +export interface LiquidationHistoryRecord { time: number; contract: string; size: number; @@ -96,7 +96,7 @@ export interface GetLiquidationHistoryResp { left: number; } -export interface GetRiskLimitTiersResp { +export interface RiskLimitTier { tier: number; risk_limit: string; initial_rate: string; @@ -105,7 +105,7 @@ export interface GetRiskLimitTiersResp { contract: string; } -export interface GetFuturesAccountResp { +export interface FuturesAccount { total: string; unrealised_pnl: string; position_margin: string; @@ -133,7 +133,7 @@ export interface GetFuturesAccountResp { }; } -export interface GetFuturesAccountBookResp { +export interface FuturesAccountBookRecord { time: number; change: string; balance: string; @@ -246,7 +246,7 @@ export interface FuturesPosition { open_time?: number; } -export interface GetFuturesTradingHistoryResp { +export interface FuturesTradingHistoryRecord { id: number; create_time: number; contract: string; @@ -259,7 +259,7 @@ export interface GetFuturesTradingHistoryResp { point_fee: string; } -export interface GetFuturesPositionHistoryResp { +export interface FuturesPositionHistoryRecord { time: number; contract: string; side: 'long' | 'short'; @@ -274,7 +274,7 @@ export interface GetFuturesPositionHistoryResp { short_price: string; } -export interface GetFuturesLiquidationHistoryResp { +export interface FuturesLiquidationHistoryRecord { time: number; contract: string; leverage: string; @@ -288,7 +288,7 @@ export interface GetFuturesLiquidationHistoryResp { fill_price: string; left: number; } -export interface GetFuturesAutoDeleveragingHistoryResp { +export interface FuturesAutoDeleveragingHistoryRecord { time: number; user: number; order_id: number; diff --git a/src/types/response/margin.ts b/src/types/response/margin.ts index 6190117..60dae54 100644 --- a/src/types/response/margin.ts +++ b/src/types/response/margin.ts @@ -3,7 +3,7 @@ * ========================================================================================================================== */ -export interface GetMarginAccountsResp { +export interface MarginAccount { currency_pair: string; locked: boolean; risk: string; @@ -23,7 +23,7 @@ export interface GetMarginAccountsResp { }; } -export interface GetMarginBalanceHistoryResp { +export interface MarginBalanceHistoryRecord { id: string; time: string; time_ms: number; @@ -34,7 +34,7 @@ export interface GetMarginBalanceHistoryResp { type: string; } -export interface GetCrossMarginCurrenciesResp { +export interface CrossMarginCurrency { name: string; rate: string; prec: string; @@ -47,7 +47,7 @@ export interface GetCrossMarginCurrenciesResp { status: number; } -export interface GetCrossMarginAccountResp { +export interface CrossMarginAccount { user_id: number; refresh_time: number; locked: boolean; @@ -79,7 +79,7 @@ export interface GetCrossMarginAccountResp { portfolio_margin_total_equity: string; } -export interface GetCrossMarginAccountHistoryResp { +export interface CrossMarginAccountHistoryRecord { id: string; time: number; currency: string; diff --git a/src/types/response/marginuni.ts b/src/types/response/marginuni.ts index c7de663..724b96b 100644 --- a/src/types/response/marginuni.ts +++ b/src/types/response/marginuni.ts @@ -3,14 +3,14 @@ * ========================================================================================================================== */ -export interface GetLendingMarketsResp { +export interface LendingMarket { currency_pair: string; base_min_borrow_amount: string; quote_min_borrow_amount: string; leverage: string; } -export interface GetMarginUNILoansResp { +export interface MarginUNILoan { currency: string; currency_pair: string; amount: string; @@ -19,7 +19,7 @@ export interface GetMarginUNILoansResp { update_time: number; } -export interface GetMarginUNILoanRecordsResp { +export interface MarginUNILoanRecord { type: string; currency_pair: string; currency: string; @@ -27,7 +27,7 @@ export interface GetMarginUNILoanRecordsResp { create_time: number; } -export interface GetMarginUNIInterestRecordsResp { +export interface MarginUNIInterestRecord { currency: string; currency_pair: string; actual_rate: string; @@ -37,7 +37,7 @@ export interface GetMarginUNIInterestRecordsResp { create_time: number; } -export interface GetMarginUNIMaxBorrowResp { +export interface MarginUNIMaxBorrowable { currency: string; currency_pair: string; borrowable: string; diff --git a/src/types/response/multicollateralLoan.ts b/src/types/response/multicollateralLoan.ts index 07952d3..56164b1 100644 --- a/src/types/response/multicollateralLoan.ts +++ b/src/types/response/multicollateralLoan.ts @@ -3,7 +3,7 @@ * ========================================================================================================================== */ -export interface GetMultiLoanOrdersResp { +export interface MultiLoanOrder { order_id: string; order_type: string; fixed_type: string; @@ -43,7 +43,7 @@ export interface RepayMultiLoanResp { }[]; } -export interface GetMultiLoanRepayRecordsResp { +export interface MultiLoanRepayRecord { order_id: number; record_id: number; init_ltv: string; @@ -102,7 +102,7 @@ export interface UpdateMultiLoanResp { }[]; } -export interface GetMultiLoanAdjustmentRecordsResp { +export interface MultiLoanAdjustmentRecord { order_id: number; record_id: number; before_ltv: string; @@ -126,7 +126,7 @@ export interface GetMultiLoanAdjustmentRecordsResp { }[]; } -export interface GetMultiLoanCurrencyQuotaResp { +export interface MultiLoanCurrencyQuota { currency: string; index_price: string; min_quota: string; @@ -134,7 +134,7 @@ export interface GetMultiLoanCurrencyQuotaResp { left_quote_usdt: string; } -export interface GetMultiLoanSupportedCurrenciesResp { +export interface MultiLoanSupportedCurrencies { loan_currencies: { currency: string; price: string; @@ -146,13 +146,13 @@ export interface GetMultiLoanSupportedCurrenciesResp { }[]; } -export interface GetMultiLoanRatioResp { +export interface MultiLoanRatio { init_ltv: string; alert_ltv: string; liquidate_ltv: string; } -export interface GetMultiLoanFixedRatesResp { +export interface MultiLoanFixedRate { currency: string; rate_7d: string; rate_30d: string; diff --git a/src/types/response/options.ts b/src/types/response/options.ts index 5406283..c40e9b3 100644 --- a/src/types/response/options.ts +++ b/src/types/response/options.ts @@ -3,7 +3,7 @@ * ========================================================================================================================== */ -export interface GetOptionsContractsResp { +export interface OptionsContract { name: string; tag: string; create_time: number; @@ -32,7 +32,7 @@ export interface GetOptionsContractsResp { orders_limit: number; } -export interface GetOptionsSettlementHistoryResp { +export interface OptionsSettlementHistoryRecord { time: number; contract: string; profit: string; @@ -41,7 +41,7 @@ export interface GetOptionsSettlementHistoryResp { settle_price: string; } -export interface GetOptionsMySettlementsResp { +export interface OptionsUserSettlement { time: number; underlying: string; contract: string; @@ -53,7 +53,7 @@ export interface GetOptionsMySettlementsResp { realised_pnl: string; } -export interface GetOptionsOrderBookResp { +export interface OptionsOrderBook { id?: number; current: number; update: number; @@ -61,7 +61,7 @@ export interface GetOptionsOrderBookResp { bids: { p: string; s: number }[]; } -export interface GetOptionsTickersResp { +export interface OptionsTicker { name: string; last_price: string; mark_price: string; @@ -82,7 +82,7 @@ export interface GetOptionsTickersResp { rho: string; } -export interface GetOptionsCandlesticksResp { +export interface OptionsCandle { t: number; v?: number; c: string; @@ -91,7 +91,7 @@ export interface GetOptionsCandlesticksResp { o: string; } -export interface GetOptionsUnderlyingCandlesticksResp { +export interface OptionsUnderlyingCandle { t: number; v?: number; c: string; @@ -101,7 +101,7 @@ export interface GetOptionsUnderlyingCandlesticksResp { sum: string; } -export interface GetOptionsTradesResp { +export interface OptionsTrade { id: number; create_time: number; create_time_ms: number; @@ -111,7 +111,7 @@ export interface GetOptionsTradesResp { is_internal?: boolean; } -export interface GetOptionsAccountResp { +export interface OptionsAccount { user: number; total: string; short_enabled: boolean; @@ -123,7 +123,7 @@ export interface GetOptionsAccountResp { point: string; currency: string; } -export interface GetOptionsAccountChangeResp { +export interface OptionsAccountChangeRecord { time: number; change: string; balance: string; @@ -131,7 +131,7 @@ export interface GetOptionsAccountChangeResp { text: string; } -export interface GetOptionsPositionsUnderlyingResp { +export interface OptionsPositionsUnderlying { user: number; underlying: string; underlying_price: string; @@ -194,7 +194,7 @@ export interface SubmitOptionsOrderResp { refr: string; } -export interface GetOptionsPersonalHistoryResp { +export interface OptionsUserHistoryRecord { id: number; create_time: number; contract: string; diff --git a/src/types/response/rebate.ts b/src/types/response/rebate.ts index d178674..032d988 100644 --- a/src/types/response/rebate.ts +++ b/src/types/response/rebate.ts @@ -1,55 +1,43 @@ -export interface GetAgencyTransactionHistoryResp { - total: number; - list: { - transaction_time: number; - user_id: number; - group_name: string; - fee: string; - fee_asset: string; - currency_pair: string; - amount: string; - amount_asset: string; - source: string; - }[]; +export interface AgencyTransactionHistoryRecord { + transaction_time: number; + user_id: number; + group_name: string; + fee: string; + fee_asset: string; + currency_pair: string; + amount: string; + amount_asset: string; + source: string; } -export interface GetAgencyCommissionHistoryResp { - total: number; - list: { - commission_time: number; - user_id: number; - group_name: string; - commission_amount: string; - commission_asset: string; - source: string; - }[]; +export interface AgencyCommissionHistoryRecord { + commission_time: number; + user_id: number; + group_name: string; + commission_amount: string; + commission_asset: string; + source: string; } -export interface GetBrokerCommissionHistoryResp { - total: number; - list: { - commission_time: number; - user_id: number; - group_name: string; - amount: string; - fee: string; - fee_asset: string; - rebate_fee: string; - source: string; - currency_pair: string; - }[]; +export interface BrokerCommissionHistoryRecord { + commission_time: number; + user_id: number; + group_name: string; + amount: string; + fee: string; + fee_asset: string; + rebate_fee: string; + source: string; + currency_pair: string; } -export interface GetBrokerTransactionHistoryResp { - total: number; - list: { - transaction_time: number; - user_id: number; - group_name: string; - fee: string; - currency_pair: string; - amount: string; - fee_asset: string; - source: string; - }[]; +export interface BrokerTransactionHistoryRecord { + transaction_time: number; + user_id: number; + group_name: string; + fee: string; + currency_pair: string; + amount: string; + fee_asset: string; + source: string; } diff --git a/src/types/response/spot.ts b/src/types/response/spot.ts index 8a7e4af..2e6c929 100644 --- a/src/types/response/spot.ts +++ b/src/types/response/spot.ts @@ -218,7 +218,7 @@ export interface DeleteSpotBatchOrdersResp { account: string; } -export interface GetSpotTradingHistoryResp { +export interface SpotHistoricTradeRecord { id: string; create_time: string; create_time_ms: string; diff --git a/src/types/response/unified.ts b/src/types/response/unified.ts index b32c83b..d76a4e3 100644 --- a/src/types/response/unified.ts +++ b/src/types/response/unified.ts @@ -59,7 +59,7 @@ export interface UnifiedInterestRecord { create_time: number; } -export interface GetUnifiedRiskUnitDetailsResp { +export interface UnifiedRiskUnitDetails { user_id: number; spot_hedge: boolean; risk_units: { @@ -74,7 +74,7 @@ export interface GetUnifiedRiskUnitDetailsResp { }[]; } -export interface GetUnifiedCurrencyDiscountTiersResp { +export interface UnifiedCurrencyDiscountTiers { currency: string; discount_tiers: { tier: string; diff --git a/src/types/response/wallet.ts b/src/types/response/wallet.ts index bafbb2c..df78ccd 100644 --- a/src/types/response/wallet.ts +++ b/src/types/response/wallet.ts @@ -33,7 +33,7 @@ export interface SubAccountTransferRecord { sub_account_type: 'spot' | 'futures' | 'cross_margin' | 'delivery'; } -export interface GetWithdrawalStatusResp { +export interface WithdrawalStatus { currency: string; name: string; name_cn: string; @@ -48,27 +48,24 @@ export interface GetWithdrawalStatusResp { withdraw_percent_on_chains: { [key: string]: string }; } -export interface SubAccountMarginBalancesResp { - uid: string; - available: { - currency_pair: string; - locked: boolean; - risk: string; - base: { - currency: string; - available: string; - locked: string; - borrowed: string; - interest: string; - }; - quote: { - currency: string; - available: string; - locked: string; - borrowed: string; - interest: string; - }; - }[]; +export interface SubAccountMarginBalance { + currency_pair: string; + locked: boolean; + risk: string; + base: { + currency: string; + available: string; + locked: string; + borrowed: string; + interest: string; + }; + quote: { + currency: string; + available: string; + locked: string; + borrowed: string; + interest: string; + }; } export interface SubAccountFuturesBalancesResp { @@ -142,7 +139,7 @@ export interface SavedAddress { verified: string; } -export interface GetTradingFeesResp { +export interface TradingFees { user_id: number; taker_fee: string; maker_fee: string; @@ -182,7 +179,7 @@ export interface SmallBalanceRecord { convertible_to_gt: string; } -export interface GetSmallBalanceHistoryResp { +export interface SmallBalanceHistoryRecord { id: string; currency: string; amount: string; diff --git a/src/types/websockets/wsAPI.ts b/src/types/websockets/wsAPI.ts index 14950d1..679f0f4 100644 --- a/src/types/websockets/wsAPI.ts +++ b/src/types/websockets/wsAPI.ts @@ -5,11 +5,12 @@ import { UpdateFuturesOrderReq, } from '../request/futures'; import { + CancelSpotBatchOrdersReq, DeleteSpotOrderReq, + GetSpotOrderReq, SubmitSpotOrderReq, UpdateSpotOrderReq, } from '../request/spot'; -import { CancelSpotBatchOrderReq, GetSpotOrderReq } from '../shared'; export type SpotWSAPITopic = | 'spot.login' @@ -48,7 +49,7 @@ export interface WsAPITopicRequestParamMap { 'spot.order_place': SubmitSpotOrderReq; 'spot.order_cancel': DeleteSpotOrderReq; - 'spot.order_cancel_ids': CancelSpotBatchOrderReq[]; + 'spot.order_cancel_ids': CancelSpotBatchOrdersReq[]; 'spot.order_cancel_cp': DeleteSpotOrderReq[]; 'spot.order_amend': UpdateSpotOrderReq; 'spot.order_status': GetSpotOrderReq;