当我在 Google 表格中通过 API 请求从 Binance 获取期权数据时,我总是收到相同的错误消息。我的代码:
function DownLoad_options_OI(BaceAsset) {
url='https://eapi.binance.com/eapi/v1/openInterest?underlyingAsset=BaceAsset;expiration=230113';
options = {muteHttpExceptions: true};
var response=UrlFetchApp.fetch(url,options)
return response.getContentText()
}
Google Apps 脚本中的执行日志显示一切正常。但是当我将任何值传输到函数 DownLoad_options_OI(BTC 或 ETH)时,我总是收到相同的错误消息:
“代码”:0, "msg": "根据 https://www.binance.com/en/terms 中的'b. 资格',在受限地点无法提供服务。如果您认为自己错误地收到了这条消息,请联系客服。"
但是浏览器中的相同请求正在运行: https://eapi.binance.com/eapi/v1/openInterest?underlyingAsset=BTC;expiration=230113
如何解决这个问题?
试试这个: info = Client(tld='us').get_historical_klines(symbol, timeframe, starting_date)