-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from sndmndss/dev
1.1.0
- Loading branch information
Showing
18 changed files
with
224 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,41 @@ | ||
from bpx.base.base_public import BasePublic | ||
from bpx.http_client.async_http_client import AsyncHttpClient | ||
|
||
default_http_client = AsyncHttpClient() | ||
|
||
class Public(BasePublic, AsyncHttpClient): | ||
|
||
def __init__(self, proxy: str = None): | ||
AsyncHttpClient.__init__(self, proxy=proxy) | ||
class Public(BasePublic): | ||
|
||
def __init__(self, proxy: str = None, http_client: AsyncHttpClient = default_http_client): | ||
self.http_client = http_client | ||
self.http_client.proxy = proxy | ||
|
||
async def get_assets(self): | ||
return await self._get(self.get_assets_url()) | ||
return await self.http_client.get(self.get_assets_url()) | ||
|
||
async def get_markets(self): | ||
return await self._get(self.get_markets_url()) | ||
return await self.http_client.get(self.get_markets_url()) | ||
|
||
async def get_ticker(self, symbol: str): | ||
return await self._get(self.get_ticker_url(symbol)) | ||
return await self.http_client.get(self.get_ticker_url(symbol)) | ||
|
||
async def get_depth(self, symbol: str): | ||
return await self._get(self.get_depth_url(symbol)) | ||
return await self.http_client.get(self.get_depth_url(symbol)) | ||
|
||
async def get_klines(self, symbol: str, interval: str, start_time=0, end_time=0): | ||
return await self._get(self.get_klines_url(symbol, interval, start_time, end_time)) | ||
return await self.http_client.get(self.get_klines_url(symbol, interval, start_time, end_time)) | ||
|
||
async def get_status(self): | ||
return await self._get(self.get_status_url()) | ||
return await self.http_client.get(self.get_status_url()) | ||
|
||
async def get_ping(self): | ||
return await self._get(self.get_ping_url()) | ||
return await self.http_client.get(self.get_ping_url()) | ||
|
||
async def get_time(self): | ||
return await self._get(self.get_time_url()) | ||
return await self.http_client.get(self.get_time_url()) | ||
|
||
async def get_recent_trades(self, symbol: str, limit=100): | ||
return await self._get(self.get_recent_trades_url(symbol, limit)) | ||
return await self.http_client.get(self.get_recent_trades_url(symbol, limit)) | ||
|
||
async def get_history_trades(self, symbol: str, limit=100, offset=0): | ||
return await self._get(self.get_history_trades_url(symbol, limit, offset)) | ||
return await self.http_client.get(self.get_history_trades_url(symbol, limit, offset)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.