expand test coverage to linear endpoints

This commit is contained in:
tiagosiebler
2022-05-11 18:12:44 +01:00
parent 07ec505407
commit 61c278c318
4 changed files with 311 additions and 82 deletions

View File

@@ -386,14 +386,6 @@ export class LinearClient extends BaseRestClient {
);
}
/** @deprecated use setPositionTpSlMode() instead */
setSwitchMode(params?: {
symbol: string;
tp_sl_mode: typeof positionTpSlModeEnum[keyof typeof positionTpSlModeEnum];
}): GenericAPIResponse {
return this.requestWrapper.post('private/linear/tpsl/switch-mode', params);
}
/**
* Switch TP/SL mode between full or partial. When set to Partial, TP/SL orders may have a quantity less than the position size.
* This is set with the setTradingStop() method. Use `positionTpSlModeEnum` for the tp_sl_mode parameter.
@@ -477,7 +469,7 @@ export class LinearClient extends BaseRestClient {
setRiskLimit(params: {
symbol: string;
side: string;
risk_id: string;
risk_id: number;
}): GenericAPIResponse {
return this.requestWrapper.post('private/linear/position/set-risk', params);
}

View File

@@ -1,4 +1,5 @@
export const API_ERROR_CODE = {
PARAMS_MISSING_OR_WRONG: 10001,
ORDER_NOT_FOUND_OR_TOO_LATE: 20001,
POSITION_STATUS_NOT_NORMAL: 30013,
CANNOT_SET_TRADING_STOP_FOR_ZERO_POS: 30024,
@@ -14,4 +15,13 @@ export const API_ERROR_CODE = {
RISK_LIMIT_NOT_EXISTS: 30090,
LEVERAGE_NOT_MODIFIED: 34036,
SAME_SLTP_MODE: 37002,
ORDER_NOT_FOUND_OR_TOO_LATE_LINEAR: 130010,
ORDER_COST_NOT_AVAILABLE: 130021,
CANNOT_SET_LINEAR_TRADING_STOP_FOR_ZERO_POS: 130024,
ISOLATED_NOT_MODIFIED_LINEAR: 130056,
POSITION_SIZE_IS_ZERO: 130057,
AUTO_ADD_MARGIN_NOT_MODIFIED: 130060,
INSUFFICIENT_BALANCE_FOR_ORDER_COST_LINEAR: 130080,
SAME_SLTP_MODE_LINEAR: 130150,
RISK_ID_NOT_MODIFIED: 134026,
} as const;