Pybit

Latest version: v5.10.0

Safety actively analyzes 725393 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 7 of 14

2.0.1

Added
- `record_request_time` arg to `HTTP` classes which, if true, returns the response dictionary in a tuple with the request elapsed time - as recorded by `requests`

Changed
- `websocket_example.py` to demonstrate callbacks clearly
- the license to reflect the transition to bybit-exchange

Fixed
- `JSONDecodeError` when trying to subscribe to a spot private WebSocket stream

2.0.0

Added
- New modules for each API as part of a restructuring effort: `inverse_perpetual.py`, `usdt_perpetual.py`, `spot.py`, and more
- see the [README](https://github.com/bybit-exchange/pybit/blob/master/README.md) for how to import these new modules
- `HTTP` and `WebSocket` classes within each applicable module
- These classes use inheritance to reflect the structure of the Bybit APIs - due to the division of endpoints along the lines of different market types
- This means that different classes can share their common endpoints, such as `api_key_info()`, whilst keeping their distinctive endpoints like `get_active_order()` separate

Changed
- `WebSocket` functionality to use callbacks instead of polling
- This means that instead of polling `ws.fetch()` for your latest WebSocket messages, you can now simply define a function (`my_callback_function`), and pass this as an argument upon subscribing to your chosen topic
- see the [example file](https://github.com/bybit-exchange/pybit/blob/master/examples/websocket_example.py) for more information
- This also removes the need to remember topic names and JSON formats, as you now directly call a class method to subscribe
- There is also a `custom_topic_stream` method which can be used if a new WebSocket topic has been released by Bybit, but it's not been added to `pybit` yet
- `HTTP` classes will now instantiate a new HTTP session for each API (Spot (`spot.HTTP`), Account Asset (`account_asset.HTTP`), etc)
- this is due to the restructuring of `pybit` to use class inheritance
- Generally, the restructuring has allowed a great amount of segregation of the internal code to occur, which will allow for easier future development

Removed
- The `WebSocket` class from the `__init__.py` file, which was imported like so: `from pybit import WebSocket`
- This is because of the aforementioned functionality changes, which also have the potential to improve performance (as a core no longer needs to be occupied polling `ws.fetch()`)
- However, the `HTTP` class was not removed from `__init__.py` in an effort to provide a unified alternative
- Despite this, we would recommend preferring the market-specific modules

1.3.6

Changed
- Added `query_trading_fee_rate()`

1.3.5

Changed
- `position_mode_switch()` to support USDT perp: `/private/linear/position/switch-mode`

1.3.4

Added
- `endpoint` arg to `get_active_order()`

Fixed
- A WebSocket test case, by raising an exception instead of logging

1.3.3

- Improve `get_risk_limit()`
- Fixed: call this endpoint without authentication
- Supported `endpoint` argument for `my_position()`, allowing the user to call this method without supplying a symbol
- `symbol` is not a required parameter for these endpoints, but pybit typically relies on it for deciding which endpoint to call

Page 7 of 14

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.