add e2e tests for v5 REST client. Fix competing tests.

This commit is contained in:
tiagosiebler
2023-02-20 16:19:56 +00:00
parent 9e2e105961
commit eeb0d63f0d
10 changed files with 498 additions and 27 deletions

View File

@@ -44,9 +44,20 @@ export const API_ERROR_CODE = {
POSITION_MODE_NOT_MODIFIED: 30083,
ISOLATED_NOT_MODIFIED: 30084,
RISK_LIMIT_NOT_EXISTS: 30090,
SUB_USER_ALREADY_EXISTS: 31005,
LEVERAGE_NOT_MODIFIED: 34036,
SAME_SLTP_MODE: 37002,
COPY_TRADE_NOT_OPEN_ORDER: 39426,
V5_ORDER_NOT_FOUND: 110001,
V5_INSUFFICIENT_BALANCE: 110007,
V5_API_KEY_PERMISSION_DENIED: 10005,
V5_CROSS_ISOLATED_MARGIN_NOT_CHANGED: 110026,
V5_LEVERAGE_NOT_CHANGED: 110043,
V5_MARGIN_MODE_NOT_CHANGED: 110073,
V5_TPSL_NOT_CHANGED: 10001,
V5_RISK_ID_NOT_CHANGED: 10001,
V5_AUTO_ADD_MARGIN_NOT_CHANGED: 10001,
V5_TPSL_ERROR_NO_POSITION: 10001,
QTY_EXCEEDS_MAX_LIMIT: 130006,
ORDER_NOT_FOUND_OR_TOO_LATE_LINEAR: 130010,
ORDER_COST_NOT_AVAILABLE: 130021,
@@ -56,6 +67,7 @@ export const API_ERROR_CODE = {
AUTO_ADD_MARGIN_NOT_MODIFIED: 130060,
INSUFFICIENT_BALANCE_FOR_ORDER_COST_LINEAR: 130080,
SAME_SLTP_MODE_LINEAR: 130150,
TRANSFER_ID_EXISTS: 131214,
RISK_ID_NOT_MODIFIED: 134026,
CONTRACT_ORDER_NOT_EXISTS: 140001,
CONTRACT_INSUFFICIENT_BALANCE: 140007,
@@ -63,7 +75,10 @@ export const API_ERROR_CODE = {
CONTRACT_MARGIN_MODE_NOT_MODIFIED: 140026,
CONTRACT_RISK_LIMIT_INFO_NOT_EXISTS: 140031,
CONTRACT_SET_LEVERAGE_NOT_MODIFIED: 140043,
SUB_USER_NOT_FOUND: 141009,
SPOT_LEVERAGE_TOKEN_ORDER_NOT_FOUND: 175007,
SPOT_MARGIN_NOT_ENABLED: 176008,
SPOT_MARGIN_QUESTIONNAIRE_NOT_SUBMIT: 176037,
/** E.g. USDC Options trading, trying to access a symbol that is no longer active */
CONTRACT_NAME_NOT_EXIST: 3100111,
ORDER_NOT_EXIST: 3100136,

View File

@@ -489,6 +489,8 @@ export class RestClientV5 extends BaseRestClient {
/**
* Query real-time position data, such as position size, cumulative realizedPNL.
*
* 0: cross margin. 1: isolated margin
*
* Unified account covers: Linear contract / Options
*
* Normal account covers: USDT perpetual / Inverse perpetual / Inverse futures
@@ -516,6 +518,7 @@ export class RestClientV5 extends BaseRestClient {
/**
* Select cross margin mode or isolated margin mode.
* 0: cross margin. 1: isolated margin
*
* Covers: USDT perpetual (Normal account) / Inverse contract (Normal account).
*

View File

@@ -71,18 +71,6 @@ export interface GetUniversalTransferRecordsParamsV5 {
cursor?: string;
}
export interface UniversalTransferRecordV5 {
transferId: string;
coin: string;
amount: string;
fromMemberId: string;
toMemberId: string;
fromAccountType: AccountTypeV5;
toAccountType: AccountTypeV5;
timestamp: string;
status: string;
}
export interface GetAllowedDepositCoinInfoParamsV5 {
coin?: string;
chain?: string;
@@ -123,7 +111,6 @@ export interface WithdrawParamsV5 {
address: string;
tag?: string;
amount: string;
timestamp: number;
forceChain?: number;
accountType?: 'SPOT' | 'FUND';
}

View File

@@ -1,4 +1,10 @@
import { CategoryV5, ExecTypeV5, PositionIdx, TPSLModeV5 } from '../v5-shared';
import {
CategoryV5,
ExecTypeV5,
OrderTriggerByV5,
PositionIdx,
TPSLModeV5,
} from '../v5-shared';
export interface PositionInfoParamsV5 {
category: CategoryV5;
@@ -50,8 +56,8 @@ export interface SetTradingStopParamsV5 {
takeProfit?: string;
stopLoss?: string;
trailingStop?: string;
tpTriggerBy?: string;
slTriggerBy?: string;
tpTriggerBy?: OrderTriggerByV5;
slTriggerBy?: OrderTriggerByV5;
activePrice?: string;
tpSize?: string;
slSize?: string;

View File

@@ -79,6 +79,18 @@ export interface InternalTransferRecordV5 {
status: string;
}
export interface UniversalTransferRecordV5 {
transferId: string;
coin: string;
amount: string;
fromMemberId: string;
toMemberId: string;
fromAccountType: AccountTypeV5;
toAccountType: AccountTypeV5;
timestamp: string;
status: string;
}
export interface AllowedDepositCoinInfoV5 {
coin: string;
chain: string;