Skip to content

Commit

Permalink
added and fixed endpoints (#53)
Browse files Browse the repository at this point in the history
* added and fixed endpoints

* added release date
  • Loading branch information
chairz-2 authored Aug 29, 2022
1 parent 8c29981 commit d30576a
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 5 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
# Changelog

### 3.1.2 - 2022-08-23
## 3.2.0 - 2022-08-29

### Add
#### UM Futures
- New endpoint `GET /fapi/v1/pmExchangeInfo` to get current Portfolio Margin exchange trading rules.
#### CM Futures
- New endpoint `GET /dapi/v1/pmExchangeInfo` to get current Portfolio Margin exchange trading rules.

### Update
#### UM Futures
- `symbol` is no longer a required parameter in `GET /fapi/v1/premiumIndex`

## 3.1.2 - 2022-08-23

### Update
- Fix encoding issue of parameters in `DELETE /fapi/v1/batchOrders`
Expand Down
2 changes: 1 addition & 1 deletion binance/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.1.2"
__version__ = "3.2.0"
3 changes: 3 additions & 0 deletions binance/cm_futures/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,6 @@ def __init__(self, key=None, secret=None, **kwargs):
from binance.cm_futures.data_stream import new_listen_key
from binance.cm_futures.data_stream import renew_listen_key
from binance.cm_futures.data_stream import close_listen_key

# PORTFOLIO MARGIN
from binance.cm_futures.portfolio_margin import pm_exchange_info
15 changes: 15 additions & 0 deletions binance/cm_futures/portfolio_margin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
def pm_exchange_info(self, symbol: str = None):
"""
|
| **Portfolio Margin Exchange Information**
| *Current Portfolio Margin exchange trading rules.*
:API endpoint: ``GET /dapi/v1/pmExchangeInfo``
:API doc: https://binance-docs.github.io/apidocs/delivery/en/#portfolio-margin-exchange-information
:parameter symbol: string; the trading pair.
|
"""

params = {"symbol": symbol}
return self.query("/dapi/v1/pmExchangeInfo", params)
3 changes: 3 additions & 0 deletions binance/um_futures/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,6 @@ def __init__(self, key=None, secret=None, **kwargs):
from binance.um_futures.data_stream import new_listen_key
from binance.um_futures.data_stream import renew_listen_key
from binance.um_futures.data_stream import close_listen_key

# PORTFOLIO MARGIN
from binance.um_futures.portfolio_margin import pm_exchange_info
3 changes: 1 addition & 2 deletions binance/um_futures/market.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def mark_price_klines(self, symbol: str, interval: str, **kwargs):
return self.query("/fapi/v1/markPriceKlines", params)


def mark_price(self, symbol: str):
def mark_price(self, symbol: str = None):
"""
|
| **Mark Price and Funding Rate**
Expand All @@ -233,7 +233,6 @@ def mark_price(self, symbol: str):
|
"""

check_required_parameter(symbol, "symbol")
params = {
"symbol": symbol,
}
Expand Down
15 changes: 15 additions & 0 deletions binance/um_futures/portfolio_margin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
def pm_exchange_info(self, symbol: str = None):
"""
|
| **Portfolio Margin Exchange Information**
| *Current Portfolio Margin exchange trading rules.*
:API endpoint: ``GET /fapi/v1/pmExchangeInfo``
:API doc: https://binance-docs.github.io/apidocs/futures/en/#portfolio-margin-endpoints
:parameter symbol: string; the trading pair.
|
"""

params = {"symbol": symbol}
return self.query("/fapi/v1/pmExchangeInfo", params)
10 changes: 10 additions & 0 deletions examples/cm_futures/portfolio_margin/pm_exchange_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python
import logging
from binance.cm_futures import CMFutures
from binance.lib.utils import config_logging

config_logging(logging, logging.DEBUG)

cm_futures_client = CMFutures()

logging.info(cm_futures_client.pm_exchange_info())
2 changes: 1 addition & 1 deletion examples/um_futures/market/mark_price.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

um_futures_client = UMFutures()

logging.info(um_futures_client.mark_price("BTCUSDT"))
logging.info(um_futures_client.mark_price())
10 changes: 10 additions & 0 deletions examples/um_futures/portfolio_margin/pm_exchange_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python
import logging
from binance.um_futures import UMFutures
from binance.lib.utils import config_logging

config_logging(logging, logging.DEBUG)

um_futures_client = UMFutures()

logging.info(um_futures_client.pm_exchange_info())

0 comments on commit d30576a

Please sign in to comment.