如何告诉 ccxt 使用 binance / bybit 测试网

std*_*out 5 python binance ccxt

我写了一个小脚本,用 ccxt 从 binance 或 bybit 下载 ohlcv 数据。我想从测试网和主网获取蜡烛数据。我查看了 ccxt 代码,两个网络都有网址,但我不知道如何设置该选项。

我想一定有类似的东西。bybitt = ccxt.binance({ 'option': { 'defaultMarket': 'future' }})

有人知道吗?

Igo*_*tor 17

使用 CCXT,如果底层交易所有沙箱/测试网,您可以切换到沙箱/测试网,使用.set_sandbox_mode如下方法:

import ccxt
exchange = ccxt.binance({'enableRateLimit': True})
exchange.set_sandbox_mode(True)
Run Code Online (Sandbox Code Playgroud)

  • 确保不要将测试网 API 密钥与交易所的生产 API 密钥混淆。 (2认同)