From 9ddf2a3b65dc9adf1bb394472eaa7726119268ae Mon Sep 17 00:00:00 2001 From: dextertd Date: Mon, 28 Feb 2022 18:06:20 +0000 Subject: [PATCH] add query trading fee rate endpoint --- CHANGELOG.md | 3 +++ README.md | 1 + docs/HTTP.md | 15 +++++++++++++++ examples/http_example.py | 2 ++ pybit/__init__.py | 17 ++++++++++++++++- setup.py | 2 +- 6 files changed, 38 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47516c5..3b89acd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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). +## [1.3.6] - 2022-02-28 +### Changed +- Added `query_trading_fee_rate()` ## [1.3.5] - 2022-01-12 ### Changed diff --git a/README.md b/README.md index 9f3d90b..0a8ea15 100644 --- a/README.md +++ b/README.md @@ -166,6 +166,7 @@ Usage examples on the `WebSocket` methods can be found at: | User Leverage (deprecated) | `user_leverage()` | | User Trade Records | `user_trade_records()` | | Closed Profit and Loss | `closed_profit_and_loss()` | +| Query Trading Fee Rate | `query_trading_fee_rate()` | #### Risk Limit diff --git a/docs/HTTP.md b/docs/HTTP.md index dc190a9..a42414b 100644 --- a/docs/HTTP.md +++ b/docs/HTTP.md @@ -407,6 +407,21 @@ def closed_profit_and_loss(self, **kwargs): :returns: Request results as dictionary. """ +def query_trading_fee_rate(self, **kwargs): + """ + Query trading fee rate. + + :param kwargs: See + https://bybit-exchange.github.io/docs/inverse/#t-queryfeerate. + :returns: Request results as dictionary. + """ + return self._submit_request( + method='GET', + path=self.endpoint + '/v2/private/position/fee-rate', + query=kwargs, + auth=True + ) + def get_risk_limit(self, **kwargs): """ Get risk limit. diff --git a/examples/http_example.py b/examples/http_example.py index fd3d9f3..6902489 100644 --- a/examples/http_example.py +++ b/examples/http_example.py @@ -53,6 +53,8 @@ change_margin() set_trading_stop() +query_trading_fee_rate() + get_risk_limit() set_risk_limit() diff --git a/pybit/__init__.py b/pybit/__init__.py index b0f7f8d..2210115 100644 --- a/pybit/__init__.py +++ b/pybit/__init__.py @@ -35,7 +35,7 @@ from json.decoder import JSONDecodeError # Versioning. -VERSION = '1.3.5' +VERSION = '1.3.6' class HTTP: @@ -1254,6 +1254,21 @@ def closed_profit_and_loss(self, **kwargs): auth=True ) + def query_trading_fee_rate(self, **kwargs): + """ + Query trading fee rate. + + :param kwargs: See + https://bybit-exchange.github.io/docs/inverse/#t-queryfeerate. + :returns: Request results as dictionary. + """ + return self._submit_request( + method='GET', + path=self.endpoint + '/v2/private/position/fee-rate', + query=kwargs, + auth=True + ) + def get_risk_limit(self, endpoint="", **kwargs): """ Get risk limit. diff --git a/setup.py b/setup.py index e8d6582..dcd2364 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setup( name='pybit', - version='1.3.5', + version='1.3.6', description='Python3 Bybit HTTP/WebSocket API Connector', long_description=long_description, long_description_content_type='text/markdown',