gpt4 book ai didi

python - 盈透证券 : Unable to fetch Forex Historical data

转载 作者:行者123 更新时间:2023-12-05 05:33:20 25 4
gpt4 key购买 nike

我是第一次尝试 IB。我正在尝试获取 $EUR 的历史数据,但出现错误:

Error 162, reqId 3: Historical Market Data Service error message:Nohistorical market data for EUR/CASH@FXSUBPIP Last 1800, contract:Contract(secType='CASH', symbol='EUR', exchange='IDEALPRO',currency='USD')

下面是我的代码:

import datetime

from ib_insync import *

if __name__ == '__main__':
ib = IB()
r = ib.connect('127.0.0.1', port=7497, clientId=1)
contract = Contract()
contract.symbol = "EUR"
contract.secType = "CASH"
contract.currency = "USD"
contract.exchange = "IDEALPRO"

data = ib.reqHistoricalData(
contract=contract,
endDateTime='',
durationStr='100 D',
barSizeSetting='30 mins',
useRTH=True,
whatToShow='ADJUSTED_LAST'
)

最佳答案

https://interactivebrokers.github.io/tws-api/historical_bars.html#available_products_hd

您可以看到 whatToShow='ADJUSTED_LAST' 需要像 MIDPOINT 一样可用于外汇。显然没有股息需要调整。

此外,没有真正的外汇交易和综合数据,您得到的只是 IB 发生的一切。

关于python - 盈透证券 : Unable to fetch Forex Historical data,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73893871/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com