有没有可能用CCXT API进行自定义GET或POST请求?我在API请求列表中找不到其中的一些请求,例如。GET /api/account/v3/asset-valuation
或 POST /api/margin/v3/accounts/btc-usdt/leverage{"leverage":"10"}
或 GET /api/account/v3/sub-account
或者有什么方法可以提取CCXT auth头来进行请求?
谢谢!
答案在CCXT手册里有记载。
你可以调用任何API端点,并按照CCXT手册中的描述发送任何params。
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 auth头来进行请求?
不需要,CCXT允许你随意调用任何端点。