遇到错误“需要IB API";安装IB API时 [英] Encounter error "IB API required" when IB API is installed

查看:314
本文介绍了遇到错误“需要IB API";安装IB API时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试这个新的python包ib_insync.

I am trying out this new python package ib_insync.

https://github.com/erdewit/ib_insync

我运行了下面的python脚本;

I ran the python script below;

from ib_insync import *

ib = IB()
ib.connect('127.0.0.1', 7496, clientId=1)

contract = Forex('EURUSD')
bars = ib.reqHistoricalData(contract, endDateTime='', durationStr='30 D', barSizeSetting='1 hour', whatToShow='MIDPOINT', useRTH=True)

# convert to pandas dataframe:
df = util.df(bars)
print(df[['date', 'open', 'high', 'low', 'close']])

我遇到了错误IB API from http://interactivebrokers.github.io is required.

我已经将IB API版本9.73.06安装在C:\ TW_API文件夹下.我正在使用Windows 10和Anaconda python v3.6.

I have already installed IB API ver 9.73.06 under C:\TW_API folder. I am using Windows 10 and anaconda python v3.6 .

这是我的TWS API设置的快照;

Here is a snapshot of my TWS API settings;

推荐答案

我找到了自己问题的答案.问题是我正在使用的python版本中未安装ib-api python模块

I found the answer to my own question. The problem was that ib-api python module was not installed into the python version that I am using

C:\TW_API\source\pythonclient中找到了README.md 按照说明,我运行了以下命令;

There is a README.md found in C:\TW_API\source\pythonclient Following the instructions, I ran the following commands;

$ python setup.py bdist_wheel
$ python -m pip install --user --upgrade dist/ibapi-9.73.6-py3-none-any.whl

我的python脚本现在可以正常运行而没有错误了.

My python script runs normally without error now.

这篇关于遇到错误“需要IB API";安装IB API时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆