【问题标题】:CCXT / python - custom requests?CCXT / python - 自定义请求?
【发布时间】:2020-08-05 16:34:17
【问题描述】:

是否有可能使用 CCXT API 进行自定义 GET 或 POST 请求?我在 API 请求列表中找不到其中一些, 例如,GET /api/account/v3/asset-valuationPOST /api/margin/v3/accounts/btc-usdt/leverage{"leverage":"10"}GET /api/account/v3/sub-account

或者也许有一些方法可以提取 CCXT 身份验证标头以发出请求?

谢谢!

【问题讨论】:

    标签: python quantitative-finance algorithmic-trading trading ccxt


    【解决方案1】:

    答案记录在 CCXT 手册中:

    您可以调用任何 API 端点并按照 CCXT 手册中的说明发送任何参数:

    import ccxt
    exchange = ccxt.okex({
        'apiKey': 'YOUR_API_KEY',
        'secret': 'YOUR_SECRET',
        'password': 'YOUR_API_KEY_PASSWORD',
        'enableRateLimit': True,
    })
    
    print(exchange.account_get_asset_valuation({}))  # add params if needed
    
    sub_account_params = {'sub-account': 'YOUR_SUB_ACCOUNT_HERE'}
    print(exchange.account_get_sub_account(sub_account_params))
    
    leverage_params = {'instrument_id': 'BTC-USDT', 'leverage': YOUR_LEVERAGE_HERE}
    print(exchange.margin_post_accounts_instrument_id_leverage(leverage_params))
    

    或者也许有一些方法可以提取 CCXT 身份验证标头以发出请求?

    没必要,CCXT 允许你调用任何你喜欢的端点。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-14
      • 1970-01-01
      • 1970-01-01
      • 2015-08-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多