Releases: tigusigalpa/bingx-python
v2.0.5
Release Notes - BingX Python SDK v2.0.5
Release Date: April 5, 2026
We're excited to announce version 2.0.5 of the BingX Python SDK, bringing full support for BingX API v3 with powerful institutional-grade trading features while maintaining 100% backward compatibility.
🎉 What's New
🆕 TWAP Service - Algorithmic Order Execution
Execute large orders without moving the market. The new TWAP (Time-Weighted Average Price) service breaks your trades into smaller pieces executed over time to minimize market impact.
New Methods:
twap().buy()- Create TWAP buy ordertwap().sell()- Create TWAP sell ordertwap().get_order_detail()- Monitor execution progresstwap().get_open_orders()- Get all open TWAP orderstwap().get_order_history()- Get historical TWAP orderstwap().cancel_order()- Cancel a TWAP ordertwap().cancel_all_orders()- Cancel all TWAP orders for a symbol
Example:
# Execute 10 BTC over 1 hour
twap = client.twap().buy(
symbol="BTC-USDT",
quantity=10.0,
duration=3600,
position_side="LONG"
)
# Monitor progress
details = client.twap().get_order_detail(twap['orderId'])
print(f"Progress: {details['executedQty']}/{details['totalQty']}")📊 Enhanced Market Data (API v3)
Access institutional-grade market data for better trading decisions.
New Methods:
market().get_open_interest()- Get current open interestmarket().get_open_interest_history()- Historical open interest with configurable periods (5m, 15m, 30m, 1h, 4h, 1d)market().get_funding_rate_info()- Current funding rate and next payment timemarket().get_index_price()- Get index price
Example:
# Track open interest
oi = client.market().get_open_interest("BTC-USDT")
# Get funding rate info
funding = client.market().get_funding_rate_info("BTC-USDT")
print(f"Rate: {funding['fundingRate']}, Next: {funding['fundingTime']}")🛡️ Position Risk Monitoring (API v3)
Real-time risk metrics to prevent liquidations and track performance.
New Methods:
account().get_position_risk()- Detailed position risk including liquidation price, margin ratio, unrealized P&Laccount().get_income_history()- Track all income types (REALIZED_PNL, FUNDING_FEE, COMMISSION, TRANSFER, INSURANCE_CLEAR)account().get_commission_history()- Detailed commission tracking
Example:
# Monitor position risk
risk = client.account().get_position_risk("BTC-USDT")
print(f"Liquidation Price: {risk['liquidationPrice']}")
print(f"Margin Ratio: {risk['marginRatio']}%")
# Track income
income = client.account().get_income_history(
symbol="BTC-USDT",
income_type="REALIZED_PNL"
)💰 Multi-Assets Margin (API v3)
Use your entire portfolio as collateral for increased capital efficiency.
New Methods:
trade().switch_multi_assets_mode()- Enable/disable portfolio-wide margintrade().get_multi_assets_mode()- Get current statustrade().get_multi_assets_margin()- Get margin info including total collateral, margin used, available margintrade().get_multi_assets_rules()- Get supported assets and haircut rates
Example:
# Enable multi-assets margin
client.trade().switch_multi_assets_mode(True)
# Check margin status
margin = client.trade().get_multi_assets_margin()
print(f"Total Collateral: {margin['totalCollateral']}")
print(f"Margin Ratio: {margin['marginRatio']}%")🔧 Advanced Trading Features (API v3)
Auto-Add Margin
Automatically add margin to prevent liquidation.
New Methods:
trade().set_auto_add_margin()- Enable/disable auto-add margintrade().get_auto_add_margin()- Get status
Example:
client.trade().set_auto_add_margin(
symbol="BTC-USDT",
position_side="LONG",
enabled=True
)One-Click Position Reversal
Atomically reverse your position direction.
New Method:
trade().one_click_reverse_position()- Close and reverse position in one operation
Example:
# LONG → SHORT in one atomic operation
client.trade().one_click_reverse_position("BTC-USDT")🎯 New Order Types (API v3)
Support for advanced order types:
- TRAILING_STOP_MARKET - Stop-loss that follows price to lock in profits
- TRIGGER_LIMIT - Conditional limit order triggered at specific price
- TRAILING_TP_SL - Trailing take profit and stop loss
Example:
# Trailing stop that locks in profits
order = client.trade().create_order({
"symbol": "BTC-USDT",
"side": "SELL",
"positionSide": "LONG",
"type": "TRAILING_STOP_MARKET",
"quantity": 1.0,
"activationPrice": 50000,
"callbackRate": 2.0 # Trail 2% behind peak
})📈 Statistics
- Total new methods: 24
- New services: 1 (TWAP)
- Updated services: 3 (Market, Account, Trade)
- Breaking changes: 0 ✅
- Total methods: 190+
🔄 Backward Compatibility
100% backward compatible. All existing code continues to work unchanged.
# This still works exactly as before
price = client.market().get_latest_price("BTC-USDT")
balance = client.account().get_balance()
order = client.trade().create_order({
"symbol": "BTC-USDT",
"side": "BUY",
"type": "MARKET",
"quantity": 0.001
})📦 Installation
Upgrade
pip install --upgrade bingx-pythonFrom PyPI
pip install bingx-python==2.0.5From Source
git clone https://github.com/tigusigalpa/bingx-python.git
cd bingx-python
git checkout v2.0.5
pip install -e .📚 Documentation
- Migration Guide: API_V3_MIGRATION.md
- Examples: examples/api_v3_examples.py
- Update Summary: API_V3_UPDATE_SUMMARY.md
- Changelog: CHANGELOG.md
- README: README.md
🎯 Quick Start with v3 Features
from bingx import BingXClient
import time
client = BingXClient(
api_key="your_api_key",
api_secret="your_api_secret"
)
# 1. Monitor position risk
risk = client.account().get_position_risk("BTC-USDT")
if risk and float(risk['marginRatio']) > 80:
print("⚠️ High risk position!")
# 2. Use TWAP for large orders
twap = client.twap().buy(
symbol="BTC-USDT",
quantity=10.0,
duration=3600
)
# 3. Enable auto-add margin
client.trade().set_auto_add_margin(
symbol="BTC-USDT",
position_side="LONG",
enabled=True
)
# 4. Track income
income = client.account().get_income_history(
symbol="BTC-USDT",
income_type="REALIZED_PNL"
)🐛 Bug Fixes
- Improved error handling for API v3 endpoints
- Enhanced type hints for better IDE support
- Fixed edge cases in signature generation
🔐 Security
- Maintained HMAC-SHA256 signature authentication
- Automatic timestamp validation
- Replay attack protection with recvWindow
- Secure API key handling
🙏 Acknowledgments
Special thanks to the BingX team for providing comprehensive API v3 documentation and to our community for feedback and testing.
📞 Support
- Issues: GitHub Issues
- Documentation: Wiki
- API Docs: BingX API v3
- Email: sovletig@gmail.com
🎉 What's Next
We're committed to keeping the SDK up-to-date with the latest BingX API features. Stay tuned for:
- WebSocket v3 enhancements
- Additional order types
- Performance optimizations
- More examples and tutorials
📄 License
MIT License - see LICENSE file for details.
Upgrade today and start trading like institutions! 🚀
pip install --upgrade bingx-pythonv1.1.51
v1.1.5
Release Notes - BingX Python SDK v1.1.5
Release Date: March 15, 2026
Overview
This release updates the BingX Python SDK to support the latest API changes from BingX, including enhanced spot market data endpoints, improved internal transfer functionality with new wallet types, and powerful new sub-mother account management features.
🎯 What's New
Market Service Enhancements
Updated Spot Symbols Endpoint
- Endpoint Update:
get_spot_symbols()now uses/openApi/spot/v1/common/symbols - New Field: Added
maxMarketNotional- maximum notional amount for a single market order - New Status Value: Added status
29 = Pre-Delistedfor symbols approaching delisting - Complete Status Values:
0= Offline1= Online5= Pre-open10= Accessed25= Suspended29= Pre-Delisted (NEW)30= Delisted
Spot Klines v2 with Timezone Support
- Endpoint Update:
get_spot_klines()now uses/openApi/spot/v2/market/kline - New Parameter:
time_zone- Optional timezone offset0= UTC (default)8= UTC+8
- Increased Limit: Maximum records increased from 1000 to 1440
Example:
# Get klines in UTC+8 timezone
spot_klines = client.market().get_spot_klines(
"BTC-USDT", "1h", 100,
start_time=start_ts,
end_time=end_ts,
time_zone=8
)Spot Account Service Updates
Enhanced Internal Transfer
-
Breaking Change: Updated
internal_transfer()method signature -
New Wallet Type: Added support for
wallet_type=4(Spot Account) -
Complete Wallet Types:
1= Fund Account2= Standard Futures Account3= Perpetual Futures Account4= Spot Account (NEW)
-
New Parameters:
user_account_type: Account identifier type (1=UID, 2=Phone number, 3=Email)user_account: User account identifiercalling_code: Phone area code (required whenuser_account_type=2)transfer_client_id: Custom transfer ID (optional, max 100 chars)recv_window: Request validity time window in milliseconds
Example:
transfer = client.spot_account().internal_transfer(
coin="USDT",
wallet_type=4, # Spot Account
amount=100.0,
user_account_type=1, # UID
user_account="123456",
transfer_client_id="transfer-001"
)Sub-Account Service Enhancements
Updated Sub-Account Internal Transfer
-
Breaking Change: Updated
sub_account_internal_transfer()method signature -
New Wallet Type: Added support for
wallet_type=15(Spot Account) -
Complete Wallet Types for Sub-Accounts:
1= Fund Account2= Standard Futures Account3= Perpetual Futures Account15= Spot Account (NEW)
-
New Parameters: Same as main account internal transfer (see above)
Example:
transfer = client.sub_account().sub_account_internal_transfer(
coin="USDT",
wallet_type=15, # Spot Account
amount=100.0,
user_account_type=1,
user_account="12345678"
)New Method: Sub-Mother Account Asset Transfer
sub_mother_account_asset_transfer() - Master account only
Enables flexible asset transfers between parent and sub-accounts with granular control over account types.
Features:
- Transfer between any combination of parent/sub-accounts
- Support for multiple account types (Funding, Standard futures, Perpetual U-based, Spot)
- Returns
tranIdfor tracking transfer records
Parameters:
asset_name: Asset to transfer (e.g., "USDT")transfer_amount: Amount to transferfrom_uid: Payer UIDfrom_type: 1=Parent account, 2=Sub-accountfrom_account_type: 1=Funding, 2=Standard futures, 3=Perpetual U-based, 15=Spotto_uid: Receiver UIDto_type: 1=Parent account, 2=Sub-accountto_account_type: Account type (same values asfrom_account_type)remark: Transfer descriptionrecv_window: Optional execution window time
Example:
transfer = client.sub_account().sub_mother_account_asset_transfer(
asset_name="USDT",
transfer_amount=100.0,
from_uid=123456,
from_type=1, # Parent account
from_account_type=1, # Funding
to_uid=789012,
to_type=2, # Sub-account
to_account_type=15, # Spot
remark="Transfer to sub-account"
)New Method: Query Transferable Amount
get_sub_mother_account_transferable_amount() - Master account only
Query supported coins and available transferable amounts between accounts.
Returns: Array of coins with id, name, and availableAmount
Example:
transferable = client.sub_account().get_sub_mother_account_transferable_amount(
from_uid=123456,
from_account_type=1, # Funding
to_uid=789012,
to_account_type=15 # Spot
)New Method: Query Transfer History
get_sub_mother_account_transfer_history() - Master account only
Query transfer history between sub-accounts and parent account with advanced filtering.
Features:
- Filter by transfer type, transaction ID, time range
- Pagination support
- Returns total count and detailed transfer records
Example:
history = client.sub_account().get_sub_mother_account_transfer_history(
uid=123456,
type_=None, # Optional filter
tran_id=None, # Optional filter
start_time=start_ts,
end_time=end_ts,
page_id=1,
paging_size=50
)🔄 Breaking Changes
Method Signature Changes
-
spot_account.internal_transfer()- Old signature:
(coin, wallet_type, amount, transfer_type, sub_uid, ...) - New signature:
(coin, wallet_type, amount, user_account_type, user_account, ...) - Migration: Replace
transfer_typeandsub_uidwithuser_account_typeanduser_account
- Old signature:
-
sub_account.sub_account_internal_transfer()- Old signature:
(coin, wallet_type, amount, transfer_type, to_sub_uid, ...) - New signature:
(coin, wallet_type, amount, user_account_type, user_account, ...) - Migration: Replace
transfer_typeandto_sub_uidwithuser_account_typeanduser_account
- Old signature:
Wallet Type Values
- Spot Account Service: Use
wallet_type=4for Spot Account (previously used string values) - Sub-Account Service: Use
wallet_type=15for Spot Account (different from main account)
📝 API Endpoint Changes
| Service | Method | Old Endpoint | New Endpoint |
|---|---|---|---|
| Market | get_spot_klines() |
/openApi/spot/v1/market/kline |
/openApi/spot/v2/market/kline |
| Spot Account | internal_transfer() |
Various | /openApi/wallets/v1/capital/innerTransfer/apply |
| Sub-Account | sub_account_internal_transfer() |
Various | /openApi/wallets/v1/capital/subAccountInnerTransfer/apply |
| Sub-Account | sub_mother_account_asset_transfer() |
N/A (NEW) | /openApi/account/transfer/v1/subAccount/transferAsset |
| Sub-Account | get_sub_mother_account_transferable_amount() |
N/A (NEW) | /openApi/account/transfer/v1/subAccount/transferAsset/supportCoins |
| Sub-Account | get_sub_mother_account_transfer_history() |
N/A (NEW) | /openApi/account/transfer/v1/subAccount/asset/transferHistory |
🔧 Migration Guide
Updating Internal Transfers
Before (v1.0.x):
transfer = client.spot_account().internal_transfer(
coin="USDT",
wallet_type="SPOT",
amount=50.0,
transfer_type="FROM_MAIN_TO_SUB",
sub_uid="123456"
)After (v1.1.5):
transfer = client.spot_account().internal_transfer(
coin="USDT",
wallet_type=4, # Spot Account
amount=50.0,
user_account_type=1, # UID
user_account="123456"
)Updating Sub-Account Transfers
Before (v1.0.x):
transfer = client.sub_account().sub_account_internal_transfer(
coin="USDT",
wallet_type="SPOT",
amount=100.0,
transfer_type="FROM_MAIN_TO_SUB",
to_sub_uid="12345678"
)After (v1.1.5):
transfer = client.sub_account().sub_account_internal_transfer(
coin="USDT",
wallet_type=15, # Spot Account
amount=100.0,
user_account_type=1, # UID
user_account="12345678"
)📚 Documentation Updates
- Updated README with new method examples
- Added CHANGELOG.md with detailed change history
- Updated inline documentation for all modified methods
- Added type hints for better IDE support
📦 Installation
pip install --upgrade bingx-pythonOr update your requirements.txt:
bingx-python==1.1.5
🔗 Resources
- API Documentation: https://bingx-api.github.io/docs-v3/
- GitHub Repository: https://github.com/tigusigalpa/bingx-python
- Issue Tracker: https://github.com/tigusigalpa/bingx-python/issues
🙏 Acknowledgments
This release implements API changes announced by BingX between December 2025 and February 2026, ensuring the SDK remains fully compatible with the latest platform features.
Full Changelog: v1.0.0...v1.1.5
v1.0.0
v1.0.0
Initial release.
USDT-M Perpetual Futures
- Market Service — 40 methods: symbols, prices, depth, klines, funding rates, mark price, premium index, aggregate trades, long/short ratio, basis, Quote API
- Account Service — 25 methods: balance, positions, leverage, margin mode, position margin, fees, permissions
- Trade Service — 30 methods: create/cancel/replace orders, batch orders, test orders, order history, user trades, position mode, quick trade methods (spot market/limit, futures long/short)
- Wallet Service — deposits, withdrawals, deposit addresses, coin info
- Spot Account Service — spot balance, fund balance, universal transfers, internal transfers
- Sub-Account Service — 20 methods: create/manage sub-accounts, API key management, transfers, deposit addresses
- Copy Trading Service — 13 methods: track orders, TP/SL, trader details, profit summary, commission, spot copy trading
- Contract Service — positions, orders, balance for standard contracts
- Listen Key Service — generate, extend, delete WebSocket listen keys
Coin-M Perpetual Futures
- Market — contracts, ticker, depth, klines, open interest, funding rate
- Trade — orders, positions, balance, leverage, margin mode, order/trade history, income, commission rate
- Listen Key — generate, extend, delete
WebSocket
- MarketDataStream — subscribe to trades, klines, depth, ticker, book ticker
- AccountDataStream — balance, position, order updates via listen key
Core
- HMAC-SHA256 request signing (base64 / hex)
- Automatic timestamp and recvWindow
- Exception hierarchy:
BingXException,APIException,AuthenticationException,RateLimitException,InsufficientBalanceException - Type hints
- Python 3.8+