Skip to content

Commit

Permalink
v4.1.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
alplabin committed Oct 31, 2024
1 parent 4b09737 commit 90fed07
Show file tree
Hide file tree
Showing 32 changed files with 867 additions and 53 deletions.
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,51 @@
# Changelog

## 4.1.0 - 2024-10-31

### Added
- UM_Futures:
- `GET /fapi/v1/fundingInfo`
- `GET /futures/data/delivery-price`
- `GET /fapi/v1/constituents`
- `GET /fapi/v1/accountConfig`
- `GET /fapi/v1/symbolConfig`
- `GET /fapi/v1/rateLimit/order`
- `GET /fapi/v1/order/asyn`
- `GET /fapi/v1/order/asyn/id`
- `GET /fapi/v1/trade/asyn`
- `GET /fapi/v1/trade/asyn/id`
- `POST /fapi/v1/feeBurn`
- `GET /fapi/v1/feeBurn`
- `GET /fapi/v1/convert/exchangeInfo`
- `POST /fapi/v1/convert/getQuote`
- `POST /fapi/v1/convert/acceptQuote`
- `GET /fapi/v1/convert/orderStatus`
- Websocket Stream `mark_price_all_market`

- CM_Futures:
- `GET /dapi/v1/income/asyn`
- `GET /dapi/v1/constituents`

### Changed
- UM_Futures:
- `GET /fapi/v1/income`: Add parameter `page` for pagination
- `POST /fapi/v1/order`: Add parameters `selfTradePreventionMode`, `priceMatch` and `goodTillDate`
- `POST /fapi/v1/batchOrders`: Add parameters `priceMatch`, `selfTradePreventionMode` and `goodTillDate`
- `GET /fapi/v1/ticker/price`: deprecated, replaced by `GET /fapi/v2/ticker/price`
- `GET /fapi/v2/balance`: deprecated, replaced by `GET /fapi/v3/balance`
- `GET /fapi/v2/account`: deprecated, replaced by `GET /fapi/v3/account`
- `GET /fapi/v2/positionRisk`: deprecated, replaced by `GET /fapi/v3/positionRisk`

- CM_Futures:
- `GET /dapi/v1/income`: Add parameter `page` for pagination
- `POST /dapi/v1/order`: Add parameters `priceMatch` and `selfTradePreventionMode`

- Update Websocket connection exceptions: Add `_handle_exception` method to handle exceptions

### Removed
- CM_Futures:
- `/dapi/v1/pmExchangeInfo`

## 4.0.1 - 2024-10-03

### Removed
Expand Down
2 changes: 1 addition & 1 deletion binance/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "4.0.1"
__version__ = "4.1.0"
5 changes: 2 additions & 3 deletions binance/cm_futures/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(self, key=None, secret=None, **kwargs):
from binance.cm_futures.market import ticker_24hr_price_change
from binance.cm_futures.market import ticker_price
from binance.cm_futures.market import book_ticker
from binance.cm_futures.market import query_index_price_constituents
from binance.cm_futures.market import open_interest
from binance.cm_futures.market import open_interest_hist
from binance.cm_futures.market import top_long_short_account_ratio
Expand Down Expand Up @@ -57,6 +58,7 @@ def __init__(self, key=None, secret=None, **kwargs):
from binance.cm_futures.account import get_position_risk
from binance.cm_futures.account import get_account_trades
from binance.cm_futures.account import get_income_history
from binance.cm_futures.account import get_download_id_transaction_history
from binance.cm_futures.account import leverage_brackets
from binance.cm_futures.account import adl_quantile
from binance.cm_futures.account import force_orders
Expand All @@ -66,6 +68,3 @@ 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
32 changes: 30 additions & 2 deletions binance/cm_futures/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def new_order(self, symbol: str, side: str, type: str, **kwargs):
:parameter callbackRate: optional float. Use with TRAILING_STOP_MARKET orders, min 0.1, max 5 where 1 for 1%.
:parameter workingType: optional string. stopPrice triggered by: "MARK_PRICE", "CONTRACT_PRICE". Default "CONTRACT_PRICE".
:parameter priceProtect: optional string. "TRUE" or "FALSE", default "FALSE". Use with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders.
:parameter newOrderRespType: optional float. "ACK" or "RESULT", default "ACK".
:parameter newOrderRespType: optional string. "ACK" or "RESULT", default "ACK".
:parameter priceMatch: optional string. only avaliable for "LIMIT"/"STOP"/"TAKE_PROFIT" order; can be set to "OPPONENT"/"OPPONENT_5"/"OPPONENT_10"/"OPPONENT_20": /"QUEUE"/"QUEUE_5"/"QUEUE_10"/"QUEUE_20"; Can't be passed together with price.
:parameter selfTradePreventionMode: optional string. "NONE":No STP /"EXPIRE_TAKER":expire taker order when STP triggers/"EXPIRE_MAKER":expire taker order when STP triggers/"EXPIRE_BOTH":expire both orders when STP triggers; default "NONE".
:parameter recvWindow: optional int
|
"""
Expand All @@ -88,7 +90,7 @@ def modify_order(
| **Modify Order (TRADE)**
| *Order modify function, currently only LIMIT order modification is supported, modified orders will be reordered in the match queue.*
:API endpoint: ``POST /dapi/v1/order``
:API endpoint: ``PUT /dapi/v1/order``
:API doc: https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/Modify-Order
:parameter symbol: string
Expand Down Expand Up @@ -673,6 +675,7 @@ def get_income_history(self, **kwargs):
:parameter incomeType: optional string; "TRANSFER", "WELCOME_BONUS", "REALIZED_PNL", "FUNDING_FEE", "COMMISSION" and "INSURANCE_CLEAR"
:parameter startTime: optional string; timestamp in ms to get funding from INCLUSIVE.
:parameter endTime: optional string; timestamp in ms to get funding from INCLUSIVE.
:parameter page: optional int
:parameter limit: optional int; default 50, max 100
:parameter recvWindow: optional int
Expand All @@ -688,6 +691,31 @@ def get_income_history(self, **kwargs):
return self.sign_request("GET", url_path, params)


def get_download_id_transaction_history(self, startTime: int, endTime: int, **kwargs):
"""
|
| **Get Download Id For Futures Transaction History (USER_DATA)**
| *Get download ID transaction history.*
| *Request Limitation is 5 times per month, shared by front end download page and rest api*
| *The time between startTime and endTime can not be longer than 1 year*
:API endpoint: ``GET /dapi/v1/income/asyn``
:API doc: https://developers.binance.com/docs/derivatives/coin-margined-futures/account/Get-Download-Id-For-Futures-Transaction-History
:parameter startTime: int
:parameter endTime: int
:parameter recvWindow: optional int
|
"""

check_required_parameter(startTime, "startTime")
check_required_parameter(endTime, "endTime")
url_path = "/dapi/v1/income/asyn"
params = {"startTime": startTime, "endTime": endTime, **kwargs}

return self.sign_request("GET", url_path, params)


def leverage_brackets(self, symbol: str = None, pair: str = None, **kwargs):
"""
|
Expand Down
17 changes: 17 additions & 0 deletions binance/cm_futures/market.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,23 @@ def book_ticker(self, symbol: str = None, pair: str = None):
return self.query("/dapi/v1/ticker/bookTicker", params)


def query_index_price_constituents(self, symbol: str):
"""
|
| **Query Index Price Constituents**
:API endpoint: ``GET /dapi/v1/constituents``
:API doc: https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/Index-Constituents
:parameter symbol: string; symbol underlying e.g BTCUSD
|
"""

check_required_parameter(symbol, "symbol")
params = {"symbol": symbol}
return self.query("/dapi/v1/constituents", params)


def open_interest(self, symbol: str):
"""
|
Expand Down
15 changes: 0 additions & 15 deletions binance/cm_futures/portfolio_margin.py

This file was deleted.

18 changes: 18 additions & 0 deletions binance/um_futures/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ def __init__(self, key=None, secret=None, **kwargs):
from binance.um_futures.market import mark_price_klines
from binance.um_futures.market import mark_price
from binance.um_futures.market import funding_rate
from binance.um_futures.market import funding_info
from binance.um_futures.market import ticker_24hr_price_change
from binance.um_futures.market import ticker_price
from binance.um_futures.market import book_ticker
from binance.um_futures.market import quarterly_contract_settlement_price
from binance.um_futures.market import open_interest
from binance.um_futures.market import open_interest_hist
from binance.um_futures.market import top_long_short_position_ratio
Expand All @@ -33,6 +35,7 @@ def __init__(self, key=None, secret=None, **kwargs):
from binance.um_futures.market import blvt_kline
from binance.um_futures.market import index_info
from binance.um_futures.market import asset_Index
from binance.um_futures.market import index_price_constituents

# ACCOUNT(including orders and trades)
from binance.um_futures.account import change_position_mode
Expand Down Expand Up @@ -65,8 +68,23 @@ def __init__(self, key=None, secret=None, **kwargs):
from binance.um_futures.account import force_orders
from binance.um_futures.account import api_trading_status
from binance.um_futures.account import commission_rate
from binance.um_futures.account import futures_account_configuration
from binance.um_futures.account import symbol_configuration
from binance.um_futures.account import query_user_rate_limit
from binance.um_futures.account import download_transactions_asyn
from binance.um_futures.account import aysnc_download_info
from binance.um_futures.account import download_order_asyn
from binance.um_futures.account import async_download_order_id
from binance.um_futures.account import download_trade_asyn
from binance.um_futures.account import async_download_trade_id
from binance.um_futures.account import toggle_bnb_burn
from binance.um_futures.account import get_bnb_burn

# CONVERT
from binance.um_futures.convert import list_all_convert_pairs
from binance.um_futures.convert import send_quote_request
from binance.um_futures.convert import accept_offered_quote
from binance.um_futures.convert import order_status

# STREAMS
from binance.um_futures.data_stream import new_listen_key
Expand Down
Loading

0 comments on commit 90fed07

Please sign in to comment.