bitmex-api 0.0.64__py3-none-any.whl → 0.0.66__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
bitmex/ccxt/__init__.py CHANGED
@@ -26,7 +26,7 @@ sys.modules['ccxt'] = ccxt_module
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
29
- __version__ = '4.4.85'
29
+ __version__ = '4.4.87'
30
30
 
31
31
  # ----------------------------------------------------------------------------
32
32
 
@@ -88,9 +88,8 @@ from ccxt.base.errors import UnsubscribeError # noqa: F4
88
88
  from ccxt.base.errors import error_hierarchy # noqa: F401
89
89
 
90
90
  from ccxt.bitmex import bitmex # noqa: F401
91
- from ccxt.kuna import kuna # noqa: F401
92
91
 
93
- exchanges = [ 'bitmex', 'kuna',]
92
+ exchanges = [ 'bitmex',]
94
93
 
95
94
  base = [
96
95
  'Exchange',
@@ -8,7 +8,7 @@ sys.modules['ccxt'] = ccxt_module
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
11
- __version__ = '4.4.85'
11
+ __version__ = '4.4.87'
12
12
 
13
13
  # -----------------------------------------------------------------------------
14
14
 
@@ -68,9 +68,8 @@ from ccxt.base.errors import error_hierarchy # noqa: F4
68
68
 
69
69
 
70
70
  from ccxt.async_support.bitmex import bitmex # noqa: F401
71
- from ccxt.async_support.kuna import kuna # noqa: F401
72
71
 
73
- exchanges = [ 'bitmex', 'kuna',]
72
+ exchanges = [ 'bitmex',]
74
73
 
75
74
  base = [
76
75
  'Exchange',
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.4.85'
5
+ __version__ = '4.4.87'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -176,15 +176,7 @@ class Exchange(BaseExchange):
176
176
  if (socksProxy not in self.socks_proxy_sessions):
177
177
  # Create our SSL context object with our CA cert file
178
178
  self.open() # ensure `asyncio_loop` is set
179
- self.aiohttp_socks_connector = ProxyConnector.from_url(
180
- socksProxy,
181
- # extra args copied from self.open()
182
- ssl=self.ssl_context,
183
- loop=self.asyncio_loop,
184
- enable_cleanup_closed=True
185
- )
186
- self.socks_proxy_sessions[socksProxy] = aiohttp.ClientSession(loop=self.asyncio_loop, connector=self.aiohttp_socks_connector, trust_env=self.aiohttp_trust_env)
187
- proxy_session = self.socks_proxy_sessions[socksProxy]
179
+ proxy_session = self.get_socks_proxy_session(socksProxy)
188
180
  # add aiohttp_proxy for python as exclusion
189
181
  elif self.aiohttp_proxy:
190
182
  final_proxy = self.aiohttp_proxy
@@ -267,6 +259,20 @@ class Exchange(BaseExchange):
267
259
  return http_response
268
260
  return response.content
269
261
 
262
+ def get_socks_proxy_session(self, socksProxy):
263
+ if (self.socks_proxy_sessions is None):
264
+ self.socks_proxy_sessions = {}
265
+ if (socksProxy not in self.socks_proxy_sessions):
266
+ self.aiohttp_socks_connector = ProxyConnector.from_url(
267
+ socksProxy,
268
+ # extra args copied from self.open()
269
+ ssl=self.ssl_context,
270
+ loop=self.asyncio_loop,
271
+ enable_cleanup_closed=True
272
+ )
273
+ self.socks_proxy_sessions[socksProxy] = aiohttp.ClientSession(loop=self.asyncio_loop, connector=self.aiohttp_socks_connector, trust_env=self.aiohttp_trust_env)
274
+ return self.socks_proxy_sessions[socksProxy]
275
+
270
276
  async def load_markets_helper(self, reload=False, params={}):
271
277
  if not reload:
272
278
  if self.markets:
@@ -411,19 +417,12 @@ class Exchange(BaseExchange):
411
417
  # we use aiohttp instead of fastClient now because of this
412
418
  # https://github.com/ccxt/ccxt/pull/25995
413
419
  self.clients[url] = AiohttpClient(url, on_message, on_error, on_close, on_connected, options)
414
- self.clients[url].proxy = self.get_ws_proxy()
420
+ # set http/s proxy (socks proxy should be set in other place)
421
+ httpProxy, httpsProxy, socksProxy = self.check_ws_proxy_settings()
422
+ if (httpProxy or httpsProxy):
423
+ self.clients[url].proxy = httpProxy if httpProxy else httpsProxy
415
424
  return self.clients[url]
416
425
 
417
- def get_ws_proxy(self):
418
- httpProxy, httpsProxy, socksProxy = self.check_ws_proxy_settings()
419
- if httpProxy:
420
- return httpProxy
421
- elif httpsProxy:
422
- return httpsProxy
423
- elif socksProxy:
424
- return socksProxy
425
- return None
426
-
427
426
  def delay(self, timeout, method, *args):
428
427
  return self.asyncio_loop.call_later(timeout / 1000, self.spawn, method, *args)
429
428
 
@@ -486,8 +485,13 @@ class Exchange(BaseExchange):
486
485
  if not subscribed:
487
486
  client.subscriptions[subscribe_hash] = subscription or True
488
487
 
488
+ selected_session = self.session
489
+ # http/s proxy is being set in other places
490
+ httpProxy, httpsProxy, socksProxy = self.check_ws_proxy_settings()
491
+ if (socksProxy):
492
+ selected_session = self.get_socks_proxy_session(socksProxy)
489
493
  connected = client.connected if client.connected.done() \
490
- else asyncio.ensure_future(client.connect(self.session, backoff_delay))
494
+ else asyncio.ensure_future(client.connect(selected_session, backoff_delay))
491
495
 
492
496
  def after(fut):
493
497
  # todo: decouple signing from subscriptions
@@ -899,15 +903,15 @@ class Exchange(BaseExchange):
899
903
  if self.enableRateLimit:
900
904
  cost = self.calculate_rate_limiter_cost(api, method, path, params, config)
901
905
  await self.throttle(cost)
906
+ retries = None
907
+ retries, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailure', 0)
908
+ retryDelay = None
909
+ retryDelay, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailureDelay', 0)
902
910
  self.lastRestRequestTimestamp = self.milliseconds()
903
911
  request = self.sign(path, api, method, params, headers, body)
904
912
  self.last_request_headers = request['headers']
905
913
  self.last_request_body = request['body']
906
914
  self.last_request_url = request['url']
907
- retries = None
908
- retries, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailure', 0)
909
- retryDelay = None
910
- retryDelay, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailureDelay', 0)
911
915
  for i in range(0, retries + 1):
912
916
  try:
913
917
  return await self.fetch(request['url'], request['method'], request['headers'], request['body'])
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.85'
7
+ __version__ = '4.4.87'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -311,6 +311,7 @@ class Exchange(object):
311
311
  base_currencies = None
312
312
  quote_currencies = None
313
313
  currencies = None
314
+
314
315
  options = None # Python does not allow to define properties in run-time with setattr
315
316
  isSandboxModeEnabled = False
316
317
  accounts = None
@@ -1533,7 +1534,9 @@ class Exchange(object):
1533
1534
  currencies = None
1534
1535
  if self.has['fetchCurrencies'] is True:
1535
1536
  currencies = self.fetch_currencies()
1537
+ self.options['cachedCurrencies'] = currencies
1536
1538
  markets = self.fetch_markets(params)
1539
+ del self.options['cachedCurrencies']
1537
1540
  return self.set_markets(markets, currencies)
1538
1541
 
1539
1542
  def fetch_markets(self, params={}):
@@ -4166,11 +4169,11 @@ class Exchange(object):
4166
4169
  raise NotSupported(self.id + ' - ' + networkCode + ' network did not return any result for ' + currencyCode)
4167
4170
  else:
4168
4171
  # if networkCode was provided by user, we should check it after response, referenced exchange doesn't support network-code during request
4169
- networkId = networkCode if isIndexedByUnifiedNetworkCode else self.network_code_to_id(networkCode, currencyCode)
4170
- if networkId in indexedNetworkEntries:
4171
- chosenNetworkId = networkId
4172
+ networkIdOrCode = networkCode if isIndexedByUnifiedNetworkCode else self.network_code_to_id(networkCode, currencyCode)
4173
+ if networkIdOrCode in indexedNetworkEntries:
4174
+ chosenNetworkId = networkIdOrCode
4172
4175
  else:
4173
- raise NotSupported(self.id + ' - ' + networkId + ' network was not found for ' + currencyCode + ', use one of ' + ', '.join(availableNetworkIds))
4176
+ raise NotSupported(self.id + ' - ' + networkIdOrCode + ' network was not found for ' + currencyCode + ', use one of ' + ', '.join(availableNetworkIds))
4174
4177
  else:
4175
4178
  if responseNetworksLength == 0:
4176
4179
  raise NotSupported(self.id + ' - no networks were returned for ' + currencyCode)
@@ -4458,15 +4461,15 @@ class Exchange(object):
4458
4461
  if self.enableRateLimit:
4459
4462
  cost = self.calculate_rate_limiter_cost(api, method, path, params, config)
4460
4463
  self.throttle(cost)
4464
+ retries = None
4465
+ retries, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailure', 0)
4466
+ retryDelay = None
4467
+ retryDelay, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailureDelay', 0)
4461
4468
  self.lastRestRequestTimestamp = self.milliseconds()
4462
4469
  request = self.sign(path, api, method, params, headers, body)
4463
4470
  self.last_request_headers = request['headers']
4464
4471
  self.last_request_body = request['body']
4465
4472
  self.last_request_url = request['url']
4466
- retries = None
4467
- retries, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailure', 0)
4468
- retryDelay = None
4469
- retryDelay, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailureDelay', 0)
4470
4473
  for i in range(0, retries + 1):
4471
4474
  try:
4472
4475
  return self.fetch(request['url'], request['method'], request['headers'], request['body'])
@@ -8,7 +8,7 @@ sys.modules['ccxt'] = ccxt_module
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
11
- __version__ = '4.4.85'
11
+ __version__ = '4.4.87'
12
12
 
13
13
  # ----------------------------------------------------------------------------
14
14
 
@@ -79,6 +79,96 @@ from ccxt.base.errors import error_hierarchy # noqa: F4
79
79
 
80
80
 
81
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
+
82
172
 
83
173
 
84
174
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bitmex-api
3
- Version: 0.0.64
3
+ Version: 0.0.66
4
4
  Summary: bitmex crypto exchange api client
5
5
  Project-URL: Homepage, https://github.com/ccxt/ccxt
6
6
  Project-URL: Issues, https://github.com/ccxt/ccxt
@@ -1,11 +1,11 @@
1
1
  bitmex/__init__.py,sha256=YoXAuxG_VioYinNV_H2dBOxO7R1bhKl6aL_6s6TfuWg,246
2
- bitmex/ccxt/__init__.py,sha256=HSVkQ6UwBT_D2MC-8qBPPboVum1v7IsatFsPvsae1kM,6142
2
+ bitmex/ccxt/__init__.py,sha256=Xy7Sy4dk7lBG-AWwn7Yi_xog-0b8P0PJO6W5ln1uXN0,6048
3
3
  bitmex/ccxt/bitmex.py,sha256=U7MzNIUW_YBtBH2pMXOXPZ9oo25j2n_-iAwDWSDpd58,131801
4
4
  bitmex/ccxt/abstract/bitmex.py,sha256=v15OP-vSO_eotD6KVf1BgKrbPxCPl2eXXYIuzWF1dl4,10774
5
- bitmex/ccxt/async_support/__init__.py,sha256=IFOfl_NmTMFCAn9frG-9h0cUlOiGHo8sHBPwfHHGa6o,4885
5
+ bitmex/ccxt/async_support/__init__.py,sha256=MXqdLnrvyuTTExHNHpFwEm5BtDyYe5Ca77ALmhGdM4w,4781
6
6
  bitmex/ccxt/async_support/bitmex.py,sha256=ySXncjhPs47qdGGkNgjZppMIfHf4UmqKOungNwz-EQk,132379
7
7
  bitmex/ccxt/async_support/base/__init__.py,sha256=aVYSsFi--b4InRs9zDN_wtCpj8odosAB726JdUHavrk,67
8
- bitmex/ccxt/async_support/base/exchange.py,sha256=ez6SSEp3QG4HwJ3H4qAFmC4mHA9IVz_gEaReL_Z3kzM,118577
8
+ bitmex/ccxt/async_support/base/exchange.py,sha256=pPVR10gnuBSN2R_vwgfnsqrvTXv7H30sXdPFls3skCk,119007
9
9
  bitmex/ccxt/async_support/base/throttler.py,sha256=tvDVcdRUVYi8fZRlEcnqtgzcgB_KMUMRs5Pu8tuU-tU,1847
10
10
  bitmex/ccxt/async_support/base/ws/__init__.py,sha256=uockzpLuwntKGZbs5EOWFe-Zg-k6Cj7GhNJLc_RX0so,1791
11
11
  bitmex/ccxt/async_support/base/ws/aiohttp_client.py,sha256=Y5HxAVXyyYduj6b6SbbUZETlq3GrVMzrkW1r-TMgpb8,6329
@@ -18,10 +18,10 @@ bitmex/ccxt/async_support/base/ws/order_book_side.py,sha256=GhnGUt78pJ-AYL_Dq9pr
18
18
  bitmex/ccxt/base/__init__.py,sha256=eTx1OE3HJjspFUQjGm6LBhaQiMKJnXjkdP-JUXknyQ0,1320
19
19
  bitmex/ccxt/base/decimal_to_precision.py,sha256=fgWRBzRTtsf3r2INyS4f7WHlzgjB5YM1ekiwqD21aac,6634
20
20
  bitmex/ccxt/base/errors.py,sha256=MvCrL_sAM3de616T6RE0PSxiF2xV6Qqz5b1y1ghidbk,4888
21
- bitmex/ccxt/base/exchange.py,sha256=w3T16lJ5Ii89lYzC5xpr_tZqilvTWgcF6D9WKfRfzzI,328021
21
+ bitmex/ccxt/base/exchange.py,sha256=NGY9v0WAuFqoAPgiDPVR87xTwsjeKE78GxTz0TZe23Q,328149
22
22
  bitmex/ccxt/base/precise.py,sha256=koce64Yrp6vFbGijJtUt-QQ6XhJgeGTCksZ871FPp_A,8886
23
23
  bitmex/ccxt/base/types.py,sha256=IbLO7Ni-plO36xlOdJQFqujSJBq0q9qll009ShZ0M_U,11468
24
- bitmex/ccxt/pro/__init__.py,sha256=9t4qr8MBr3vb_FX863YQ4KL9TOAen1Nvv8rtF26OOQs,4123
24
+ bitmex/ccxt/pro/__init__.py,sha256=Peju16luR2ssu_u9QeQQexy1Opsxdhz-I87CDeUPcWI,4213
25
25
  bitmex/ccxt/pro/bitmex.py,sha256=5gpicgex_am9Km9ZsZpMKBSKX-SFFAD3PPuv9r-nNdA,74693
26
26
  bitmex/ccxt/static_dependencies/README.md,sha256=3TCvhhn09_Cqf9BDDpao1V7EfKHDpQ6k9oWRsLFixpU,18
27
27
  bitmex/ccxt/static_dependencies/__init__.py,sha256=tzFje8cloqmiIE6kola3EaYC0SnD1izWnri69hzHsSw,168
@@ -282,6 +282,6 @@ bitmex/ccxt/static_dependencies/toolz/curried/exceptions.py,sha256=gKFOHDIayAWnX
282
282
  bitmex/ccxt/static_dependencies/toolz/curried/operator.py,sha256=ML92mknkAwzBl2NCm-4werSUmJEtSHNY9NSzhseNM9s,525
283
283
  bitmex/ccxt/static_dependencies/typing_inspect/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
284
284
  bitmex/ccxt/static_dependencies/typing_inspect/typing_inspect.py,sha256=5gIWomLPfuDpgd3gX1GlnX0MuXM3VorR4j2W2qXORiQ,28269
285
- bitmex_api-0.0.64.dist-info/METADATA,sha256=X5GphKhTn-Ml_1bvu4G9FC0ZFejr8FiNB2LBjGc-kM0,10822
286
- bitmex_api-0.0.64.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
287
- bitmex_api-0.0.64.dist-info/RECORD,,
285
+ bitmex_api-0.0.66.dist-info/METADATA,sha256=radyStCU9RP6A6QzlDX1Mm-VMRvyt-sD8t2v0_-5SiY,10822
286
+ bitmex_api-0.0.66.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
287
+ bitmex_api-0.0.66.dist-info/RECORD,,