Skip to content

Latest commit

 

History

History
135 lines (88 loc) · 3.08 KB

File metadata and controls

135 lines (88 loc) · 3.08 KB

Migration Guide: Binance Simple Earn SDK Modularization

With the transition to a modularized structure, the Binance Connector has been split into separate Python libraries, each focusing on a distinct product (e.g., Spot, Futures, etc.). This guide explains how to migrate from the monolithic binance-connector package to the new binance-sdk-simple-earn library.


Key Changes

  1. Package Name:
    The modularised Simple Earn Connector has been moved to a new package:

    Old: binance-connector
    New: binance-sdk-simple-earn

  2. Installation:
    Uninstall the old package and install the new one:

    pip uninstall binance-connector
    pip install binance-sdk-simple-earn
  3. Imports:
    Update your import paths.

    Old:

    from binance.spot import Spot as Client

    New:

    from binance_sdk_simple_earn.simple_earn import SimpleEarn, ConfigurationRestAPI
  4. Configuration and Client Initialization:
    The new structure keeps the existing configuration options but modularizes clients into SimpleEarn.

    Old:

    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)

    New:

    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()
  5. Examples and Documentation:
    Updated examples can be found in the new repository folders:

    • REST API: examples/rest_api/

Migration Steps

1. Uninstall the Old Package

Remove the old package from your project:

pip uninstall binance-connector

2. Install the New Package

Install the new SimpleEarn-specific package:

pip install binance-sdk-simple-earn

3. Update Import Paths

Replace all occurrences of:

from binance.spot import Spot as Client

With:

from binance_sdk_simple_earn.simple_earn import SimpleEarn

4. Update Client Initialization

Adjust your code to use the modularized structure. For example:

Old:

client = Client(apiKey='your-key', apiSecret='your-secret')

New:

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)

5. Test and Verify

Run your application to ensure everything works as expected. Refer to the new documentation for any advanced features or configuration options.


Additional Notes

  • Future Modular Packages: Similar packages for other products (e.g., Wallet, Staking) will follow this pattern.

For more details, refer to the updated README and Examples.