binance_api/futures/
error.rs

1//! Futures-specific error codes
2//! https://binance-docs.github.io/apidocs/futures/en/#error-codes
3use crate::error::ResponseError;
4
5/// 10xx - General Server or Network issues
6/// <https://binance-docs.github.io/apidocs/futures/en/#10xx-general-server-or-network-issues>
7impl ResponseError {
8    /// This IP is already on the white list.
9    pub const FUTURES_DUPLICATE_IP: i32 = -1004;
10
11    /// No such IP has been white listed.
12    pub const FUTURES_NO_SUCH_IP: i32 = -1005;
13
14    /// Error message received.
15    ///
16    /// ATTENTION: No intelligible description was provided in the docs.
17    pub const FUTURES_ERROR_MSG_RECEIVED: i32 = -1010;
18
19    /// This IP cannot access this route.
20    pub const FUTURES_NON_WHITE_LIST: i32 = -1011;
21
22    /// Invalid message.
23    ///
24    /// ATTENTION: No intelligible description was provided in the docs.
25    pub const FUTURES_INVALID_MESSAGE: i32 = -1013;
26
27    /// Start time is greater than end time.
28    pub const FUTURES_START_TIME_GREATER_THAN_END_TIME: i32 = -1023;
29}
30
31/// 11xx - Request issues
32/// <https://binance-docs.github.io/apidocs/futures/en/#11xx-request-issues>
33impl ResponseError {
34    /// Invalid asset.
35    pub const FUTURES_BAD_ASSET: i32 = -1108;
36
37    /// Invalid account.
38    pub const FUTURES_BAD_ACCOUNT: i32 = -1109;
39
40    /// Invalid symbolType.
41    pub const FUTURES_BAD_INSTRUMENT_TYPE: i32 = -1110;
42
43    /// Withdrawal amount must be negative.
44    pub const FUTURES_WITHDRAW_NOT_NEGATIVE: i32 = -1113;
45
46    /// Invalid newOrderRespType.
47    pub const FUTURES_INVALID_NEW_ORDER_RESP_TYPE: i32 = -1136;
48}
49
50/// 20xx - Processing issues
51/// <https://binance-docs.github.io/apidocs/futures/en/#20xx-processing-issues>
52impl ResponseError {
53    /// Balance is insufficient.
54    pub const FUTURES_BALANCE_NOT_SUFFICIENT: i32 = -2018;
55
56    /// Margin is insufficient.
57    pub const FUTURES_MARGIN_NOT_SUFFICIENT: i32 = -2019;
58
59    /// Unable to fill.
60    pub const FUTURES_UNABLE_TO_FILL: i32 = -2020;
61
62    /// Order would immediately trigger.
63    pub const FUTURES_ORDER_WOULD_IMMEDIATELY_TRIGGER: i32 = -2021;
64
65    /// ReduceOnly Order is rejected.
66    pub const FUTURES_REDUCE_ONLY_REJECT: i32 = -2022;
67
68    /// User in liquidation mode now.
69    pub const FUTURES_USER_IN_LIQUIDATION: i32 = -2023;
70
71    /// Position is not sufficient.
72    pub const FUTURES_POSITION_NOT_SUFFICIENT: i32 = -2024;
73
74    /// Maximum open order limit reached.
75    pub const FUTURES_MAX_OPEN_ORDER_EXCEEDED: i32 = -2025;
76
77    /// This OrderType is not supported when reduceOnly.
78    pub const FUTURES_REDUCE_ONLY_ORDER_TYPE_NOT_SUPPORTED: i32 = -2026;
79
80    /// Exceeded the maximum allowable position at current leverage.
81    pub const FUTURES_MAX_LEVERAGE_RATIO: i32 = -2027;
82
83    /// Leverage is smaller than permitted: insufficient margin balance.
84    pub const FUTURES_MIN_LEVERAGE_RATIO: i32 = -2028;
85}
86
87/// 4xxx - Filters and other issues
88/// <https://binance-docs.github.io/apidocs/futures/en/#40xx-filters-and-other-issues>
89impl ResponseError {
90    /// Invalid order status.
91    pub const FUTURES_INVALID_ORDER_STATUS: i32 = -4000;
92
93    /// Price less than 0.
94    pub const FUTURES_PRICE_LESS_THAN_ZERO: i32 = -4001;
95
96    /// Price greater than max price.
97    pub const FUTURES_PRICE_GREATER_THAN_MAX_PRICE: i32 = -4002;
98
99    /// Quantity less than zero.
100    pub const FUTURES_QTY_LESS_THAN_ZERO: i32 = -4003;
101
102    /// Quantity less than min quantity.
103    pub const FUTURES_QTY_LESS_THAN_MIN_QTY: i32 = -4004;
104
105    /// Quantity greater than max quantity.
106    pub const FUTURES_QTY_GREATER_THAN_MAX_QTY: i32 = -4005;
107
108    /// Stop price less than zero.
109    pub const FUTURES_STOP_PRICE_LESS_THAN_ZERO: i32 = -4006;
110
111    /// Stop price greater than max price.
112    pub const FUTURES_STOP_PRICE_GREATER_THAN_MAX_PRICE: i32 = -4007;
113
114    /// Tick size less than zero.
115    pub const FUTURES_TICK_SIZE_LESS_THAN_ZERO: i32 = -4008;
116
117    /// Max price less than min price.
118    pub const FUTURES_MAX_PRICE_LESS_THAN_MIN_PRICE: i32 = -4009;
119
120    /// Max qty less than min qty.
121    pub const FUTURES_MAX_QTY_LESS_THAN_MIN_QTY: i32 = -4010;
122
123    /// Step size less than zero.
124    pub const FUTURES_STEP_SIZE_LESS_THAN_ZERO: i32 = -4011;
125
126    /// Max mum orders less than zero.
127    pub const FUTURES_MAX_NUM_ORDERS_LESS_THAN_ZERO: i32 = -4012;
128
129    /// Price less than min price.
130    pub const FUTURES_PRICE_LESS_THAN_MIN_PRICE: i32 = -4013;
131
132    /// Price not increased by tick size.
133    pub const FUTURES_PRICE_NOT_INCREASED_BY_TICK_SIZE: i32 = -4014;
134
135    /// Client order id is not valid.
136    /// Consider the length of it should not be more than 36 chars.
137    pub const FUTURES_INVALID_CL_ORD_ID_LEN: i32 = -4015;
138
139    /// Price is higher than mark price multiplier cap.
140    pub const FUTURES_PRICE_HIGHER_THAN_MULTIPLIER_CAP: i32 = -4016;
141
142    /// Multiplier up less than zero.
143    pub const FUTURES_MULTIPLIER_UP_LESS_THAN_ZERO: i32 = -4017;
144
145    /// Multiplier down less than zero.
146    pub const FUTURES_MULTIPLIER_DOWN_LESS_THAN_ZERO: i32 = -4018;
147
148    /// Composite scale too large.
149    pub const FUTURES_COMPOSITE_SCALE_OVERFLOW: i32 = -4019;
150
151    /// Target strategy invalid for the given combination of orderType and reduceOnly.
152    pub const FUTURES_TARGET_STRATEGY_INVALID: i32 = -4020;
153
154    /// Invalid depth limit.
155    pub const FUTURES_INVALID_DEPTH_LIMIT: i32 = -4021;
156
157    /// Market status sent is not valid.
158    pub const FUTURES_WRONG_MARKET_STATUS: i32 = -4022;
159
160    /// Qty not increased by step size.
161    pub const FUTURES_QTY_NOT_INCREASED_BY_STEP_SIZE: i32 = -4023;
162
163    /// Price is lower than mark price multiplier floor.
164    pub const FUTURES_PRICE_LOWER_THAN_MULTIPLIER_DOWN: i32 = -4024;
165
166    /// Multiplier decimal less than zero.
167    pub const FUTURES_MULTIPLIER_DECIMAL_LESS_THAN_ZERO: i32 = -4025;
168
169    /// Commission invalid (less than zero or greater than the maximum).
170    pub const FUTURES_COMMISSION_INVALID: i32 = -4026;
171
172    /// Invalid account type.
173    pub const FUTURES_INVALID_ACCOUNT_TYPE: i32 = -4027;
174
175    /// Invalid leverage.
176    pub const FUTURES_INVALID_LEVERAGE: i32 = -4028;
177
178    /// Tick size precision is invalid.
179    pub const FUTURES_INVALID_TICK_SIZE_PRECISION: i32 = -4029;
180
181    /// Step size precision is invalid.
182    pub const FUTURES_INVALID_STEP_SIZE_PRECISION: i32 = -4030;
183
184    /// Invalid parameter working type.
185    pub const FUTURES_INVALID_WORKING_TYPE: i32 = -4031;
186
187    /// Exceed maximum cancel order size.
188    pub const FUTURES_EXCEED_MAX_CANCEL_ORDER_SIZE: i32 = -4032;
189
190    /// Insurance account not found.
191    pub const FUTURES_INSURANCE_ACCOUNT_NOT_FOUND: i32 = -4033;
192
193    /// Balance Type is invalid.
194    pub const FUTURES_INVALID_BALANCE_TYPE: i32 = -4044;
195
196    /// Reach max stop order limit.
197    pub const FUTURES_MAX_STOP_ORDER_EXCEEDED: i32 = -4045;
198
199    /// No need to change margin type.
200    pub const FUTURES_NO_NEED_TO_CHANGE_MARGIN_TYPE: i32 = -4046;
201
202    /// Margin type cannot be changed if there exists open orders.
203    pub const FUTURES_THERE_EXISTS_OPEN_ORDERS: i32 = -4047;
204
205    /// Margin type cannot be changed if there exists position.
206    pub const FUTURES_THERE_EXISTS_QUANTITY: i32 = -4048;
207
208    /// Add margin only support for isolated position.
209    pub const FUTURES_ADD_ISOLATED_MARGIN_REJECT: i32 = -4049;
210
211    /// Cross balance insufficient.
212    pub const FUTURES_CROSS_BALANCE_INSUFFICIENT: i32 = -4050;
213
214    /// Isolated balance insufficient.
215    pub const FUTURES_ISOLATED_BALANCE_INSUFFICIENT: i32 = -4051;
216
217    /// No need to change auto add margin.
218    pub const FUTURES_NO_NEED_TO_CHANGE_AUTO_ADD_MARGIN: i32 = -4052;
219
220    /// Auto add margin only support for isolated position.
221    pub const FUTURES_AUTO_ADD_CROSSED_MARGIN_REJECT: i32 = -4053;
222
223    /// Cannot add position margin: position is 0.
224    pub const FUTURES_ADD_ISOLATED_MARGIN_NO_POSITION_REJECT: i32 = -4054;
225
226    /// Amount must be positive.
227    pub const FUTURES_AMOUNT_MUST_BE_POSITIVE: i32 = -4055;
228
229    /// Invalid API key type.
230    pub const FUTURES_INVALID_API_KEY_TYPE: i32 = -4056;
231
232    /// Invalid API public key
233    pub const FUTURES_INVALID_RSA_PUBLIC_KEY: i32 = -4057;
234
235    /// maxPrice and priceDecimal too large.
236    pub const FUTURES_MAX_PRICE_TOO_LARGE: i32 = -4058;
237
238    /// No need to change position side.
239    pub const FUTURES_NO_NEED_TO_CHANGE_POSITION_SIDE: i32 = -4059;
240
241    /// Invalid position side.
242    pub const FUTURES_INVALID_POSITION_SIDE: i32 = -4060;
243
244    /// Order's position side does not match user's setting.
245    pub const FUTURES_POSITION_SIDE_NOT_MATCH: i32 = -4061;
246
247    /// Invalid or improper reduceOnly value.
248    pub const FUTURES_REDUCE_ONLY_CONFLICT: i32 = -4062;
249
250    /// Invalid options request type.
251    pub const FUTURES_INVALID_OPTIONS_REQUEST_TYPE: i32 = -4063;
252
253    /// Invalid options time frame.
254    pub const FUTURES_INVALID_OPTIONS_TIME_FRAME: i32 = -4064;
255
256    /// Invalid options amount.
257    pub const FUTURES_INVALID_OPTIONS_AMOUNT: i32 = -4065;
258
259    /// Invalid options event type.
260    pub const FUTURES_INVALID_OPTIONS_EVENT_TYPE: i32 = -4066;
261
262    /// Position side cannot be changed if there exists open orders.
263    pub const FUTURES_POSITION_SIDE_CHANGE_EXISTS_OPEN_ORDERS: i32 = -4067;
264
265    /// Position side cannot be changed if there exists position.
266    pub const FUTURES_POSITION_SIDE_CHANGE_EXISTS_QUANTITY: i32 = -4068;
267
268    /// Invalid options premium fee.
269    pub const FUTURES_INVALID_OPTIONS_PREMIUM_FEE: i32 = -4069;
270
271    /// Client options id is not valid.
272    /// Consider the length of it should be less than 32 chars.
273    pub const FUTURES_INVALID_CL_OPTIONS_ID_LEN: i32 = -4070;
274
275    /// Invalid options direction.
276    pub const FUTURES_INVALID_OPTIONS_DIRECTION: i32 = -4071;
277
278    /// Premium fee is not updated, reject order.
279    pub const FUTURES_OPTIONS_PREMIUM_NOT_UPDATE: i32 = -4072;
280
281    /// Input premium fee is less than 0, reject order.
282    pub const FUTURES_OPTIONS_PREMIUM_INPUT_LESS_THAN_ZERO: i32 = -4073;
283
284    /// Order amount is bigger than upper boundary or less than 0, reject order.
285    pub const FUTURES_OPTIONS_AMOUNT_BIGGER_THAN_UPPER: i32 = -4074;
286
287    /// Output premium fee is less than 0, reject order.
288    pub const FUTURES_OPTIONS_PREMIUM_OUTPUT_ZERO: i32 = -4075;
289
290    /// Original fee is too much higher than last fee.
291    pub const FUTURES_OPTIONS_PREMIUM_TOO_DIFF: i32 = -4076;
292
293    /// Place order amount has reached to limit, reject order.
294    pub const FUTURES_OPTIONS_PREMIUM_REACH_LIMIT: i32 = -4077;
295
296    /// Options internal error.
297    pub const FUTURES_OPTIONS_COMMON_ERROR: i32 = -4078;
298
299    /// Invalid options id (may be a duplicate for a user).
300    pub const FUTURES_INVALID_OPTIONS_ID: i32 = -4079;
301
302    /// User not found.
303    pub const FUTURES_OPTIONS_USER_NOT_FOUND: i32 = -4080;
304
305    /// Options not found.
306    pub const FUTURES_OPTIONS_NOT_FOUND: i32 = -4081;
307
308    /// Invalid number of batch place orders.
309    pub const FUTURES_INVALID_BATCH_PLACE_ORDER_SIZE: i32 = -4082;
310
311    /// Fail to place batch orders.
312    pub const FUTURES_PLACE_BATCH_ORDERS_FAIL: i32 = -4083;
313
314    /// Method is not allowed currently. Upcoming soon.
315    pub const FUTURES_UPCOMING_METHOD: i32 = -4084;
316
317    /// Invalid notional limit coefficient.
318    pub const FUTURES_INVALID_NOTIONAL_LIMIT_COEF: i32 = -4085;
319
320    /// Invalid price spread threshold.
321    pub const FUTURES_INVALID_PRICE_SPREAD_THRESHOLD: i32 = -4086;
322
323    /// User can only place reduce only order.
324    pub const FUTURES_REDUCE_ONLY_ORDER_PERMISSION: i32 = -4087;
325
326    /// User can not place order currently.
327    pub const FUTURES_NO_PLACE_ORDER_PERMISSION: i32 = -4088;
328
329    /// Invalid contract type.
330    pub const FUTURES_INVALID_CONTRACT_TYPE: i32 = -4104;
331
332    /// clientTranId is not valid.
333    /// Consider the length of it should be less than 64 chars.
334    pub const FUTURES_INVALID_CLIENT_TRAN_ID_LEN: i32 = -4114;
335
336    /// clientTranId is duplicated.
337    /// Consider it should be unique within 7 days.
338    pub const FUTURES_DUPLICATED_CLIENT_TRAN_ID: i32 = -4115;
339
340    /// ReduceOnly Order Failed. Please check your existing position and open orders.
341    pub const FUTURES_REDUCE_ONLY_MARGIN_CHECK_FAILED: i32 = -4118;
342
343    /// The counterparty's best price does not meet the PERCENT_PRICE filter limit.
344    pub const FUTURES_MARKET_ORDER_REJECT: i32 = -4131;
345
346    /// Invalid activation price.
347    pub const FUTURES_INVALID_ACTIVATION_PRICE: i32 = -4135;
348
349    /// Quantity must be zero with closePosition equals true.
350    pub const FUTURES_QUANTITY_EXISTS_WITH_CLOSE_POSITION: i32 = -4137;
351
352    /// Reduce only must be true with closePosition equals true.
353    pub const FUTURES_REDUCE_ONLY_MUST_BE_TRUE: i32 = -4138;
354
355    /// Order type can not be market if it's unable to cancel.
356    pub const FUTURES_ORDER_TYPE_CANNOT_BE_MKT: i32 = -4139;
357
358    /// Invalid symbol status for opening position.
359    pub const FUTURES_INVALID_OPENING_POSITION_STATUS: i32 = -4140;
360
361    /// Symbol is closed.
362    pub const FUTURES_SYMBOL_ALREADY_CLOSED: i32 = -4141;
363
364    /// REJECT: take profit or stop order will be triggered immediately.
365    pub const FUTURES_STRATEGY_INVALID_TRIGGER_PRICE: i32 = -4142;
366
367    /// Invalid pair.
368    pub const FUTURES_INVALID_PAIR: i32 = -4144;
369
370    /// Leverage reduction is not supported in Isolated Margin Mode with open positions.
371    pub const FUTURES_ISOLATED_LEVERAGE_REJECT_WITH_POSITION: i32 = -4161;
372
373    /// Order's notional must be no smaller than 5.0 (unless you choose reduce only).
374    pub const FUTURES_MIN_NOTIONAL: i32 = -4164;
375
376    /// Invalid time interval.
377    pub const FUTURES_INVALID_TIME_INTERVAL: i32 = -4165;
378
379    /// Price is higher than stop price multiplier cap.
380    pub const FUTURES_PRICE_HIGHER_THAN_STOP_MULTIPLIER_CAP: i32 = -4183;
381
382    /// Price is lower than stop price multiplier floor.
383    pub const FUTURES_PRICE_LOWER_THAN_STOP_MULTIPLIER_DOWN: i32 = -4184;
384}