### Install Multiple Connectors Source: https://github.com/binance/binance-connector-python/blob/master/README.md Install several Binance SDK packages simultaneously. ```bash pip install binance-sdk-spot binance-sdk-margin-trading binance-sdk-staking ``` ```bash poetry add binance-sdk-spot binance-sdk-margin-trading binance-sdk-staking ``` -------------------------------- ### Install New Package Source: https://github.com/binance/binance-connector-python/blob/master/clients/pay/docs/migration_guide_pay_sdk.md Command to install the new `binance-sdk-pay` package. ```bash pip install binance-sdk-pay ``` -------------------------------- ### Install Binance Wallet SDK Source: https://github.com/binance/binance-connector-python/blob/master/clients/wallet/README.md Use pip to install the library in a Python 3.9+ environment. ```bash pip install binance-sdk-wallet ``` -------------------------------- ### Install the Binance Margin Trading SDK Source: https://github.com/binance/binance-connector-python/blob/master/clients/margin_trading/README.md Use pip to install the library in your Python environment. ```bash pip install binance-sdk-margin-trading ``` -------------------------------- ### Install the SDK Source: https://github.com/binance/binance-connector-python/blob/master/clients/derivatives_trading_options/README.md Use pip to install the library in a Python 3.9+ environment. ```bash pip install binance-sdk-derivatives-trading-options ``` -------------------------------- ### Install Binance C2C SDK Source: https://github.com/binance/binance-connector-python/blob/master/clients/c2c/README.md Install the library via pip. ```bash pip install binance-sdk-c2c ``` -------------------------------- ### Install the SDK Source: https://github.com/binance/binance-connector-python/blob/master/clients/derivatives_trading_coin_futures/README.md Use pip to install the library in a Python 3.9+ environment. ```bash pip install binance-sdk-derivatives-trading-coin-futures ``` -------------------------------- ### Install Multiple SDKs Source: https://context7.com/binance/binance-connector-python/llms.txt Install multiple Binance SDKs at once using pip. ```bash pip install binance-sdk-spot binance-sdk-margin-trading binance-sdk-staking ``` -------------------------------- ### Install Binance VIP Loan SDK Source: https://github.com/binance/binance-connector-python/blob/master/clients/vip_loan/README.md Use pip to install the library in your Python 3.9+ environment. ```bash pip install binance-sdk-vip-loan ``` -------------------------------- ### Install Binance Staking SDK Source: https://github.com/binance/binance-connector-python/blob/master/clients/staking/README.md Use pip to install the library in a Python 3.9+ environment. ```bash pip install binance-sdk-staking ``` -------------------------------- ### Initialize Spot Client (New) Source: https://github.com/binance/binance-connector-python/blob/master/clients/spot/docs/migration_guide_spot_sdk.md Example of initializing the Spot client using the new modular binance-sdk-spot library with configuration. ```python from binance_sdk_spot.spot import Spot from binance_common.configuration import ConfigurationRestAPI configuration = ConfigurationRestAPI( api_key="your-key", api_secret="your-secret" ) client = Spot(config_rest_api=configuration) response = client.rest_api.exchange_info() ``` -------------------------------- ### Install Binance Derivatives Trading Portfolio Margin SDK Source: https://github.com/binance/binance-connector-python/blob/master/clients/derivatives_trading_portfolio_margin/README.md Install the library using pip. Ensure your environment is running Python 3.9 or later. ```bash pip install binance-sdk-derivatives-trading-portfolio-margin ``` -------------------------------- ### Install Binance Convert SDK Source: https://github.com/binance/binance-connector-python/blob/master/clients/convert/docs/migration_guide_convert_sdk.md Commands to remove the legacy package and install the new modularized library. ```bash pip uninstall binance-connector pip install binance-sdk-convert ``` ```bash pip uninstall binance-connector ``` ```bash pip install binance-sdk-convert ``` -------------------------------- ### Update Client Initialization (Example) Source: https://github.com/binance/binance-connector-python/blob/master/clients/pay/docs/migration_guide_pay_sdk.md Shows a specific example of updating the client initialization with API keys. ```python client = Client(apiKey='your-key', apiSecret='your-secret') ``` ```python from binance_sdk_pay.pay import Pay, ConfigurationRestAPI configuration = ConfigurationRestAPI( api_key="your-key", api_secret="your-secret" ) client = Pay(config_rest_api=configuration) ``` -------------------------------- ### Install binance-sdk-crypto-loan Source: https://github.com/binance/binance-connector-python/blob/master/clients/crypto_loan/docs/migration_guide_crypto_loan_sdk.md Uninstall the old package and install the new modular Crypto Loan SDK. ```bash pip uninstall binance-connector pip install binance-sdk-crypto-loan ``` -------------------------------- ### Initialize Spot Client (Old) Source: https://github.com/binance/binance-connector-python/blob/master/clients/spot/docs/migration_guide_spot_sdk.md Example of initializing the Spot client using the old monolithic binance-connector package. ```python from binance.spot import Spot client = Spot(api_key="your-key", api_secret="your-secret") response = client.account() print(response) ``` -------------------------------- ### Install binance-sdk-convert Source: https://github.com/binance/binance-connector-python/blob/master/clients/convert/README.md Install the library using pip. Ensure your environment is running Python 3.9 or later. ```bash pip install binance-sdk-convert ``` -------------------------------- ### Install Modular Connectors Source: https://github.com/binance/binance-connector-python/blob/master/MIGRATION.md Install specific product connectors as needed for your project. ```bash pip install binance-sdk-spot ``` ```bash pip install binance-sdk-spot binance-sdk-margin-trading binanc-sdk-wallet ``` -------------------------------- ### Install New Binance SDK Spot Source: https://github.com/binance/binance-connector-python/blob/master/clients/spot/docs/migration_guide_spot_sdk.md Command to install the new, modular binance-sdk-spot package. ```bash pip install binance-sdk-spot ``` -------------------------------- ### Install Binance Derivatives Trading SDK Source: https://github.com/binance/binance-connector-python/blob/master/clients/derivatives_trading_usds_futures/README.md Install the library using pip. Ensure your environment is running Python 3.9 or later. ```bash pip install binance-sdk-derivatives-trading-usds-futures ``` -------------------------------- ### Install Single Connector Source: https://github.com/binance/binance-connector-python/blob/master/README.md Install a specific Binance SDK package using pip or poetry. ```bash pip install binance-sdk-spot ``` ```bash poetry add binance-sdk-spot ``` -------------------------------- ### Install New Binance NFT SDK Package Source: https://github.com/binance/binance-connector-python/blob/master/clients/nft/docs/migration_guide_nft_sdk.md Install the new NFT-specific package `binance-sdk-nft`. ```bash pip install binance-sdk-nft ``` -------------------------------- ### Install Binance SDK Simple Earn Source: https://github.com/binance/binance-connector-python/blob/master/clients/simple_earn/README.md Install the library using pip. Ensure your environment is running Python 3.9 or later. ```bash pip install binance-sdk-simple-earn ``` -------------------------------- ### Install binance-common via pip Source: https://github.com/binance/binance-connector-python/blob/master/common/README.md Use this command to install the utility package in your Python environment. ```bash pip install binance-common ``` -------------------------------- ### Install New Binance Crypto Loan Package Source: https://github.com/binance/binance-connector-python/blob/master/clients/crypto_loan/docs/migration_guide_crypto_loan_sdk.md Command to install the new modular `binance-sdk-crypto-loan` package. ```bash pip install binance-sdk-crypto-loan ``` -------------------------------- ### Install binance-sdk-pay Source: https://github.com/binance/binance-connector-python/blob/master/clients/pay/docs/migration_guide_pay_sdk.md Uninstall the old package and install the new modular Pay Connector package. ```bash pip uninstall binance-connector pip install binance-sdk-pay ``` -------------------------------- ### Install New Binance Spot SDK Source: https://github.com/binance/binance-connector-python/blob/master/clients/spot/docs/migration_guide_spot_sdk.md Uninstall the old package and install the new modular Spot SDK. ```bash pip uninstall binance-connector pip install binance-sdk-spot ``` -------------------------------- ### Install New Binance Gift Card Package Source: https://github.com/binance/binance-connector-python/blob/master/clients/gift_card/docs/migration_guide_gift_card_sdk.md Command to install the new modular 'binance-sdk-gift-card' package. ```bash pip install binance-sdk-gift-card ``` -------------------------------- ### Install Binance Alpha SDK Source: https://github.com/binance/binance-connector-python/blob/master/clients/alpha/README.md Install the library using pip. Requires Python 3.9 or later. ```bash pip install binance-sdk-alpha ``` -------------------------------- ### Install binance-sdk-nft Source: https://github.com/binance/binance-connector-python/blob/master/clients/nft/docs/migration_guide_nft_sdk.md Uninstall the old package and install the new modular NFT package using pip. ```bash pip uninstall binance-connector pip install binance-sdk-nft ``` -------------------------------- ### Install and Uninstall Package Source: https://github.com/binance/binance-connector-python/blob/master/clients/derivatives_trading_portfolio_margin_pro/docs/migration_guide_derivatives_trading_portfolio_margin_pro_sdk.md Commands to remove the legacy package and install the new modularized SDK. ```bash pip uninstall binance-connector pip install binance-sdk-derivatives-trading-portfolio-margin-pro ``` ```bash pip uninstall binance-connector ``` ```bash pip install binance-sdk-derivatives-trading-portfolio-margin-pro ``` -------------------------------- ### Install Binance Service SDKs Source: https://context7.com/binance/binance-connector-python/llms.txt Use these pip commands to install specific Binance service modules as needed for your application. ```bash pip install binance-sdk-alpha # Alpha (Early-stage tokens) pip install binance-sdk-c2c # P2P Trading pip install binance-sdk-fiat # Fiat Operations pip install binance-sdk-gift-card # Gift Cards pip install binance-sdk-mining # Mining Pool pip install binance-sdk-nft # NFT pip install binance-sdk-pay # Binance Pay pip install binance-sdk-rebate # Rebate Program ``` -------------------------------- ### Install binance-sdk-sub-account Source: https://github.com/binance/binance-connector-python/blob/master/clients/sub_account/docs/migration_guide_sub_account_sdk.md Uninstall the old package and install the new modular sub-account package using pip. ```bash pip uninstall binance-connector pip install binance-sdk-sub-account ``` -------------------------------- ### Install and Uninstall Binance SDK Packages Source: https://github.com/binance/binance-connector-python/blob/master/clients/wallet/docs/migration_guide_wallet_sdk.md Commands to remove the legacy package and install the new modular wallet library. ```bash pip uninstall binance-connector pip install binance-sdk-wallet ``` ```bash pip uninstall binance-connector ``` ```bash pip install binance-sdk-wallet ``` -------------------------------- ### Install SDK Packages Source: https://context7.com/binance/binance-connector-python/llms.txt Lists the pip commands required to install specific Binance SDK modules for different trading services. ```bash # Spot Trading pip install binance-sdk-spot # Derivatives Trading pip install binance-sdk-derivatives-trading-usds-futures # USDS-M Futures pip install binance-sdk-derivatives-trading-coin-futures # Coin-M Futures pip install binance-sdk-derivatives-trading-options # Options pip install binance-sdk-derivatives-trading-portfolio-margin # Portfolio Margin pip install binance-sdk-derivatives-trading-portfolio-margin-pro # Portfolio Margin Pro # Margin Trading pip install binance-sdk-margin-trading # Wallet & Account Management pip install binance-sdk-wallet pip install binance-sdk-sub-account # Earn Products pip install binance-sdk-staking pip install binance-sdk-simple-earn pip install binance-sdk-dual-investment # Loans pip install binance-sdk-crypto-loan pip install binance-sdk-vip-loan # Trading Utilities pip install binance-sdk-algo # Algorithmic Trading pip install binance-sdk-convert # Convert pip install binance-sdk-copy-trading # Copy Trading ``` -------------------------------- ### Install Binance Python Rebate SDK Source: https://github.com/binance/binance-connector-python/blob/master/clients/rebate/README.md Install the library using pip. Ensure your environment is running Python 3.9 or later. ```bash pip install binance-sdk-rebate ``` -------------------------------- ### Install Binance Python Copy Trading SDK Source: https://github.com/binance/binance-connector-python/blob/master/clients/copy_trading/README.md Install the library using pip. Ensure your environment is running Python version 3.9 or later. ```bash pip install binance-sdk-copy-trading ``` -------------------------------- ### Install Binance Python Algo SDK Source: https://github.com/binance/binance-connector-python/blob/master/clients/algo/README.md Install the library using pip. Ensure your environment is running Python 3.9 or later. ```bash pip install binance-sdk-algo ``` -------------------------------- ### Install and Uninstall Binance Fiat SDK Source: https://github.com/binance/binance-connector-python/blob/master/clients/fiat/docs/migration_guide_fiat_sdk.md Commands to remove the legacy package and install the new modularized version. ```bash pip uninstall binance-connector pip install binance-sdk-fiat ``` ```bash pip uninstall binance-connector ``` ```bash pip install binance-sdk-fiat ``` -------------------------------- ### Install Binance Python Dual Investment SDK Source: https://github.com/binance/binance-connector-python/blob/master/clients/dual_investment/README.md Install the library using pip. Ensure your environment is running Python version 3.9 or later. ```bash pip install binance-sdk-dual-investment ``` -------------------------------- ### Install and Uninstall Binance SDK Packages Source: https://github.com/binance/binance-connector-python/blob/master/clients/derivatives_trading_coin_futures/docs/migration_guide_derivatives_trading_coin_futures_sdk.md Use pip to uninstall the old package and install the new modularized package for Derivatives Trading Coin Futures. ```bash pip uninstall binance-futures-connector pip install binance-sdk-derivatives-trading-coin-futures ``` ```bash pip uninstall binance-futures-connector ``` ```bash pip install binance-sdk-derivatives-trading-coin-futures ``` -------------------------------- ### Install Binance Python Fiat SDK Source: https://github.com/binance/binance-connector-python/blob/master/clients/fiat/README.md Install the library using pip. Ensure your environment is running Python version 3.9 or later. ```bash pip install binance-sdk-fiat ``` -------------------------------- ### Binance NFT SDK - REST API Usage Source: https://github.com/binance/binance-connector-python/blob/master/clients/nft/README.md This snippet demonstrates how to initialize and use the Binance NFT REST API client. It includes basic setup, making a request to get NFT assets, and handling the response or errors. The module is deprecated. ```APIDOC ## Binance NFT SDK - REST API Usage ### Description This code example shows how to initialize the Binance NFT client using REST API configuration and make a call to the `get_nft_asset` endpoint. It also demonstrates basic error handling. ### Method GET (Implicit for `get_nft_asset`) ### Endpoint `/sapi/v1/nft/*` (General endpoint pattern for NFT REST APIs) ### Parameters #### Path Parameters None #### Query Parameters None explicitly shown in example, but actual API calls may require parameters. #### Request Body None ### Request Example ```python from binance_common.configuration import ConfigurationRestAPI from binance_common.constants import NFT_REST_API_PROD_URL from binance_sdk_nft.nft import NFT from binance_sdk_nft.rest_api.models import GetNFTAssetResponse import logging logging.basicConfig(level=logging.INFO) configuration = ConfigurationRestAPI(api_key="your-api-key", api_secret="your-api-secret", base_path=NFT_REST_API_PROD_URL) client = NFT(config_rest_api=configuration) try: response = client.rest_api.get_nft_asset() data: GetNFTAssetResponse = response.data() logging.info(f"get_nft_asset() response: {data}") except Exception as e: logging.error(f"get_nft_asset() error: {e}") ``` ### Response #### Success Response (200) - **data** (GetNFTAssetResponse) - The response data containing NFT asset information. #### Response Example ```json { "example": "response body" } ``` ### Note This module is **DEPRECATED** and will be removed. Please refer to the official Binance API documentation for the latest information and alternatives. ``` -------------------------------- ### Install Dependencies with Poetry Source: https://github.com/binance/binance-connector-python/blob/master/clients/c2c/README.md Install project dependencies using Poetry. Ensure Poetry is installed before running this command. ```bash poetry install ``` -------------------------------- ### Configure Testnet Environment Source: https://github.com/binance/binance-connector-python/blob/master/clients/spot/README.md Shows how to initialize the Spot client with a custom stream URL to connect to the Binance Testnet. ```python from binance_common.configuration import ConfigurationWebSocketStreams from binance_common.constants import SPOT_WS_API_TESTNET_URL from binance_sdk_spot.spot import Spot config_ws_streams = ConfigurationWebSocketStreams( stream_url=SPOT_WS_STREAMS_TESTNET_URL ) client = Spot(config_ws_streams=config_ws_streams) ``` -------------------------------- ### Initialize Binance SDK Client (Old vs. New) Source: https://github.com/binance/binance-connector-python/blob/master/clients/derivatives_trading_coin_futures/docs/migration_guide_derivatives_trading_coin_futures_sdk.md Illustrates the difference in client initialization between the old monolithic SDK and the new modularized SDK for Derivatives Trading Coin Futures. ```python from binance.cm_futures import CMFutures client = Client(api_key="your-key", api_secret="your-secret") agg_trades = client.agg_trades("BTCUSD_PERP") print(agg_trades) ``` ```python from binance_sdk_derivatives_trading_coin_futures.derivatives_trading_coin_futures import DerivativesTradingCoinFutures, ConfigurationRestAPI configuration = ConfigurationRestAPI( api_key="your-key", api_secret="your-secret" ) client = DerivativesTradingCoinFutures(config_rest_api=configuration) response = client.rest_api.compressed_aggregate_trades_list("BTCUSD_PERP") ``` ```python client = Client(apiKey='your-key', apiSecret='your-secret') ``` ```python from binance_sdk_derivatives_trading_coin_futures.derivatives_trading_coin_futures import DerivativesTradingCoinFutures, ConfigurationRestAPI configuration = ConfigurationRestAPI( api_key="your-key", api_secret="your-secret" ) client = DerivativesTradingCoinFutures(config_rest_api=configuration) ``` -------------------------------- ### Initialize Sub Account Client (Old vs New) Source: https://github.com/binance/binance-connector-python/blob/master/clients/sub_account/docs/migration_guide_sub_account_sdk.md Illustrates the difference in client initialization between the old monolithic package and the new modular sub-account structure. ```python from binance.spot import Spot as Client client = Client(api_key="your-key", api_secret="your-secret") response = client.sub_account_list() print(response) ``` ```python from binance_sdk_sub_account.sub_account import SubAccount, ConfigurationRestAPI configuration = ConfigurationRestAPI( api_key="your-key", api_secret="your-secret" ) client = SubAccount(config_rest_api=configuration) response = client.rest_api.query_sub_account_list() ``` -------------------------------- ### Update Client Initialization (New) Source: https://github.com/binance/binance-connector-python/blob/master/clients/spot/docs/migration_guide_spot_sdk.md Demonstrates the new way to initialize the Spot client using a ConfigurationRestAPI object. ```python from binance_sdk_spot.spot import Spot from binance_common.configuration import ConfigurationRestAPI configuration = ConfigurationRestAPI( api_key="your-key", api_secret="your-secret" ) client = Spot(config_rest_api=configuration) ``` -------------------------------- ### Install and Uninstall Package Source: https://github.com/binance/binance-connector-python/blob/master/clients/margin_trading/docs/migration_guide_margin_trading_sdk.md Commands to remove the legacy package and install the new modularized library. ```bash pip uninstall binance-connector pip install binance-sdk-margin-trading ``` ```bash pip uninstall binance-connector ``` ```bash pip install binance-sdk-margin-trading ``` -------------------------------- ### Install and Uninstall Packages Source: https://github.com/binance/binance-connector-python/blob/master/clients/derivatives_trading_usds_futures/docs/migration_guide_derivatives_trading_usds_futures_sdk.md Commands to remove the legacy package and install the new modularized version. ```bash pip uninstall binance-futures-connector pip install binance-sdk-derivatives-trading-usds-futures ``` ```bash pip uninstall binance-futures-connector ``` ```bash pip install binance-sdk-derivatives-trading-usds-futures ``` -------------------------------- ### Initialize Client (Old vs New) Source: https://github.com/binance/binance-connector-python/blob/master/clients/pay/docs/migration_guide_pay_sdk.md Illustrates the difference in client initialization between the old monolithic connector and the new modularized Pay SDK. ```python from binance.spot import Spot as Client client = Client(api_key="your-key", api_secret="your-secret") response = client.pay_history(startTimestamp=1637186702000, limit=50) print(response) ``` ```python from binance_sdk_pay.pay import Pay, ConfigurationRestAPI configuration = ConfigurationRestAPI( api_key="your-key", api_secret="your-secret" ) client = Pay(config_rest_api=configuration) response = client.rest_api.get_pay_trade_history(startTimestamp=1637186702000, limit=50) ``` -------------------------------- ### Initialize Wallet Client Source: https://github.com/binance/binance-connector-python/blob/master/clients/wallet/docs/migration_guide_wallet_sdk.md Comparison of legacy client initialization versus the new modular configuration approach. ```python from binance.spot import Spot as Client client = Client(api_key="your-key", api_secret="your-secret") response = client.coin_info() print(response) ``` ```python from binance_sdk_wallet.wallet import Wallet, ConfigurationRestAPI configuration = ConfigurationRestAPI( api_key="your-key", api_secret="your-secret" ) client = Wallet(config_rest_api=configuration) response = client.rest_api.all_coins_information() ``` ```python client = Client(apiKey='your-key', apiSecret='your-secret') ``` ```python from binance_sdk_wallet.wallet import Wallet, ConfigurationRestAPI configuration = ConfigurationRestAPI( api_key="your-key", api_secret="your-secret" ) client = Wallet(config_rest_api=configuration) ``` -------------------------------- ### Update Import Path Example Source: https://github.com/binance/binance-connector-python/blob/master/clients/pay/docs/migration_guide_pay_sdk.md Specific code example showing the change in import statements. ```python from binance.spot import Spot as Client ``` ```python from binance_sdk_pay.pay import Pay ``` -------------------------------- ### Install and Uninstall Rebate SDK Source: https://github.com/binance/binance-connector-python/blob/master/clients/rebate/docs/migration_guide_rebate_sdk.md Commands to remove the legacy package and install the new modularized version. ```bash pip uninstall binance-connector pip install binance-sdk-rebate ``` ```bash pip uninstall binance-connector ``` ```bash pip install binance-sdk-ebate ``` -------------------------------- ### Initialize Staking Client (Old vs. New) Source: https://github.com/binance/binance-connector-python/blob/master/clients/staking/docs/migration_guide_staking_sdk.md Illustrates the difference in client initialization between the old monolithic package and the new modular staking SDK. ```python from binance.spot import Spot as Client client = Client(api_key="your-key", api_secret="your-secret") response = client.get_eth_staking_quota() print(response) ``` ```python from binance_sdk_staking.staking import Staking, ConfigurationRestAPI configuration = ConfigurationRestAPI( api_key="your-key", api_secret="your-secret" ) client = Staking(config_rest_api=configuration) response = client.rest_api.get_current_eth_staking_quota() ``` ```python client = Client(apiKey='your-key', apiSecret='your-secret') ``` ```python from binance_sdk_staking.staking import Staking, ConfigurationRestAPI configuration = ConfigurationRestAPI( api_key="your-key", api_secret="your-secret" ) client = Staking(config_rest_api=configuration) ``` -------------------------------- ### Initialize Crypto Loan Client (Old vs New) Source: https://github.com/binance/binance-connector-python/blob/master/clients/crypto_loan/docs/migration_guide_crypto_loan_sdk.md Illustrates the difference in client initialization between the old monolithic connector and the new modular Crypto Loan SDK. ```python from binance.spot import Spot as Client client = Client(api_key="your-key", api_secret="your-secret") response = client.loan_history("BTCUSDT") print(response) ``` ```python from binance_sdk_crypto_loan.crypto_loan import CryptoLoan, ConfigurationRestAPI configuration = ConfigurationRestAPI( api_key="your-key", api_secret="your-secret" ) client = CryptoLoan(config_rest_api=configuration) response = client.rest_api.get_crypto_loans_income_history("BTCUSDT") ``` -------------------------------- ### Initialize Rebate Client Source: https://github.com/binance/binance-connector-python/blob/master/clients/rebate/docs/migration_guide_rebate_sdk.md Comparison of legacy client initialization versus the new configuration-based approach. ```python from binance.spot import Spot as Client client = Client(api_key="your-key", api_secret="your-secret") response = client.rebate_spot_history() print(response) ``` ```python from binance_sdk_rebate.rebate import Rebate, ConfigurationRestAPI configuration = ConfigurationRestAPI( api_key="your-key", api_secret="your-secret" ) client = Rebate(config_rest_api=configuration) response = client.rest_api.get_spot_rebate_history_records() ``` ```python client = Client(apiKey='your-key', apiSecret='your-secret') ``` ```python from binance_sdk_rebate.rebate import Rebate, ConfigurationRestAPI configuration = ConfigurationRestAPI( api_key="your-key", api_secret="your-secret" ) client = Rebate(config_rest_api=configuration) ``` -------------------------------- ### Initialize Binance Simple Earn Client (Old vs New) Source: https://github.com/binance/binance-connector-python/blob/master/clients/simple_earn/docs/migration_guide_simple_earn_sdk.md Illustrates the difference in client initialization between the old monolithic connector and the new modular Simple Earn SDK. ```python from binance.spot import Spot as Client client = Client(api_key="your-key", api_secret="your-secret") response = client.get_simple_earn_flexible_product_list() print(response) ``` ```python from binance_sdk_simple_earn.simple_earn import SimpleEarn, ConfigurationRestAPI configuration = ConfigurationRestAPI( api_key="your-key", api_secret="your-secret" ) client = SimpleEarn(config_rest_api=configuration) response = client.rest_api.get_simple_earn_flexible_product_list() ``` ```python client = Client(apiKey='your-key', apiSecret='your-secret') ``` ```python from binance_sdk_simple_earn.simple_earn import SimpleEarn, ConfigurationRestAPI configuration = ConfigurationRestAPI( api_key="your-key", api_secret="your-secret" ) client = SimpleEarn(config_rest_api=configuration) ``` -------------------------------- ### Initialize Gift Card Client (Old vs. New) Source: https://github.com/binance/binance-connector-python/blob/master/clients/gift_card/docs/migration_guide_gift_card_sdk.md Illustrates the difference in client initialization between the old monolithic package and the new modular gift card SDK. ```python from binance.spot import Spot as Client client = Client(api_key="your-key", api_secret="your-secret") response = client.gift_card_rsa_public_key() print(response) ``` ```python from binance_sdk_gift_card.gift_card import GiftCard, ConfigurationRestAPI configuration = ConfigurationRestAPI( api_key="your-key", api_secret="your-secret" ) client = GiftCard(config_rest_api=configuration) response = client.rest_api.fetch_rsa_public_key() ``` -------------------------------- ### Install and Uninstall Mining SDK Source: https://github.com/binance/binance-connector-python/blob/master/clients/mining/docs/migration_guide_mining_sdk.md Commands to remove the legacy package and install the new modular mining library. ```bash pip uninstall binance-connector pip install binance-sdk-mining ``` ```bash pip uninstall binance-connector ``` ```bash pip install binance-sdk-mining ``` -------------------------------- ### Initialize Convert Client Source: https://github.com/binance/binance-connector-python/blob/master/clients/convert/docs/migration_guide_convert_sdk.md Comparison of legacy and new client initialization patterns using the modularized structure. ```python from binance.spot import Spot as Client client = Client(api_key="your-key", api_secret="your-secret") response = client.list_all_convert_pairs() print(response) ``` ```python from binance_sdk_convert.convert import Convert, ConfigurationRestAPI configuration = ConfigurationRestAPI( api_key="your-key", api_secret="your-secret" ) client = Convert(config_rest_api=configuration) response = client.rest_api.list_all_convert_pairs() ``` ```python client = Client(apiKey='your-key', apiSecret='your-secret') ``` ```python from binance_sdk_convert.convert import Convert, ConfigurationRestAPI configuration = ConfigurationRestAPI( api_key="your-key", api_secret="your-secret" ) client = Convert(config_rest_api=configuration) ``` -------------------------------- ### Install and Uninstall Binance C2C Packages Source: https://github.com/binance/binance-connector-python/blob/master/clients/c2c/docs/migration_guide_c2c_sdk.md Commands to remove the legacy package and install the new modularized C2C library. ```bash pip uninstall binance-connector pip install binance-sdk-c2c ``` ```bash pip uninstall binance-connector ``` ```bash pip install binance-sdk-c2c ``` -------------------------------- ### Install New Binance Sub Account Package Source: https://github.com/binance/binance-connector-python/blob/master/clients/sub_account/docs/migration_guide_sub_account_sdk.md Command to install the new modular package specifically for Binance Sub Account functionalities. ```bash pip install binance-sdk-sub-account ``` -------------------------------- ### Initialize Simple Earn REST API Client Source: https://github.com/binance/binance-connector-python/blob/master/clients/simple_earn/README.md Initialize the SimpleEarn client with configuration, including API keys and base path. This example demonstrates fetching flexible product list and logging the response or any errors. ```python from binance_common.configuration import ConfigurationRestAPI from binance_common.constants import SIMPLE_EARN_REST_API_PROD_URL from binance_sdk_simple_earn.simple_earn import SimpleEarn from binance_sdk_simple_earn.rest_api.models import GetSimpleEarnLockedProductListResponse import logging logging.basicConfig(level=logging.INFO) configuration = ConfigurationRestAPI(api_key="your-api-key", api_secret="your-api-secret", base_path=SIMPLE_EARN_REST_API_PROD_URL) client = SimpleEarn(config_rest_api=configuration) try: response = client.rest_api.get_simple_earn_flexible_product_list() data: GetSimpleEarnLockedProductListResponse = response.data() logging.info(f"get_simple_earn_flexible_product_list() response: {data}") except Exception as e: logging.error(f"get_simple_earn_flexible_product_list() error: {e}") ```