Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Async HTTP #240

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [5.8.1] - 2024-08-19
### Added
- Async HTTP module: `bybit.asyncio`

## [5.8.0] - 2024-06-26
### Added
Expand Down
2 changes: 1 addition & 1 deletion pybit/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "5.8.0"
VERSION = "5.8.1"
2 changes: 1 addition & 1 deletion pybit/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ def is_usdc_perpetual(symbol: str):

def is_usdc_option(symbol: str):
if re.search(r"[A-Z]{3}-.*-[PC]$", symbol):
return True
return True
2 changes: 1 addition & 1 deletion pybit/_http_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def _submit_request(self, method=None, path=None, query=None, auth=False):
limit_reset_time = int(s.headers["X-Bapi-Limit-Reset-Timestamp"])
limit_reset_str = dt.fromtimestamp(limit_reset_time / 10**3).strftime(
"%H:%M:%S.%f")[:-3]
delay_time = (int(limit_reset_time) - _helpers.generate_timestamp()) / 10**3
delay_time = (int(limit_reset_time) - _helpers.generate_timestamp()) / 10 ** 3
error_msg = (
f"API rate limit will reset at {limit_reset_str}. "
f"Sleeping for {int(delay_time * 10**3)} milliseconds"
Expand Down
3 changes: 1 addition & 2 deletions pybit/_websocket_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import logging
import copy
from uuid import uuid4
from . import _helpers

from .asyncio import _helpers

logger = logging.getLogger(__name__)

Expand Down
3 changes: 1 addition & 2 deletions pybit/_websocket_trading.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import uuid
import logging
from ._websocket_stream import _WebSocketManager
from . import _helpers

from .asyncio import _helpers

logger = logging.getLogger(__name__)

Expand Down
Empty file added pybit/asyncio/__init__.py
Empty file.
Loading