This repository was archived by the owner on Feb 3, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy patherrors.py
More file actions
282 lines (194 loc) · 6.34 KB
/
errors.py
File metadata and controls
282 lines (194 loc) · 6.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# Drakkar-Software OctoBot-Trading
# Copyright (c) Drakkar-Software, All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3.0 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library.
class OctoBotExchangeError(Exception):
"""
Parent class of local exceptions raised when communicating with exchanges
"""
class MissingFunds(OctoBotExchangeError):
"""
Raised upon placing an order while having insufficient funds
"""
class MissingMinimalExchangeTradeVolume(OctoBotExchangeError):
"""
Raised when a new order is impossible to create due to exchange minimal funds restrictions
"""
class TradingModeIncompatibility(Exception):
"""
Raised when a trading mode is incompatible with the current situation
"""
class OrderCreationError(OctoBotExchangeError):
"""
Raised upon a failed order creation
"""
class OrderEditError(OctoBotExchangeError):
"""
Raised upon a failed order edition
"""
class OrderCancelError(OctoBotExchangeError):
"""
Raised upon a failed order cancel
"""
class OrderNotFoundOnCancelError(OrderCancelError):
"""
Raised upon a failed order cancel because order is not found
"""
class UnexpectedExchangeSideOrderStateError(Exception):
"""
Raised when an order is in an unexpected state when fetched from exchange
"""
class OpenOrderError(UnexpectedExchangeSideOrderStateError):
"""
Raised when an order is unexpectedly open
"""
class FilledOrderError(UnexpectedExchangeSideOrderStateError):
"""
Raised when an order is unexpectedly filled
"""
class CancellingOrderError(UnexpectedExchangeSideOrderStateError):
"""
Raised when an order is unexpectedly cancelling
"""
class ClosedOrderError(UnexpectedExchangeSideOrderStateError):
"""
Raised when an order is unexpectedly closed
"""
class NotSupported(Exception):
"""
Raised when an exchange doesn't support the required element
"""
class FailedRequest(OctoBotExchangeError):
"""
Raised upon a failed request on an exchange API
"""
class RateLimitExceeded(OctoBotExchangeError):
"""
Raised upon an exchange API rate limit error
"""
class UnavailableOrderTypeForMarketError(OctoBotExchangeError):
"""
Raised when an exchange refuses to create a given type of order that should normally be supported
"""
class AuthenticationError(OctoBotExchangeError):
"""
Raised when an exchange failed to authenticate
"""
class ExchangeInternalSyncError(OctoBotExchangeError):
"""
Raised when an exchange is returning an error due to its internal sync process
(ex: when an order is filled but portfolio has not yet been updated)
"""
class ExchangeCompliancyError(OctoBotExchangeError):
"""
Raised when an exchange failed to execute the given request because of compliance rules for the current user account
"""
class ExchangeAccountSymbolPermissionError(OctoBotExchangeError):
"""
Raised when an exchange failed to execute the given request because of allowed traded symbols
on the current user account
"""
class PortfolioNegativeValueError(Exception):
"""
Raised when the portfolio is being updated with a negative value
"""
class PortfolioOperationError(Exception):
"""
Raised when an invalid portfolio operation is asked for
"""
class InvalidOrderState(Exception):
"""
Raised when an order state is handled on a previously cleared order
(cleared orders should never be touched)
"""
class InvalidLeverageValue(Exception):
"""
Raised when a leverage is being updated with an invalid value
"""
class InvalidPositionSide(Exception):
"""
Raised when an order with an invalid position side is triggering a position update
"""
class InvalidPosition(Exception):
"""
Raised when an invalid position is created
"""
class ContractExistsError(Exception):
"""
Raised when asking for a contract that doesn't exist
"""
class UnhandledContractError(Exception):
"""
Raised when trying to use a contract that is not supported / implemented
"""
class TooManyOpenPositionError(Exception):
"""
Raised when changing future contract attributes without closing positions first
"""
class DuplicateTransactionIdError(Exception):
"""
Raised when trying to add a new transaction with a duplicate id
"""
class LiquidationPriceReached(Exception):
"""
Raised when the liquidation price has been reach
"""
class ConflictingOrdersError(Exception):
"""
Raised when an order is that would create an order conflict is created
"""
class OrderGroupTriggerArgumentError(Exception):
"""
Raised when an order triggered with invalid arguments
"""
class ConflictingOrderGroupError(Exception):
"""
Raised when creating a group with an existing name
"""
class MissingPriceDataError(Exception):
"""
Raised when a price info is missing
"""
class PendingPriceDataError(Exception):
"""
Raised when a price info is waiting to be updated
"""
class UnreachableExchange(Exception):
"""
Raised when an exchange cant be reached (likely when it's offline)
"""
class InvalidArgumentError(Exception):
"""
Raised when a keyword is called with invalid arguments
"""
class OrderDescriptionNotFoundError(Exception):
"""
Raised when an order description is not found
"""
class AdapterError(Exception):
"""
Raised when an error occurs in an adapter
"""
class UnexpectedAdapterError(Exception):
"""
Raised when an unexpected error occurs in an adapter
"""
class IncompletePNLError(Exception):
"""
Raised when a pnl computation is asked on a invalid pnl
"""
class InitializingError(Exception):
"""
Raised when OctoBot is still in initialization
"""