add v5 account rest endpoints

This commit is contained in:
tiagosiebler
2023-02-16 12:57:49 +00:00
parent 71c6c9b6a5
commit 60a7aa0d9e
6 changed files with 313 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ export * from './usdc-perp';
export * from './usdc-options';
export * from './usdc-shared';
export * from './unified-margin';
export * from './v5-account';
export * from './v5-market';
export * from './v5-position';
export * from './v5-trade';

View File

@@ -0,0 +1,34 @@
import { AccountTypeV5, CategoryV5, TransactionTypeV5 } from '../v5-shared';
export interface GetWalletBalanceParamsV5 {
accountType: AccountTypeV5;
coin?: string;
}
export interface GetBorrowHistoryParamsV5 {
currency?: string;
startTime?: number;
endTime?: number;
limit?: number;
cursor?: string;
}
export interface GetTransactionLogParamsV5 {
accountType?: AccountTypeV5;
category?: CategoryV5;
currency?: string;
baseCoin?: string;
type?: TransactionTypeV5;
startTime?: number;
endTime?: number;
limit?: number;
cursor?: string;
}
export interface MMPModifyParamsV5 {
baseCoin: string;
window: string;
frozenPeriod: string;
qtyLimit: string;
deltaLimit: string;
}

View File

@@ -4,6 +4,7 @@ export * from './shared';
export * from './spot';
export * from './usdt-perp';
export * from './unified-margin';
export * from './v5-account';
export * from './v5-market';
export * from './v5-position';
export * from './v5-trade';

View File

@@ -0,0 +1,113 @@
import { AccountTypeV5, CategoryV5, TransactionTypeV5 } from '../v5-shared';
export interface WalletBalanceV5Coin {
coin: string;
equity: string;
usdValue: string;
walletBalance: string;
borrowAmount: string;
availableToBorrow: string;
availableToWithdraw: string;
accruedInterest: string;
totalOrderIM: string;
totalPositionIM: string;
totalPositionMM: string;
unrealisedPnl: string;
cumRealisedPnl: string;
}
export interface WalletBalanceV5 {
accountType: AccountTypeV5;
accountIMRate: string;
accountMMRate: string;
totalEquity: string;
totalWalletBalance: string;
totalMarginBalance: string;
totalAvailableBalance: string;
totalPerpUPL: string;
totalInitialMargin: string;
totalMaintenanceMargin: string;
coin: WalletBalanceV5Coin[];
}
export type UnifiedUpdateStatusV5 = 'FAIL' | 'PROCESS' | 'SUCCESS';
export interface UnifiedAccountUpgradeResultV5 {
unifiedUpdateStatus: UnifiedUpdateStatusV5;
unifiedUpdateMsg: {
msg: string[] | null;
};
}
export interface BorrowHistoryRecordV5 {
currency: string;
createdTime: number;
borrowCost: string;
hourlyBorrowRate: string;
InterestBearingBorrowSize: string;
costExemption: string;
}
export interface CollateralInfoV5 {
currency: string;
hourlyBorrowRate: string;
maxBorrowingAmount: string;
freeBorrowingAmount: string;
borrowAmount: string;
availableToBorrow: string;
borrowable: boolean;
marginCollateral: boolean;
collateralRatio: string;
}
export interface CoinGreeksV5 {
baseCoin: string;
totalDelta: string;
totalGamma: string;
totalVega: string;
totalTheta: string;
}
export interface FeeRateV5 {
symbol: string;
takerFeeRate: string;
makerFeeRate: string;
}
export interface AccountInfoV5 {
unifiedMarginStatus: number;
marginMode: 'REGULAR_MARGIN' | 'PORTFOLIO_MARGIN';
updatedTime: string;
}
export interface TransactionLogV5 {
symbol: string;
category: CategoryV5;
side: string;
transactionTime: string;
type: TransactionTypeV5;
qty: string;
size: string;
currency: string;
tradePrice: string;
funding: string;
fee: string;
cashFlow: string;
change: string;
cashBalance: string;
feeRate: string;
tradeId: string;
orderId: string;
orderLinkId: string;
}
export interface MMPStateV5 {
baseCoin: string;
mmpEnabled: boolean;
window: string;
frozenPeriod: string;
qtyLimit: string;
deltaLimit: string;
mmpFrozenUntil: string;
mmpFrozen: boolean;
}

View File

@@ -11,6 +11,28 @@ export type PositionIdx = 0 | 1 | 2;
*/
export type TradeModeV5 = 0 | 1;
export type TPSLModeV5 = 'Full' | 'Partial';
export type AccountMarginModeV5 = 'REGULAR_MARGIN' | 'PORTFOLIO_MARGIN';
export type AccountTypeV5 =
| 'CONTRACT'
| 'SPOT'
| 'INVESTMENT'
| 'OPTION'
| 'UNIFIED'
| 'FUND';
export type TransactionTypeV5 =
| 'TRANSFER_IN'
| 'TRANSFER_OUT'
| 'TRADE'
| 'SETTLEMENT'
| 'DELIVERY'
| 'LIQUIDATION'
| 'BONUS'
| 'FEE_REFUND'
| 'INTEREST'
| 'CURRENCY_BUY'
| 'CURRENCY_SELL';
export interface CategoryCursorListV5<T extends unknown[]> {
category: CategoryV5;