feat(): added common response types

This commit is contained in:
JJ-Cro
2024-12-12 12:00:58 +01:00
parent 8c8a7af2ac
commit d3a392dea7
5 changed files with 583 additions and 75 deletions

View File

@@ -1,9 +1,30 @@
import { import {
AnnouncementV2,
APIResponse, APIResponse,
BGBConvertCoinsV2,
BGBConvertHistoryV2,
BorrowLoanRequestV2, BorrowLoanRequestV2,
BotAssetsV2,
CloseFuturesFollowerPositionsRequestV2, CloseFuturesFollowerPositionsRequestV2,
ConvertBGBResponseV2,
ConvertCurrenciesV2,
ConvertHistoryV2,
ConvertQuotedPriceV2,
ConvertQuoteRequestV2,
ConvertRequestV2,
ConvertTradeResponseV2,
CopyTradingProductTypeV2, CopyTradingProductTypeV2,
CreateSubAccountApiKeyRequestV2,
CreateVirtualSubAccountAndApiKeyV2,
CreateVirtualSubAccountApiKeyV2,
CreateVirtualSubAccountV2,
CreateVirtualSubApiKeyRequestV2,
CreateVirtualSubRequestV2,
FundingAssetsV2,
FuturesAccountBillRequestV2, FuturesAccountBillRequestV2,
FuturesActiveBuySellVolumeV2,
FuturesActiveLongShortAccountV2,
FuturesActiveLongShortPositionV2,
FuturesBatchCancelOrderRequestV2, FuturesBatchCancelOrderRequestV2,
FuturesBatchOrderRequestV2, FuturesBatchOrderRequestV2,
FuturesCancelAllOrdersRequestV2, FuturesCancelAllOrdersRequestV2,
@@ -21,6 +42,7 @@ import {
FuturesHistoricalPositionsRequestV2, FuturesHistoricalPositionsRequestV2,
FuturesHistoricTradesRequestV2, FuturesHistoricTradesRequestV2,
FuturesInterestHistoryRequestV2, FuturesInterestHistoryRequestV2,
FuturesLongShortRatioV2,
FuturesMergeDepthRequestV2, FuturesMergeDepthRequestV2,
FuturesModifyOrderRequestV2, FuturesModifyOrderRequestV2,
FuturesModifyPlanOrderRequestV2, FuturesModifyPlanOrderRequestV2,
@@ -38,7 +60,11 @@ import {
FuturesSingleAccountRequestV2, FuturesSingleAccountRequestV2,
FuturesTPSLOrderRequestV2, FuturesTPSLOrderRequestV2,
FuturesTraderSymbolSettingRequestV2, FuturesTraderSymbolSettingRequestV2,
FuturesTransactionRecordV2,
GetAnnouncementsRequestV2,
GetBorrowHistoryRequestV2, GetBorrowHistoryRequestV2,
GetConvertBGBHistoryRequestV2,
GetConvertHistoryRequestV2,
GetEarnSavingsAssetsRequestV2, GetEarnSavingsAssetsRequestV2,
GetEarnSavingsRecordsRequestV2, GetEarnSavingsRecordsRequestV2,
GetFinancialHistoryRequestV2, GetFinancialHistoryRequestV2,
@@ -49,6 +75,7 @@ import {
GetFuturesTraderFollowersRequestV2, GetFuturesTraderFollowersRequestV2,
GetFuturesTraderHistoryOrdersRequestV2, GetFuturesTraderHistoryOrdersRequestV2,
GetFuturesTraderProfitShareDetailRequestV2, GetFuturesTraderProfitShareDetailRequestV2,
GetFuturesTransactionsRequestV2,
GetHistoryOrdersRequestV2, GetHistoryOrdersRequestV2,
GetInterestHistoryRequestV2, GetInterestHistoryRequestV2,
GetLiquidationHistoryRequestV2, GetLiquidationHistoryRequestV2,
@@ -60,6 +87,11 @@ import {
GetMarginCurrentOrdersRequestV2, GetMarginCurrentOrdersRequestV2,
GetMarginLiquidationOrdersRequestV2, GetMarginLiquidationOrdersRequestV2,
GetMarginOrderFillsRequestV2, GetMarginOrderFillsRequestV2,
GetMarginTransactionsRequestV2,
GetMerchantAdvertisementsRequestV2,
GetMerchantP2POrdersRequestV2,
GetP2PMerchantsRequestV2,
GetP2PTransactionsRequestV2,
GetRepayHistoryRequestV2, GetRepayHistoryRequestV2,
GetSharkfinAssetsRequestV2, GetSharkfinAssetsRequestV2,
GetSharkfinRecordsRequestV2, GetSharkfinRecordsRequestV2,
@@ -78,13 +110,29 @@ import {
GetSpotTraderFollowersRequestV2, GetSpotTraderFollowersRequestV2,
GetSpotTraderHistoryOrdersRequestV2, GetSpotTraderHistoryOrdersRequestV2,
GetSpotTraderHistoryProfitRequestV2, GetSpotTraderHistoryProfitRequestV2,
GetSpotTransactionsRequestV2,
GetSpotTransferRecordRequestV2, GetSpotTransferRecordRequestV2,
GetSpotWithdrawalRecordRequestV2, GetSpotWithdrawalRecordRequestV2,
GetSubAccountsRequestV2,
GetTradeRateRequestV2,
IsolatedMarginBorrowingRatioV2,
LeveragedLongShortRatioV2,
MarginBatchOrdersRequestV2, MarginBatchOrdersRequestV2,
MarginLoanGrowthRateV2,
MarginPlaceOrderRequestV2, MarginPlaceOrderRequestV2,
MarginTransactionRecordV2,
MarginType, MarginType,
ModifyFuturesTraderOrderTPSLRequestV2, ModifyFuturesTraderOrderTPSLRequestV2,
ModifyLoanPledgeRateRequestV2, ModifyLoanPledgeRateRequestV2,
ModifySubAccountApiKeyRequestV2,
ModifySubRequestV2,
ModifyVirtualSubAccountApiKeyV2,
ModifyVirtualSubApiKeyRequestV2,
ModifyVirtualSubRequestV2,
P2PMerchantAdvertisementV2,
P2PMerchantInfoV2,
P2PMerchantListV2,
P2PMerchantOrderV2,
RedeemSavingsRequestV2, RedeemSavingsRequestV2,
RepayLoanRequestV2, RepayLoanRequestV2,
SpotAccountBill, SpotAccountBill,
@@ -95,6 +143,7 @@ import {
SpotCancelOrderRequestV2, SpotCancelOrderRequestV2,
SpotCandlesRequestV2, SpotCandlesRequestV2,
SpotFollowerCopyTradeSettingV2, SpotFollowerCopyTradeSettingV2,
SpotFundFlowV2,
SpotHistoricCandlesRequestV2, SpotHistoricCandlesRequestV2,
SpotHistoricTradesRequestV2, SpotHistoricTradesRequestV2,
SpotMainSubTransferRecordRequestV2, SpotMainSubTransferRecordRequestV2,
@@ -102,39 +151,18 @@ import {
SpotOrderRequestV2, SpotOrderRequestV2,
SpotPlanOrderRequestV2, SpotPlanOrderRequestV2,
SpotSubAccountTransferRequestV2, SpotSubAccountTransferRequestV2,
SpotTransactionRecordV2,
SpotTransferRequestV2, SpotTransferRequestV2,
SpotWhaleNetFlowV2,
SpotWithdrawalRequestV2, SpotWithdrawalRequestV2,
UpdateFuturesFollowerSettingsRequestV2, SubAccountApiKeyListV2,
UpdateFuturesFollowerTPSLRequestV2,
} from './types';
import {
CreateSubAccountApiKeyRequestV2,
GetSubAccountsRequestV2,
ModifySubAccountApiKeyRequestV2,
ModifySubRequestV2,
SubDepositRecordsRequestV2, SubDepositRecordsRequestV2,
SubWithdrawalRecordsRequestV2, SubWithdrawalRecordsRequestV2,
SubWithdrawalRequestV2, SubWithdrawalRequestV2,
} from './types/request/v2/broker'; UpdateFuturesFollowerSettingsRequestV2,
import { UpdateFuturesFollowerTPSLRequestV2,
ConvertQuoteRequestV2, VirtualSubAccountListV2,
ConvertRequestV2, } from './types';
CreateVirtualSubApiKeyRequestV2,
CreateVirtualSubRequestV2,
GetAnnouncementsRequestV2,
GetConvertBGBHistoryRequestV2,
GetConvertHistoryRequestV2,
GetFuturesTransactionsRequestV2,
GetMarginTransactionsRequestV2,
GetMerchantAdvertisementsRequestV2,
GetMerchantP2POrdersRequestV2,
GetP2PMerchantsRequestV2,
GetP2PTransactionsRequestV2,
GetSpotTransactionsRequestV2,
GetTradeRateRequestV2,
ModifyVirtualSubApiKeyRequestV2,
ModifyVirtualSubRequestV2,
} from './types/request/v2/common';
import { assertMarginType, REST_CLIENT_TYPE_ENUM } from './util'; import { assertMarginType, REST_CLIENT_TYPE_ENUM } from './util';
import BaseRestClient from './util/BaseRestClient'; import BaseRestClient from './util/BaseRestClient';
@@ -236,7 +264,7 @@ export class RestClientV2 extends BaseRestClient {
getAnnouncements( getAnnouncements(
params?: GetAnnouncementsRequestV2, params?: GetAnnouncementsRequestV2,
): Promise<APIResponse<any>> { ): Promise<APIResponse<AnnouncementV2[]>> {
return this.get('/api/v2/public/annoucements', params); return this.get('/api/v2/public/annoucements', params);
} }
@@ -246,11 +274,20 @@ export class RestClientV2 extends BaseRestClient {
* *
*/ */
getServerTime(): Promise<APIResponse<any>> { getServerTime(): Promise<
APIResponse<{
serverTime: string;
}>
> {
return this.get('/api/v2/public/time'); return this.get('/api/v2/public/time');
} }
getTradeRate(params: GetTradeRateRequestV2): Promise<APIResponse<any>> { getTradeRate(params: GetTradeRateRequestV2): Promise<
APIResponse<{
makerFeeRate: string;
takerFeeRate: string;
}>
> {
return this.getPrivate('/api/v2/common/trade-rate', params); return this.getPrivate('/api/v2/common/trade-rate', params);
} }
@@ -262,25 +299,25 @@ export class RestClientV2 extends BaseRestClient {
getSpotTransactionRecords( getSpotTransactionRecords(
params: GetSpotTransactionsRequestV2, params: GetSpotTransactionsRequestV2,
): Promise<APIResponse<any>> { ): Promise<APIResponse<SpotTransactionRecordV2[]>> {
return this.getPrivate('/api/v2/tax/spot-record', params); return this.getPrivate('/api/v2/tax/spot-record', params);
} }
getFuturesTransactionRecords( getFuturesTransactionRecords(
params: GetFuturesTransactionsRequestV2, params: GetFuturesTransactionsRequestV2,
): Promise<APIResponse<any>> { ): Promise<APIResponse<FuturesTransactionRecordV2[]>> {
return this.getPrivate('/api/v2/tax/future-record', params); return this.getPrivate('/api/v2/tax/future-record', params);
} }
getMarginTransactionRecords( getMarginTransactionRecords(
params: GetMarginTransactionsRequestV2, params: GetMarginTransactionsRequestV2,
): Promise<APIResponse<any>> { ): Promise<APIResponse<MarginTransactionRecordV2[]>> {
return this.getPrivate('/api/v2/tax/margin-record', params); return this.getPrivate('/api/v2/tax/margin-record', params);
} }
getP2PTransactionRecords( getP2PTransactionRecords(
params: GetP2PTransactionsRequestV2, params: GetP2PTransactionsRequestV2,
): Promise<APIResponse<any>> { ): Promise<APIResponse<P2PMerchantOrderV2[]>> {
return this.getPrivate('/api/v2/tax/p2p-record', params); return this.getPrivate('/api/v2/tax/p2p-record', params);
} }
@@ -292,23 +329,23 @@ export class RestClientV2 extends BaseRestClient {
getP2PMerchantList( getP2PMerchantList(
params?: GetP2PMerchantsRequestV2, params?: GetP2PMerchantsRequestV2,
): Promise<APIResponse<any>> { ): Promise<APIResponse<P2PMerchantListV2>> {
return this.getPrivate('/api/v2/p2p/merchantList', params); return this.getPrivate('/api/v2/p2p/merchantList', params);
} }
getP2PMerchantInfo(): Promise<APIResponse<any>> { getP2PMerchantInfo(): Promise<APIResponse<P2PMerchantInfoV2>> {
return this.getPrivate('/api/v2/p2p/merchantInfo'); return this.getPrivate('/api/v2/p2p/merchantInfo');
} }
getP2PMerchantOrders( getP2PMerchantOrders(
params: GetMerchantP2POrdersRequestV2, params: GetMerchantP2POrdersRequestV2,
): Promise<APIResponse<any>> { ): Promise<APIResponse<P2PMerchantOrderV2>> {
return this.getPrivate('/api/v2/p2p/orderList', params); return this.getPrivate('/api/v2/p2p/orderList', params);
} }
getP2PMerchantAdvertisementList( getP2PMerchantAdvertisementList(
params: GetMerchantAdvertisementsRequestV2, params: GetMerchantAdvertisementsRequestV2,
): Promise<APIResponse<any>> { ): Promise<APIResponse<P2PMerchantAdvertisementV2>> {
return this.getPrivate('/api/v2/p2p/advList', params); return this.getPrivate('/api/v2/p2p/advList', params);
} }
@@ -320,21 +357,21 @@ export class RestClientV2 extends BaseRestClient {
getSpotWhaleNetFlowData(params: { getSpotWhaleNetFlowData(params: {
symbol: string; symbol: string;
}): Promise<APIResponse<any>> { }): Promise<APIResponse<SpotWhaleNetFlowV2[]>> {
return this.getPrivate('/api/v2/spot/market/whale-net-flow', params); return this.getPrivate('/api/v2/spot/market/whale-net-flow', params);
} }
getFuturesActiveTakerBuySellVolumeData(params: { getFuturesActiveTakerBuySellVolumeData(params: {
symbol: string; symbol: string;
period?: string; period?: string;
}): Promise<APIResponse<any>> { }): Promise<APIResponse<FuturesActiveBuySellVolumeV2[]>> {
return this.get('/api/v2/mix/market/taker-buy-sell', params); return this.get('/api/v2/mix/market/taker-buy-sell', params);
} }
getFuturesActiveLongShortPositionData(params: { getFuturesActiveLongShortPositionData(params: {
symbol: string; symbol: string;
period?: string; period?: string;
}): Promise<APIResponse<any>> { }): Promise<APIResponse<FuturesActiveLongShortPositionV2[]>> {
return this.get('/api/v2/mix/market/position-long-short', params); return this.get('/api/v2/mix/market/position-long-short', params);
} }
@@ -342,7 +379,7 @@ export class RestClientV2 extends BaseRestClient {
symbol: string; symbol: string;
period?: string; period?: string;
coin?: string; coin?: string;
}): Promise<APIResponse<any>> { }): Promise<APIResponse<LeveragedLongShortRatioV2[]>> {
return this.get('/api/v2/mix/market/long-short-ratio', params); return this.get('/api/v2/mix/market/long-short-ratio', params);
} }
@@ -350,45 +387,55 @@ export class RestClientV2 extends BaseRestClient {
symbol: string; symbol: string;
period?: string; period?: string;
coin?: string; coin?: string;
}): Promise<APIResponse<any>> { }): Promise<APIResponse<MarginLoanGrowthRateV2[]>> {
return this.get('/api/v2/mix/market/loan-growth', params); return this.get('/api/v2/mix/market/loan-growth', params);
} }
getIsolatedMarginBorrowingRatio(params: { getIsolatedMarginBorrowingRatio(params: {
symbol: string; symbol: string;
period?: string; period?: string;
}): Promise<APIResponse<any>> { }): Promise<APIResponse<IsolatedMarginBorrowingRatioV2[]>> {
return this.get('/api/v2/mix/market/isolated-borrow-rate', params); return this.get('/api/v2/mix/market/isolated-borrow-rate', params);
} }
getFuturesActiveBuySellVolumeData(params: { getFuturesActiveBuySellVolumeData(params: {
symbol: string; symbol: string;
period?: string; period?: string;
}): Promise<APIResponse<any>> { }): Promise<APIResponse<FuturesLongShortRatioV2[]>> {
return this.get('/api/v2/mix/market/long-short', params); return this.get('/api/v2/mix/market/long-short', params);
} }
getSpotFundFlow(params: { getSpotFundFlow(params: {
symbol: string; symbol: string;
period?: string; period?: string;
}): Promise<APIResponse<any>> { }): Promise<APIResponse<SpotFundFlowV2>> {
return this.get('/api/v2/spot/market/fund-flow', params); return this.get('/api/v2/spot/market/fund-flow', params);
} }
getTradeDataSupportSymbols(): Promise<APIResponse<any>> { getTradeDataSupportSymbols(): Promise<
APIResponse<{
spotList: string[];
futureList: string[];
}>
> {
return this.get('/api/v2/spot/market/support-symbols'); return this.get('/api/v2/spot/market/support-symbols');
} }
getSpotFundNetFlowData(params: { getSpotFundNetFlowData(params: { symbol: string }): Promise<
symbol: string; APIResponse<
}): Promise<APIResponse<any>> { {
netFlow: string;
ts: string;
}[]
>
> {
return this.get('/api/v2/spot/market/fund-net-flow', params); return this.get('/api/v2/spot/market/fund-net-flow', params);
} }
getFuturesActiveLongShortAccountData(params: { getFuturesActiveLongShortAccountData(params: {
symbol: string; symbol: string;
period?: string; period?: string;
}): Promise<APIResponse<any>> { }): Promise<APIResponse<FuturesActiveLongShortAccountV2[]>> {
return this.get('/api/v2/mix/market/account-long-short', params); return this.get('/api/v2/mix/market/account-long-short', params);
} }
@@ -400,19 +447,21 @@ export class RestClientV2 extends BaseRestClient {
createVirtualSubaccount(params: { createVirtualSubaccount(params: {
subAccountList: string[]; subAccountList: string[];
}): Promise<APIResponse<any>> { }): Promise<APIResponse<CreateVirtualSubAccountV2>> {
return this.postPrivate('/api/v2/user/create-virtual-subaccount', params); return this.postPrivate('/api/v2/user/create-virtual-subaccount', params);
} }
modifyVirtualSubaccount( modifyVirtualSubaccount(params: ModifyVirtualSubRequestV2): Promise<
params: ModifyVirtualSubRequestV2, APIResponse<{
): Promise<APIResponse<any>> { result: string;
}>
> {
return this.postPrivate('/api/v2/user/modify-virtual-subaccount', params); return this.postPrivate('/api/v2/user/modify-virtual-subaccount', params);
} }
batchCreateVirtualSubaccountAndAPIKey( batchCreateVirtualSubaccountAndAPIKey(
params: CreateVirtualSubRequestV2, params: CreateVirtualSubRequestV2,
): Promise<APIResponse<any>> { ): Promise<APIResponse<CreateVirtualSubAccountAndApiKeyV2[]>> {
return this.postPrivate( return this.postPrivate(
'/api/v2/user/batch-create-subaccount-and-apikey', '/api/v2/user/batch-create-subaccount-and-apikey',
params, params,
@@ -423,13 +472,13 @@ export class RestClientV2 extends BaseRestClient {
limit?: string; limit?: string;
idLessThan?: string; idLessThan?: string;
status?: 'normal' | 'freeze'; status?: 'normal' | 'freeze';
}): Promise<APIResponse<any>> { }): Promise<APIResponse<VirtualSubAccountListV2>> {
return this.getPrivate('/api/v2/user/virtual-subaccount-list', params); return this.getPrivate('/api/v2/user/virtual-subaccount-list', params);
} }
createVirtualSubaccountAPIKey( createVirtualSubaccountAPIKey(
params: CreateVirtualSubApiKeyRequestV2, params: CreateVirtualSubApiKeyRequestV2,
): Promise<APIResponse<any>> { ): Promise<APIResponse<CreateVirtualSubAccountApiKeyV2>> {
return this.postPrivate( return this.postPrivate(
'/api/v2/user/create-virtual-subaccount-apikey', '/api/v2/user/create-virtual-subaccount-apikey',
params, params,
@@ -438,7 +487,7 @@ export class RestClientV2 extends BaseRestClient {
modifyVirtualSubaccountAPIKey( modifyVirtualSubaccountAPIKey(
params: ModifyVirtualSubApiKeyRequestV2, params: ModifyVirtualSubApiKeyRequestV2,
): Promise<APIResponse<any>> { ): Promise<APIResponse<ModifyVirtualSubAccountApiKeyV2>> {
return this.postPrivate( return this.postPrivate(
'/api/v2/user/modify-virtual-subaccount-apikey', '/api/v2/user/modify-virtual-subaccount-apikey',
params, params,
@@ -447,7 +496,7 @@ export class RestClientV2 extends BaseRestClient {
getVirtualSubaccountAPIKeys(params: { getVirtualSubaccountAPIKeys(params: {
subAccountUid: string; subAccountUid: string;
}): Promise<APIResponse<any>> { }): Promise<APIResponse<SubAccountApiKeyListV2[]>> {
return this.getPrivate( return this.getPrivate(
'/api/v2/user/virtual-subaccount-apikey-list', '/api/v2/user/virtual-subaccount-apikey-list',
params, params,
@@ -459,16 +508,27 @@ export class RestClientV2 extends BaseRestClient {
* * Common | Assets * * Common | Assets
* *
*/ */
getFundingAssets(params?: { coin?: string }): Promise<APIResponse<any>> { getFundingAssets(params?: {
coin?: string;
}): Promise<APIResponse<FundingAssetsV2[]>> {
return this.getPrivate('/api/v2/account/funding-assets', params); return this.getPrivate('/api/v2/account/funding-assets', params);
} }
getBotAccount(params?: { accountType?: string }): Promise<APIResponse<any>> { getBotAccount(params?: {
accountType?: string;
}): Promise<APIResponse<BotAssetsV2[]>> {
return this.getPrivate('/api/v2/account/bot-assets', params); return this.getPrivate('/api/v2/account/bot-assets', params);
} }
/** Get assets overview */ /** Get assets overview */
getBalances(): Promise<APIResponse<any>> { getBalances(): Promise<
APIResponse<
{
accountType: string;
usdtBalance: string;
}[]
>
> {
return this.getPrivate('/api/v2/account/all-account-balance'); return this.getPrivate('/api/v2/account/all-account-balance');
} }
@@ -478,23 +538,25 @@ export class RestClientV2 extends BaseRestClient {
* *
*/ */
getConvertCoins(): Promise<APIResponse<any>> { getConvertCoins(): Promise<APIResponse<ConvertCurrenciesV2[]>> {
return this.getPrivate('/api/v2/convert/currencies'); return this.getPrivate('/api/v2/convert/currencies');
} }
getConvertQuotedPrice( getConvertQuotedPrice(
params: ConvertQuoteRequestV2, params: ConvertQuoteRequestV2,
): Promise<APIResponse<any>> { ): Promise<APIResponse<ConvertQuotedPriceV2>> {
return this.getPrivate('/api/v2/convert/quoted-price', params); return this.getPrivate('/api/v2/convert/quoted-price', params);
} }
convert(params: ConvertRequestV2): Promise<APIResponse<any>> { convert(
params: ConvertRequestV2,
): Promise<APIResponse<ConvertTradeResponseV2>> {
return this.postPrivate('/api/v2/convert/trade', params); return this.postPrivate('/api/v2/convert/trade', params);
} }
getConvertHistory( getConvertHistory(
params: GetConvertHistoryRequestV2, params: GetConvertHistoryRequestV2,
): Promise<APIResponse<any>> { ): Promise<APIResponse<ConvertHistoryV2>> {
return this.getPrivate('/api/v2/convert/convert-record', params); return this.getPrivate('/api/v2/convert/convert-record', params);
} }
@@ -504,17 +566,19 @@ export class RestClientV2 extends BaseRestClient {
* *
*/ */
getConvertBGBCoins(): Promise<APIResponse<any>> { getConvertBGBCoins(): Promise<APIResponse<BGBConvertCoinsV2>> {
return this.getPrivate('/api/v2/convert/bgb-convert-coin-list'); return this.getPrivate('/api/v2/convert/bgb-convert-coin-list');
} }
convertBGB(params: { coinList: string }): Promise<APIResponse<any>> { convertBGB(params: {
coinList: string;
}): Promise<APIResponse<ConvertBGBResponseV2>> {
return this.postPrivate('/api/v2/convert/bgb-convert', params); return this.postPrivate('/api/v2/convert/bgb-convert', params);
} }
getConvertBGBHistory( getConvertBGBHistory(
params: GetConvertBGBHistoryRequestV2, params: GetConvertBGBHistoryRequestV2,
): Promise<APIResponse<any>> { ): Promise<APIResponse<BGBConvertHistoryV2[]>> {
return this.getPrivate('/api/v2/convert/bgb-convert-records', params); return this.getPrivate('/api/v2/convert/bgb-convert-records', params);
} }

View File

@@ -1,4 +1,4 @@
export * from './request'; export * from './request';
export * from './response/v1'; export * from './response';
export * from './shared'; export * from './shared';
export * from './websockets'; export * from './websockets';

View File

@@ -0,0 +1,4 @@
export * from './v1/futures';
export * from './v1/shared';
export * from './v1/spot';
export * from './v2/common';

View File

@@ -1,3 +0,0 @@
export * from './futures';
export * from './shared';
export * from './spot';

View File

@@ -0,0 +1,443 @@
/**
*
* * Common | Notice
*
*/
export interface AnnouncementV2 {
annId: string;
annTitle: string;
annDesc: string;
cTime: string;
language: string;
annUrl: string;
}
/**
*
* * Common | Public
*
*/
/**
*
* * Common | Tax
*
*/
export interface SpotTransactionRecordV2 {
id: string;
coin: string;
spotTaxType: string;
amount: string;
fee: string;
balance: string;
ts: string;
}
export interface FuturesTransactionRecordV2 {
id: string;
symbol: string;
marginCoin: string;
futureTaxType: string;
amount: string;
fee: string;
ts: string;
}
export interface MarginTransactionRecordV2 {
id: string;
coin: string;
marginTaxType: string;
amount: string;
fee: string;
total: string;
symbol: string;
ts: string;
}
export interface P2PMerchantOrderV2 {
id: string;
coin: string;
p2pTaxType: string;
total: string;
ts: string;
}
/**
*
* * Common | P2P
*
*/
export interface P2PMerchantListV2 {
merchantList: {
registerTime: string;
nickName: string;
isOnline: string;
avgPaymentTime: string;
avgReleaseTime: string;
totalTrades: string;
totalBuy: string;
totalSell: string;
totalCompletionRate: string;
trades30d: string;
sell30d: string;
buy30d: string;
completionRate30d: string;
}[];
minMerchantId: string;
}
export interface P2PMerchantInfoV2 {
registerTime: string;
nickName: string;
merchantId: string;
avgPaymentTime: string;
avgReleaseTime: string;
totalTrades: string;
totalBuy: string;
totalSell: string;
totalCompletionRate: string;
trades30d: string;
sell30d: string;
buy30d: string;
completionRate30d: string;
kycStatus: boolean;
emailBindStatus: boolean;
mobileBindStatus: boolean;
email: string;
mobile: string;
}
export interface P2PMerchantOrderV2 {
orderList: {
orderId: string;
orderNo: string;
advNo: string;
side: string;
count: string;
coin: string;
price: string;
fiat: string;
withdrawTime: string;
representTime: string;
releaseTime: string;
paymentTime: string;
amount: string;
status: string;
buyerRealName: string;
sellerRealName: string;
ctime: string;
utime: string;
paymentInfo: {
paymethodName: string;
paymethodId: string;
paymethodInfo: {
name: string;
required: string;
type: string;
value: string;
}[];
};
}[];
minOrderId: string;
}
export interface P2PMerchantAdvertisementV2 {
advList: {
advId: string;
advNo: string;
side: string;
advSize: string;
size: string;
coin: string;
price: string;
coinPrecision: string;
fiat: string;
fiatPrecision: string;
fiatSymbol: string;
status: string;
hide: string;
maxTradeAmount: string;
minTradeAmount: string;
payDuration: string;
turnoverNum: string;
turnoverRate: string;
label: string | null;
userLimitList: {
minCompleteNum: string;
maxCompleteNum: string;
placeOrderNum: string;
allowMerchantPlace: string;
completeRate30d: string;
country: string;
};
paymentMethodList: {
paymentMethod: string;
paymentId: string;
paymentInfo: {
name: string;
required: boolean;
type: string;
}[];
}[];
merchantCertifiedList: {
imageUrl: string;
desc: string;
}[];
utime: string;
ctime: string;
}[];
minAdvId: string;
}
/**
*
* * Common | Trading insights
*
*/
export interface SpotWhaleNetFlowV2 {
volume: string;
date: string;
}
export interface FuturesActiveBuySellVolumeV2 {
buyVolume: string;
sellVolume: string;
ts: string;
}
export interface FuturesActiveLongShortPositionV2 {
longPositionRatio: string;
shortPositionRatio: string;
longShortPositionRatio: string;
ts: string;
}
export interface LeveragedLongShortRatioV2 {
ts: string;
longShortRatio: string;
}
export interface MarginLoanGrowthRateV2 {
ts: string;
growthRate: string;
}
export interface IsolatedMarginBorrowingRatioV2 {
ts: string;
borrowRate: string;
}
export interface FuturesLongShortRatioV2 {
longRatio: string;
shortRatio: string;
longShortRatio: string;
ts: string;
}
export interface SpotFundFlowV2 {
whaleBuyVolume: string;
dolphinBuyVolume: string;
fishBuyVolume: string;
whaleSellVolume: string;
dolphinSellVolume: string;
fishSellVolume: string;
whaleBuyRatio: string;
dolphinBuyRatio: string;
fishBuyRatio: string;
whaleSellRatio: string;
dolphinSellRatio: string;
fishSellRatio: string;
}
export interface FuturesActiveLongShortAccountV2 {
longAccountRatio: string;
shortAccountRatio: string;
longShortAccountRatio: string;
ts: string;
}
/**
*
* * Common | Virtual Subaccount
*
*/
export interface CreateVirtualSubAccountV2 {
failureList: {
subaAccountName: string;
}[];
successList: {
subaAccountUid: string;
subaAccountName: string;
status: string;
label: string;
permList: string[];
cTime: string;
uTime: string;
}[];
}
export interface CreateVirtualSubAccountAndApiKeyV2 {
subAccountUid: string;
subAccountName: string;
label: string;
subAccountApiKey: string;
secretKey: string;
permList: string[];
ipList: string[];
}
export interface VirtualSubAccountListV2 {
endId: string;
subAccountList: {
subAccountUid: string;
subAccountName: string;
status: string;
permList: string[];
label: string;
accountType: string;
bindingTime: string;
cTime: string;
uTime: string;
}[];
}
export interface CreateVirtualSubAccountApiKeyV2 {
subAccountUid: string;
label: string;
subAccountApiKey: string;
secretKey: string;
permList: string[];
ipList: string[];
}
export interface ModifyVirtualSubAccountApiKeyV2 {
subAccountUid: string;
label: string;
subAccountApiKey: string;
secretKey: string;
permList: string[];
ipList: string[];
}
export interface SubAccountApiKeyListV2 {
subAccountUid: string;
label: string;
subAccountApiKey: string;
permList: string[];
ipList: string[];
}
/**
*
* * Common | Assets
*
*/
export interface FundingAssetsV2 {
coin: string;
available: string;
frozen: string;
usdtValue: string;
}
export interface BotAssetsV2 {
coin: string;
available: string;
equity: string;
bonus: string;
frozen: string;
usdtValue: string;
}
/**
*
* * Common | Convert
*
*/
export interface ConvertCurrenciesV2 {
// array type
coin: string;
available: string;
maxAmount: string;
minAmount: string;
}
export interface ConvertQuotedPriceV2 {
fee: string;
fromCoinSize: string;
fromCoin: string;
cnvtPrice: string;
toCoinSize: string;
toCoin: string;
traceId: string;
}
export interface ConvertTradeResponseV2 {
ts: string;
cnvtPrice: string;
toCoinSize: string;
toCoin: string;
}
export interface ConvertHistoryV2 {
dataList: {
id: string;
ts: string;
cnvtPrice: string;
fee: string;
fromCoinSize: string;
fromCoin: string;
toCoinSize: string;
toCoin: string;
}[];
endId: string;
}
/**
*
* * Common | BGB Convert
*
*/
export interface BGBConvertCoinsV2 {
coinList: {
coin: string;
available: string;
bgbEstAmount: string;
precision: string;
feeDetail: {
feeRate: string;
fee: string;
}[];
cTime: string;
}[];
}
export interface ConvertBGBResponseV2 {
orderList: {
coin: string;
orderId: string;
}[];
}
export interface BGBConvertHistoryV2 {
orderId: string;
fromCoin: string;
fromAmount: string;
fromCoinPrice: string;
toCoin: string;
toAmount: string;
toCoinPrice: string;
feeDetail: {
feeCoin: string;
fee: string;
}[];
status: string;
ctime: string;
}