Skip to content

Commit a512fb9

Browse files
committed
v1.1.51
1 parent 8bce432 commit a512fb9

5 files changed

Lines changed: 312 additions & 39 deletions

File tree

CHANGELOG.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,66 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased] - 2026-03-15
9+
10+
### Added
11+
12+
#### Market Service
13+
- **Spot Symbols Endpoint Update**: Updated `get_spot_symbols()` to use `/openApi/spot/v1/common/symbols` endpoint
14+
- Added support for `maxMarketNotional` field (maximum notional amount for single market order)
15+
- Added new symbol status value `29 = Pre-Delisted`
16+
- Full status values: 0=Offline, 1=Online, 5=Pre-open, 10=Accessed, 25=Suspended, 29=Pre-Delisted, 30=Delisted
17+
18+
- **Spot Klines v2 Endpoint**: Updated `get_spot_klines()` to use `/openApi/spot/v2/market/kline`
19+
- Added optional `time_zone` parameter (0=UTC (default), 8=UTC+8)
20+
- Updated max limit from 1000 to 1440 records
21+
22+
#### Spot Account Service
23+
- **Internal Transfer Update**: Updated `internal_transfer()` method with new parameters
24+
- Changed `wallet_type` to integer: 1=Fund Account, 2=Standard Futures, 3=Perpetual Futures, **4=Spot Account** (NEW)
25+
- Added `user_account_type` parameter (1=UID, 2=Phone number, 3=Email)
26+
- Added `user_account` parameter
27+
- Added optional `calling_code` parameter (required when user_account_type=2)
28+
- Added optional `transfer_client_id` parameter (custom ID, max 100 chars)
29+
- Added optional `recv_window` parameter
30+
31+
#### Sub-Account Service
32+
- **Sub-Account Internal Transfer Update**: Updated `sub_account_internal_transfer()` with new parameters
33+
- Changed `wallet_type` to integer: 1=Fund Account, 2=Standard Futures, 3=Perpetual Futures, **15=Spot Account** (NEW)
34+
- Added `user_account_type` parameter (1=UID, 2=Phone number, 3=Email)
35+
- Added `user_account` parameter
36+
- Added optional `calling_code` parameter
37+
- Added optional `transfer_client_id` parameter
38+
- Added optional `recv_window` parameter
39+
40+
- **New Method**: `sub_mother_account_asset_transfer()` - Sub-Mother Account Asset Transfer Interface
41+
- Flexible asset transfer between parent and sub-accounts
42+
- Supports account types: 1=Funding, 2=Standard futures, 3=Perpetual U-based, 15=Spot
43+
- Only available to master account
44+
- Returns `tranId` (transfer record ID)
45+
46+
- **New Method**: `get_sub_mother_account_transferable_amount()` - Query Sub-Mother Account Transferable Amount
47+
- Query supported coins and available transferable amounts
48+
- Only available to master account
49+
- Returns coins array with id, name, and availableAmount
50+
51+
- **New Method**: `get_sub_mother_account_transfer_history()` - Query Sub-Mother Account Transfer History
52+
- Query transfer history between sub-accounts and parent account
53+
- Supports filtering by type, tran_id, time range
54+
- Pagination support (page_id, paging_size)
55+
- Only available to master account
56+
57+
### Changed
58+
- Updated BingX API integration to support changes from December 2025 through February 2026
59+
- Improved parameter validation and type safety across all updated methods
60+
61+
### API Compatibility
62+
- Breaking changes in method signatures for `internal_transfer()` and `sub_account_internal_transfer()`
63+
- All new parameters are optional with sensible defaults where applicable
64+
- Maintains Python naming conventions (snake_case)
65+
66+
---
67+
868
## [1.0.0] - 2024-03-09
969

1070
### Added

README.md

Lines changed: 65 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,12 @@ import time
175175
start_ts = int(time.mktime(time.strptime("2024-01-01", "%Y-%m-%d")) * 1000)
176176
end_ts = int(time.mktime(time.strptime("2024-01-02", "%Y-%m-%d")) * 1000)
177177
klines = client.market().get_klines("BTC-USDT", "1h", 100, start_ts, end_ts)
178+
179+
# Spot klines with timezone (v2 endpoint)
180+
# time_zone: 0=UTC (default), 8=UTC+8
181+
spot_klines = client.market().get_spot_klines(
182+
"BTC-USDT", "1h", 100, start_ts, end_ts, time_zone=8
183+
)
178184
```
179185

180186
#### Funding Rate, Mark Price
@@ -360,9 +366,18 @@ transfer = client.spot_account().universal_transfer(
360366

361367
history = client.spot_account().get_asset_transfer_records(type_="FUND_PFUTURES")
362368

369+
# Internal transfer (main account internal transfer)
370+
# wallet_type: 1=Fund Account, 2=Standard Futures, 3=Perpetual Futures, 4=Spot Account
371+
# user_account_type: 1=UID, 2=Phone number, 3=Email
363372
internal = client.spot_account().internal_transfer(
364-
coin="USDT", wallet_type="SPOT", amount=50.0,
365-
transfer_type="FROM_MAIN_TO_SUB", sub_uid="123456"
373+
coin="USDT",
374+
wallet_type=4, # Spot Account
375+
amount=50.0,
376+
user_account_type=1, # UID
377+
user_account="123456",
378+
calling_code=None, # Required when user_account_type=2
379+
transfer_client_id="transfer-001", # Optional custom ID
380+
recv_window=None
366381
)
367382

368383
all_balances = client.spot_account().get_all_account_balances()
@@ -398,9 +413,55 @@ client.sub_account().delete_sub_account_api_key("sub_account_001", "your_api_key
398413
#### Transfers
399414

400415
```python
416+
# Sub-account internal transfer
417+
# wallet_type: 1=Fund Account, 2=Standard Futures, 3=Perpetual Futures, 15=Spot Account
418+
# user_account_type: 1=UID, 2=Phone number, 3=Email
401419
transfer = client.sub_account().sub_account_internal_transfer(
402-
coin="USDT", wallet_type="SPOT", amount=100.0,
403-
transfer_type="FROM_MAIN_TO_SUB", to_sub_uid="12345678"
420+
coin="USDT",
421+
wallet_type=15, # Spot Account
422+
amount=100.0,
423+
user_account_type=1, # UID
424+
user_account="12345678",
425+
calling_code=None, # Required when user_account_type=2
426+
transfer_client_id="transfer-001", # Optional custom ID
427+
recv_window=None
428+
)
429+
430+
# Sub-Mother Account Asset Transfer (master account only)
431+
# Flexible transfer between parent and sub-accounts
432+
transfer = client.sub_account().sub_mother_account_asset_transfer(
433+
asset_name="USDT",
434+
transfer_amount=100.0,
435+
from_uid=123456,
436+
from_type=1, # 1=Parent account, 2=Sub-account
437+
from_account_type=1, # 1=Funding, 2=Standard futures, 3=Perpetual, 15=Spot
438+
to_uid=789012,
439+
to_type=2, # 1=Parent account, 2=Sub-account
440+
to_account_type=15, # Spot account
441+
remark="Transfer to sub-account",
442+
recv_window=None
443+
)
444+
445+
# Query transferable amount (master account only)
446+
transferable = client.sub_account().get_sub_mother_account_transferable_amount(
447+
from_uid=123456,
448+
from_account_type=1, # Funding
449+
to_uid=789012,
450+
to_account_type=15, # Spot
451+
recv_window=None
452+
)
453+
454+
# Query transfer history (master account only)
455+
import time
456+
history = client.sub_account().get_sub_mother_account_transfer_history(
457+
uid=123456,
458+
type_=None, # Optional filter
459+
tran_id=None, # Optional filter
460+
start_time=int(time.time() - 7*24*3600) * 1000,
461+
end_time=int(time.time()) * 1000,
462+
page_id=1,
463+
paging_size=50,
464+
recv_window=None
404465
)
405466

406467
records = client.sub_account().get_sub_account_internal_transfer_records()

bingx/services/market.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,15 @@ def get_futures_symbols(self) -> Dict[str, Any]:
2626
return self.client.request("GET", "/openApi/swap/v2/market/symbols")
2727

2828
def get_spot_symbols(self) -> Dict[str, Any]:
29-
"""Get spot trading symbols"""
30-
return self.client.request("GET", "/openApi/spot/v1/market/symbols")
29+
"""
30+
Get spot trading symbols
31+
32+
Response includes:
33+
- maxMarketNotional: Maximum notional amount for a single market order
34+
- status: Symbol status (0=Offline, 1=Online, 5=Pre-open, 10=Accessed,
35+
25=Suspended, 29=Pre-Delisted, 30=Delisted)
36+
"""
37+
return self.client.request("GET", "/openApi/spot/v1/common/symbols")
3138

3239
def get_all_symbols(self) -> Dict[str, Any]:
3340
"""Get all available symbols (both spot and futures)"""
@@ -107,23 +114,27 @@ def get_spot_klines(
107114
limit: int = 500,
108115
start_time: Optional[int] = None,
109116
end_time: Optional[int] = None,
117+
time_zone: Optional[int] = None,
110118
) -> Dict[str, Any]:
111119
"""
112120
Get candlestick data for spot
113121
114122
Args:
115123
symbol: Trading symbol
116-
interval: Kline interval (1m, 5m, 15m, 30m, 1h, 4h, 1d, etc.)
117-
limit: Number of klines to return
124+
interval: Kline interval (1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M)
125+
limit: Number of klines to return (max 1440)
118126
start_time: Start time in milliseconds
119127
end_time: End time in milliseconds
128+
time_zone: Timezone offset (0=UTC (default), 8=UTC+8)
120129
"""
121130
params = {"symbol": symbol, "interval": interval, "limit": limit}
122131
if start_time:
123132
params["startTime"] = start_time
124133
if end_time:
125134
params["endTime"] = end_time
126-
return self.client.request("GET", "/openApi/spot/v1/market/klines", params)
135+
if time_zone is not None:
136+
params["timeZone"] = time_zone
137+
return self.client.request("GET", "/openApi/spot/v2/market/kline", params)
127138

128139
def get_24hr_ticker(self, symbol: Optional[str] = None) -> Dict[str, Any]:
129140
"""

bingx/services/spot_account.py

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,30 +74,41 @@ def get_asset_transfer_records(
7474
def internal_transfer(
7575
self,
7676
coin: str,
77-
wallet_type: str,
77+
wallet_type: int,
7878
amount: float,
79-
transfer_type: str,
80-
sub_uid: Optional[str] = None,
79+
user_account_type: int,
80+
user_account: str,
81+
calling_code: Optional[str] = None,
82+
transfer_client_id: Optional[str] = None,
83+
recv_window: Optional[int] = None,
8184
) -> Dict[str, Any]:
8285
"""
83-
Internal transfer (main <-> sub account)
86+
Internal transfer (main account internal transfer)
8487
8588
Args:
8689
coin: Coin name
87-
wallet_type: Wallet type (SPOT, PERPETUAL)
90+
wallet_type: Wallet type (1=Fund Account, 2=Standard Futures, 3=Perpetual Futures, 4=Spot Account)
8891
amount: Transfer amount
89-
transfer_type: Transfer type (FROM_MAIN_TO_SUB, FROM_SUB_TO_MAIN)
90-
sub_uid: Sub-account UID
92+
user_account_type: User account type (1=UID, 2=Phone number, 3=Email)
93+
user_account: User account (UID, phone number, or email)
94+
calling_code: Area code for telephone (required when user_account_type=2)
95+
transfer_client_id: Custom ID for internal transfer (alphanumeric, max 100 chars)
96+
recv_window: Request validity time window in milliseconds
9197
"""
9298
params = {
9399
"coin": coin,
94100
"walletType": wallet_type,
95101
"amount": amount,
96-
"transferType": transfer_type,
102+
"userAccountType": user_account_type,
103+
"userAccount": user_account,
97104
}
98-
if sub_uid:
99-
params["subUid"] = sub_uid
100-
return self.client.request("POST", "/openApi/api/v3/asset/internal/transfer", params)
105+
if calling_code:
106+
params["callingCode"] = calling_code
107+
if transfer_client_id:
108+
params["transferClientId"] = transfer_client_id
109+
if recv_window is not None:
110+
params["recvWindow"] = recv_window
111+
return self.client.request("POST", "/openApi/wallets/v1/capital/innerTransfer/apply", params)
101112

102113
def get_all_account_balances(self) -> Dict[str, Any]:
103114
"""Get all account balances"""

0 commit comments

Comments
 (0)