Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Commit c4e945d

Browse files
authored
Merge pull request #77 from verata-veritatis/fix_spot_get_active_order
Fix spot get active order
2 parents 1628025 + 230038f commit c4e945d

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.3.4] - 2021-12-30
9+
### Added
10+
- `endpoint` arg to `get_active_order()`
11+
12+
### Fixed
13+
- A Websocket test case, by raising an exception instead of logging
14+
815
## [1.3.3] - 2021-12-24
916
- Improve `get_risk_limit()`
1017
- Fixed: call this endpoint without authentication

pybit/__init__.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
from json.decoder import JSONDecodeError
3636

3737
# Versioning.
38-
VERSION = '1.3.3'
38+
VERSION = '1.3.4'
3939

4040

4141
class HTTP:
@@ -514,24 +514,30 @@ def place_active_order_bulk(self, orders: list, max_in_parallel=10):
514514
executor.shutdown()
515515
return [execution.result() for execution in executions]
516516

517-
def get_active_order(self, **kwargs):
517+
def get_active_order(self, endpoint="", **kwargs):
518518
"""
519519
Gets an active order. For more information, see
520520
https://bybit-exchange.github.io/docs/inverse/#t-getactive.
521521
522522
:param kwargs: See
523523
https://bybit-exchange.github.io/docs/inverse/#t-getactive.
524+
:param endpoint: The endpoint path, such as "/spot/v1/order".
525+
This allows the user to choose between which endpoint to use to
526+
fetch a spot order.
524527
:returns: Request results as dictionary.
525528
"""
526529

527-
if self.spot is True or kwargs.get('spot', '') is True:
528-
suffix = '/spot/v1/history-orders'
529-
elif kwargs.get('symbol', '').endswith('USDT'):
530-
suffix = '/private/linear/order/list'
531-
elif kwargs.get('symbol', '')[-2:].isdigit():
532-
suffix = '/futures/private/order/list'
530+
if endpoint:
531+
suffix = endpoint
533532
else:
534-
suffix = '/v2/private/order/list'
533+
if self.spot is True or kwargs.get('spot', '') is True:
534+
suffix = '/spot/v1/history-orders'
535+
elif kwargs.get('symbol', '').endswith('USDT'):
536+
suffix = '/private/linear/order/list'
537+
elif kwargs.get('symbol', '')[-2:].isdigit():
538+
suffix = '/futures/private/order/list'
539+
else:
540+
suffix = '/v2/private/order/list'
535541

536542
return self._submit_request(
537543
method='GET',

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setup(
1010
name='pybit',
11-
version='1.3.3',
11+
version='1.3.4',
1212
description='Python3 Bybit HTTP/WebSocket API Connector',
1313
long_description=long_description,
1414
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)