All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Added
query_trading_fee_rate()
position_mode_switch()
to support USDT perp:/private/linear/position/switch-mode
endpoint
arg toget_active_order()
- A Websocket test case, by raising an exception instead of logging
- Improve
get_risk_limit()
- Fixed: call this endpoint without authentication
- Supported
endpoint
argument formy_position()
, allowing the user to call this method without supplying a symbolsymbol
is not a required parameter for these endpoints, but pybit typically relies on it for deciding which endpoint to call
- Enabled websocket
fetch()
to handle multiple position sides from linear perp symbols - Fixed
fetch()
for private spot websocket - Supported
endpoint
argument formy_position()
, allowing the user to call this method without supplying a symbolsymbol
is not a required parameter for these endpoints, but pybit typically relies on it for deciding which endpoint to call
- See below release candidates for details.
- Alter the spot endpoint paths used for
get_active_order()
andquery_active_order()
- Fixed failure to load subscriptions when provided in as JSON strings
- Fixed the spot auth websocket to ensure subscriptions are not required
- Fixed methods like
query_symbol()
(which have no API parameters) not working following the spot update
- Implemented the Spot API in
HTTP
- Implemented the Account Asset API in
HTTP
- Implemented the Spot websocket in
WebSocket
- Removed
position_mode_switch()
as the endpoint has not been released to mainnet yet
- Added new
HTTP
methods for new endpoints - Added new paths for existing methods
- Fixed some old paths
is_linear
argument inget_risk_limit()
- Added some logic to decide if there is 'order_book' in order book snapshot push for websocket
- Added
ignore_codes
argument toHTTP
for status codes to not raise any errors on.
- Removed extra suffix definition block in
place_conditional_order
. - Changed logger functionality so that it won't overwrite user's preferred logging settings.
- Fixed wrong number of arguments error inside websocket
on_message
,on_close
,on_open
,on_error
.
- Fixed typo errors on endpoint urls.
- Added support for futures endpoints on
HTTP
(usingisdigit
to detect futures symbols).
- Using
get
method fordict
for symbol check instead of calling by key. endpoint
onHTTP
will now default to https://api.bybit.com if no argument.retry_codes
is now user-definable in theHTTP
arguments.- All logging is now on
DEBUG
level—user will need to manually setlogging_level
toDEBUG
. - Added attempted request to
FailedRequestError
andInvalidRequestError
for improved error logging.
- Fixed unexpected
tuple
generation for status codes onInvalidRequestError
andFailedRequestError
. - Fixed how
Websocket
handles incomingorderBook
data due to Bybit's topic naming changes.
requests
will useJSONDecodeError
fromsimplejson
if it is available—pybit
will now do the same to prevent errors.- Fixed a bug where
HTTP
retry would crash on rate limit reached due to undefined variable. - Improved
InvalidRequestError
andFailedRequestError
to include error codes and times.
WebSocket
will now temporarily differentiate between inverse and linear endpoints for the 'order' topic since incoming data has differing keys.
WebSocket
now haspurge_on_fetch
(defaults toTrue
), which allows the user to keep data between fetches.
- Fixed a bug on 'stop_order' for
WebSocket
that would prevent data from being appended due to deprecation ofstop_order_id
.
- See release candidates for details.
- Rewrote if-condition on
_on_message
inWebSocket
class to check for linear or non-linear position data.
- Added ability to handle
from
usingfrom_time
andfrom_id
arguments sincefrom
is a reserved keyword. - Removed
ignore_retries_for
fromHTTP
.pybit
now uses a standard list of non-critical errors that can be retried. - Added argument
retry_delay
forHTTP
—allows user to add a custom retry delay for each retry.
- See release candidates for details.
- Fixed raise error missing argument for
FailedRequestError
upon max retries. - Modified API endpoints to saistfy requirements for upcoming endpoint deprecation, see the API Documentation for more info.
- Updated
WebSocket
class to properly handlecandle
from USDT perpetual streams. - Updated
WebSocket
class to return a copy of the collected data, preventing establishing a reference. - Updated
WebSocket
class to properly handle linear (USDT) orderbook data. - Performance improvements.
- Changed
ignore_retries_for
default argument to be empty tuple to prevent error.
- Added
ignore_retries_for
argument toHTTP
auth
method, allowing the user to choose which error codes should NOT be retried.
FailedRequestError
andInvalidRequestError
now havemessage
andstatus_code
attributes.
- Will now catch and handle
requests.exceptions.ConnectionError
.
- Added
recv_window
error handler toHTTP
auth
method. - Will now catch and handle
requests.exceptions.SSLError
.
- Added
recv_window
argument toHTTP
class.
- Improved error handling.
- Added
max_retries
argument toHTTP
class.
- Added
FailedRequestError
to differentiate between failed requests and invalid requests. - Fixed
exit
method onWebSocket
to now properly handle the closing of the socket.
- Increased expires time for WebSocket authentication to a full second.
- Add option to handle timeout on request submission.
- Fixed trailing decimal zero to prevent auth signature errors.
- New
HTTP
methods. - New argument for
HTTP
class to log each outgoing request. - New argument for
WebSocket
class to attempt restart after an error is detected.
- Mass simplification of all methods—each method now takes a series keyword arguments rather than a set number of required pre-defined arguments. This makes the library future-proof and prevents breaking on significant updates to the REST API endpoints. This, however, requires the user to study the API documentation and know which arguments are required for each endpoint.
- One new exception has been added—
InvalidRequestError
. This exception will be raised if Bybit returns with an error, or ifrequests
is unable to complete the request. - Inverse and Linear endpoints are now handled accordingly by differentiating from the symbol argument.
- Updated existing
HTTP
method names to follow the same naming procedure as listed in the Bybit API documentation. - Reformatting of code to follow PEP-8 standards.
- New docstring format.
- Various logging features added to both HTTP and WebSocket classes.
- Extensive WebSocket class updates.
- Modified the WebSocketApp to send a heartbeat packet every 30 seconds, with a timeout of 10 seconds. These settings can be modified using the 'ping_interval' and 'ping_timeout' arguments of the WebSocket constructor.
- User no longer needs to manage the incoming stream;
pybit
does all the work (insert, update, delete). - Modified
ws.ping()
for ease of use; simply use the function to send heartbeat packets. When something happens to the connection, Python will raise anException
which the end-user can catch and handle.
- Redundancy updates to the HTTP class.
- Modified the HTTP class to use an endpoint argument, allowing users to take advantage of the USDT endpoints.
- The setup.py file has been fixed to correctly install the pybit package.
- The
pybit
module. - MANIFEST, README, LICENSE, and CHANGELOG files.