我需要从币安获取资金利率历史数据,但即使我输入:
它也只显示现货市场:binance = ccxt.binance({'option': {'defaultType': 'future'}})
binance.fetch_markets()
如何修复?
希望这有帮助:
import ccxt
exchange = ccxt.binance()
exchange.options = {'defaultType': 'future',
'adjustForTimeDifference': True}
symbol = 'BTC/USDT'
funding = exchange.fetchFundingRate(symbol)
print(funding)
这就是我们使用 ccxt 获取交易所信息的方式
用您的替换 API 密钥和密码
import ccxt from 'ccxt';
const exchangeClass = ccxt['binanceusdm'];
const exchange = new exchangeClass({
'apiKey': "apiKey",
'secret': "secret",
'options': {
'defaultType': 'future',
}
});
// console.log(symbol, type, side, quantity, price, param ,"spam" )
exchange.setSandboxMode(false)
//get exchange information
const exchangeInfo = await exchange.fetchMarkets();