Skip to content

Commit 5d76597

Browse files
authored
Merge pull request #349 from binance/rc-v3.10.0
Release v3.10.0
2 parents a49db79 + 9d8af53 commit 5d76597

File tree

83 files changed

+2395
-558
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+2395
-558
lines changed

CHANGELOG.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,61 @@
11
# Changelog
22

3+
## 3.10.0 - 2024-11-29
4+
### Added
5+
- Margin
6+
- `POST /sapi/v1/margin/order/oto`
7+
- `POST /sapi/v1/margin/order/otoco`
8+
9+
- Portfolio
10+
- `GET /sapi/v2/portfolio/account`
11+
- `GET /sapi/v1/portfolio/balance`
12+
- `GET /sapi/v2/portfolio/collateralRate`
13+
14+
- Simple Earn
15+
- `POST /sapi/v1/simple-earn/locked/setRedeemOption`
16+
17+
- Staking
18+
- `GET /sapi/v2/eth-staking/account`
19+
- `GET /sapi/v1/eth-staking/eth/quota`
20+
- `POST /sapi/v2/eth-staking/eth/stake`
21+
- `POST /sapi/v1/eth-staking/eth/redeem`
22+
- `POST /sapi/v1/eth-staking/wbeth/wrap`
23+
- `GET /sapi/v1/eth-staking/eth/history/stakingHistory`
24+
- `GET /sapi/v1/eth-staking/eth/history/redemptionHistory`
25+
- `GET /sapi/v1/eth-staking/eth/history/rewardsHistory`
26+
- `GET /sapi/v1/eth-staking/eth/history/wbethRewardsHistory`
27+
- `GET /sapi/v1/eth-staking/eth/history/rateHistory`
28+
- `GET /sapi/v1/eth-staking/wbeth/history/wrapHistory`
29+
- `GET /sapi/v1/eth-staking/wbeth/history/unwrapHistory`
30+
31+
- Wallet
32+
- `POST /sapi/v1/localentity/withdraw/apply`
33+
- `GET /sapi/v1/localentity/withdraw/history`
34+
- `PUT /sapi/v1/localentity/deposit/provide-info`
35+
- `GET /sapi/v1/localentity/deposit/history`
36+
37+
- Websocket Stream
38+
- `<symbol>kline_<interval>+08:00`
39+
40+
### Updated
41+
- Add parameters showPermissionSets and symbolStatus to `GET /api/v3/exchangeInfo`
42+
- Add parameter timeZone to `GET /api/v3/klines`, `GET /api/v3/uiKlines`, `klines` and `uiKlines`
43+
- Add parameter redeemTo to `POST /sapi/v1/simple-earn/locked/subscribe`
44+
- Add parameters `txId` and `includeSource` to `GET /sapi/v1/capital/deposit/hisrec`
45+
- Add parameter `idList` to `GET /sapi/v1/capital/withdraw/history` and `GET /sapi/v1/capital/deposit/subHisrec`
46+
- Update Documentation
47+
- Update `JSONDecodeError` error response
48+
49+
### Removed
50+
- Crypto-loans
51+
- `GET /sapi/v1/loan/collateral/data`
52+
- `POST /sapi/v1/loan/borrow`
53+
- `POST /sapi/v1/loan/repay`
54+
- `POST /sapi/v1/loan/adjust/ltv`
55+
- `POST /sapi/v1/loan/customize/margin_call`
56+
- `GET /sapi/v1/loan/ongoing/orders`
57+
58+
359
## 3.9.0 - 2024-10-02
460

561
### Removed

binance/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "3.9.0"
1+
__version__ = "3.10.0"

binance/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def _handle_exception(self, response):
176176
err = json.loads(response.text)
177177
except JSONDecodeError:
178178
raise ClientError(
179-
status_code, None, response.text, None, response.headers
179+
status_code, None, response.text, response.headers, None
180180
)
181181
error_data = None
182182
if "data" in err:

binance/spot/__init__.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ def __init__(self, api_key=None, api_secret=None, **kwargs):
102102
from binance.spot._margin import adjust_cross_margin_max_leverage
103103
from binance.spot._margin import margin_available_inventory
104104
from binance.spot._margin import margin_manual_liquidation
105+
from binance.spot._margin import margin_new_oto_order
106+
from binance.spot._margin import margin_new_otoco_order
105107
from binance.spot._margin import liability_coin_leverage_bracket
106108

107109
# WALLET
@@ -126,6 +128,10 @@ def __init__(self, api_key=None, api_secret=None, **kwargs):
126128
from binance.spot._wallet import funding_wallet
127129
from binance.spot._wallet import user_asset
128130
from binance.spot._wallet import api_key_permissions
131+
from binance.spot._wallet import local_entity_withdraw
132+
from binance.spot._wallet import local_entity_withdraw_history
133+
from binance.spot._wallet import local_entity_submit_deposit_questionnaire
134+
from binance.spot._wallet import local_entity_deposit_history
129135
from binance.spot._wallet import bnb_convertible_assets
130136
from binance.spot._wallet import list_deposit_address
131137
from binance.spot._wallet import cloud_mining_trans_history
@@ -206,21 +212,15 @@ def __init__(self, api_key=None, api_secret=None, **kwargs):
206212

207213
# Crypto LOANS
208214
from binance.spot._crypto_loan import loan_history
209-
from binance.spot._crypto_loan import loan_borrow
210215
from binance.spot._crypto_loan import loan_borrow_history
211-
from binance.spot._crypto_loan import loan_ongoing_orders
212-
from binance.spot._crypto_loan import loan_repay
213216
from binance.spot._crypto_loan import loan_repay_history
214-
from binance.spot._crypto_loan import loan_adjust_ltv
215217
from binance.spot._crypto_loan import loan_adjust_ltv_history
216218
from binance.spot._crypto_loan import loan_vip_ongoing_orders
217219
from binance.spot._crypto_loan import loan_vip_repay
218220
from binance.spot._crypto_loan import loan_vip_repay_history
219221
from binance.spot._crypto_loan import loan_vip_collateral_account
220222
from binance.spot._crypto_loan import loan_loanable_data
221-
from binance.spot._crypto_loan import loan_collateral_data
222223
from binance.spot._crypto_loan import loan_collateral_rate
223-
from binance.spot._crypto_loan import loan_customize_margin_call
224224

225225
# PAY
226226
from binance.spot._pay import pay_history
@@ -256,11 +256,14 @@ def __init__(self, api_key=None, api_secret=None, **kwargs):
256256
# Portfolio Margin
257257
from binance.spot._portfolio_margin import portfolio_margin_account
258258
from binance.spot._portfolio_margin import portfolio_margin_collateral_rate
259+
from binance.spot._portfolio_margin import portfolio_margin_tiered_collateral_rate
259260
from binance.spot._portfolio_margin import portfolio_margin_bankruptcy_loan_amount
260261
from binance.spot._portfolio_margin import portfolio_margin_bankruptcy_loan_repay
261262
from binance.spot._portfolio_margin import (
262263
query_classic_portfolio_margin_negative_balance_interest_history,
263264
)
265+
from binance.spot._portfolio_margin import get_portfolio_margin_span_account_info
266+
from binance.spot._portfolio_margin import get_portfolio_margin_account_balance
264267
from binance.spot._portfolio_margin import query_portfolio_margin_asset_index_price
265268
from binance.spot._portfolio_margin import fund_auto_collection
266269
from binance.spot._portfolio_margin import bnb_transfer
@@ -291,6 +294,7 @@ def __init__(self, api_key=None, api_secret=None, **kwargs):
291294
from binance.spot._simple_earn import get_locked_personal_left_quota
292295
from binance.spot._simple_earn import get_flexible_subscription_preview
293296
from binance.spot._simple_earn import get_locked_subscription_preview
297+
from binance.spot._simple_earn import set_locked_product_redeem_option
294298
from binance.spot._simple_earn import get_rate_history
295299
from binance.spot._simple_earn import get_collateral_record
296300

@@ -310,3 +314,17 @@ def __init__(self, api_key=None, api_secret=None, **kwargs):
310314
from binance.spot._auto_invest import index_linked_plan_redemption
311315
from binance.spot._auto_invest import get_index_linked_plan_redemption_history
312316
from binance.spot._auto_invest import index_linked_plan_rebalance_details
317+
318+
# Staking
319+
from binance.spot._staking import eth_staking_account
320+
from binance.spot._staking import get_eth_staking_quota
321+
from binance.spot._staking import subscribe_eth_staking
322+
from binance.spot._staking import redeem_eth
323+
from binance.spot._staking import wrap_beth
324+
from binance.spot._staking import get_eth_staking_history
325+
from binance.spot._staking import get_eth_redemption_history
326+
from binance.spot._staking import get_beth_rewards_distribution_history
327+
from binance.spot._staking import get_wbeth_rewards_history
328+
from binance.spot._staking import get_wbeth_rate_history
329+
from binance.spot._staking import get_wbeth_wrap_history
330+
from binance.spot._staking import get_wbeth_unwrap_history

binance/spot/_crypto_loan.py

Lines changed: 0 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -26,40 +26,6 @@ def loan_history(self, asset: str, **kwargs):
2626
return self.sign_request("GET", "/sapi/v1/loan/income", payload)
2727

2828

29-
def loan_borrow(self, loanCoin: str, collateralCoin: str, loanTerm: int, **kwargs):
30-
"""Crypto Loan Borrow (TRADE)
31-
32-
POST /sapi/v1/loan/borrow
33-
34-
https://developers.binance.com/docs/crypto_loan/stable-rate/trade/Crypto-Loan-Borrow
35-
36-
Args:
37-
loanCoin (str)
38-
collateralCoin (str)
39-
loanTerm (int): 7/14/30/90/180 days
40-
Keyword Args:
41-
loanAmount (float, optional): Mandatory when collateralAmount is empty
42-
collateralAmount (float, optional): Mandatory when loanAmount is empty
43-
recvWindow (int, optional): The value cannot be greater than 60000
44-
"""
45-
46-
check_required_parameters(
47-
[
48-
[loanCoin, "loanCoin"],
49-
[collateralCoin, "collateralCoin"],
50-
[loanTerm, "loanTerm"],
51-
]
52-
)
53-
54-
payload = {
55-
"loanCoin": loanCoin,
56-
"collateralCoin": collateralCoin,
57-
"loanTerm": loanTerm,
58-
**kwargs,
59-
}
60-
return self.sign_request("POST", "/sapi/v1/loan/borrow", payload)
61-
62-
6329
def loan_borrow_history(self, **kwargs):
6430
"""Get Loan Borrow History (USER_DATA)
6531
@@ -81,47 +47,6 @@ def loan_borrow_history(self, **kwargs):
8147
return self.sign_request("GET", "/sapi/v1/loan/borrow/history", kwargs)
8248

8349

84-
def loan_ongoing_orders(self, **kwargs):
85-
"""Get Loan Ongoing Orders (USER_DATA)
86-
87-
GET /sapi/v1/loan/ongoing/orders
88-
89-
https://developers.binance.com/docs/crypto_loan/stable-rate/user-information/Get-Loan-Ongoing-Orders
90-
91-
Keyword Args:
92-
orderId (int, optional): orderId in POST /sapi/v1/loan/borrow
93-
loanCoin (str, optional)
94-
collateralCoin (str, optional)
95-
current (int, optional): Current querying page. Start from 1; default: 1; max: 1000
96-
limit (int, optional): Default: 10; max: 100
97-
recvWindow (int, optional): The value cannot be greater than 60000
98-
"""
99-
100-
return self.sign_request("GET", "/sapi/v1/loan/ongoing/orders", kwargs)
101-
102-
103-
def loan_repay(self, orderId: int, amount: float, **kwargs):
104-
"""Crypto Loan Repay (TRADE)
105-
106-
POST /sapi/v1/loan/repay
107-
108-
https://developers.binance.com/docs/crypto_loan/stable-rate/trade/Crypto-Loan-Repay
109-
110-
Args:
111-
orderId (int)
112-
amount (float)
113-
Keyword Args:
114-
type (int, optional): Default: 1. 1 for "repay with borrowed coin"; 2 for "repay with collateral"
115-
collateralReturn (boolean, optional): Default: TRUE. TRUE: Return extra collateral to spot account; FALSE: Keep extra collateral in the order.
116-
recvWindow (int, optional): The value cannot be greater than 60000
117-
"""
118-
119-
check_required_parameters([[orderId, "orderId"], [amount, "amount"]])
120-
121-
payload = {"orderId": orderId, "amount": amount, **kwargs}
122-
return self.sign_request("POST", "/sapi/v1/loan/repay", payload)
123-
124-
12550
def loan_repay_history(self, **kwargs):
12651
"""Get Loan Repayment History (USER_DATA)
12752
@@ -143,29 +68,6 @@ def loan_repay_history(self, **kwargs):
14368
return self.sign_request("GET", "/sapi/v1/loan/repay/history", kwargs)
14469

14570

146-
def loan_adjust_ltv(self, orderId: int, amount: float, direction: str, **kwargs):
147-
"""Crypto Loan Adjust LTV (TRADE)
148-
149-
POST /sapi/v1/loan/adjust/ltv
150-
151-
https://developers.binance.com/docs/crypto_loan/stable-rate/trade/Crypto-Loan-Adjust-LTV
152-
153-
Args:
154-
orderId (int)
155-
amount (float)
156-
direction (str): "ADDITIONAL", "REDUCED"
157-
Keyword Args:
158-
recvWindow (int, optional): The value cannot be greater than 60000
159-
"""
160-
161-
check_required_parameters(
162-
[[orderId, "orderId"], [amount, "amount"], [direction, "direction"]]
163-
)
164-
165-
payload = {"orderId": orderId, "amount": amount, "direction": direction, **kwargs}
166-
return self.sign_request("POST", "/sapi/v1/loan/adjust/ltv", payload)
167-
168-
16971
def loan_adjust_ltv_history(self, **kwargs):
17072
"""Get Loan LTV Adjustment History (USER_DATA)
17173
@@ -279,22 +181,6 @@ def loan_loanable_data(self, **kwargs):
279181
return self.sign_request("GET", "/sapi/v1/loan/loanable/data", kwargs)
280182

281183

282-
def loan_collateral_data(self, **kwargs):
283-
"""Get Collateral Assets Data (USER_DATA)
284-
285-
GET /sapi/v1/loan/collateral/data
286-
287-
https://developers.binance.com/docs/crypto_loan/stable-rate/market-data/Get-Collateral-Assets-Data
288-
289-
Keyword Args:
290-
collateralCoin (str, optional)
291-
vipLevel (int, optional)
292-
recvWindow (int, optional): The value cannot be greater than 60000
293-
"""
294-
295-
return self.sign_request("GET", "/sapi/v1/loan/collateral/data", kwargs)
296-
297-
298184
def loan_collateral_rate(
299185
self, loanCoin: str, collateralCoin: str, repayAmount: float, **kwargs
300186
):
@@ -327,24 +213,3 @@ def loan_collateral_rate(
327213
**kwargs,
328214
}
329215
return self.sign_request("GET", "/sapi/v1/loan/repay/collateral/rate", payload)
330-
331-
332-
def loan_customize_margin_call(self, marginCall: float, **kwargs):
333-
"""Customize Margin Call (USER_DATA)
334-
335-
POST /sapi/v1/loan/customize/margin_call
336-
337-
https://developers.binance.com/docs/crypto_loan/stable-rate/trade/Crypto-Loan-Customize-Margin-Call
338-
339-
Args:
340-
marginCall (float)
341-
Keyword Args:
342-
orderId (int, optional)
343-
collateralCoin (str, optional)
344-
recvWindow (int, optional): The value cannot be greater than 60000
345-
"""
346-
347-
check_required_parameter(marginCall, "marginCall")
348-
349-
payload = {"marginCall": marginCall, **kwargs}
350-
return self.sign_request("POST", "/sapi/v1/loan/customize/margin_call", payload)

0 commit comments

Comments
 (0)