问题标签 [interactive-brokers]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
514 浏览

python - 带有 IbPy 的 Interactive Brokers,API 连接在 Mac OsX 上不起作用

我在使用 IbPy 连接 Interactive Brokers API 时遇到一些问题。我正在尝试导入:

ib.opt 导入连接,消息不起作用

我得到的错误消息是: from ib.opt import Connection, message

我的研究已将我指向这些站点,但我仍然无法解决问题。任何帮助深表感谢。

https://code.google.com/p/ibpy/issues/detail?id=16

系统规格:OSX 10.9.5 (Maverick) Python 2.7.8

先感谢您。

0 投票
2 回答
2101 浏览

python - 使用 python ibPy 库获取您的投资组合的位置

我正在使用 ibpy 来获取我的投资组合的位置。我明白我可以做到:

然后我应该以updatePortfolio()某种方式使用,但我不知道如何。

谢谢

0 投票
2 回答
1891 浏览

java - Customize Interactive Brokers' reqIds() and reqMktData() Java methods

I am trying to write customized code within Interactive Brokers' Java API. There are a bunch of methods that get sent to TWS via the eClientSocket object. Two examples are reqIds() and reqMktData(). These are both void methods, so they do not return anything. Instead, they 'activate' methods written within the class that invokes them (in this case, SampleFrame). These methods are also void, in that they don't return any data. Instead, code is written within these methods (nextValidId() and tickPrice() respectively) to handle the data that is sent back from TWS (trader workstation).

I am having trouble creating a modified version of the nextValidId() and tickPrice() methods because reqIds() and reqMktData() don't actually specify these method names in their own code. I therefore cannot write a method called "tickPriceBlackBox()" which is called from within reqMktData(), or from within a copy of reqMktData() called reqMktDataBlackBox(). Again, there is no specific code within reqMktData() that can be modified to call a specific tickPriceBlackBox() method. It's as if code within TWS itself is hardwired to call the tickPrice() method, making it impossible for me to create a new method for returning price information.

Can anyone explain what is going on, or how to create a solution?

Here's some code:

//Here is the reqMktData() method public synchronized void reqMktData(int tickerId, Contract contract, String genericTickList, boolean snapshot, List mktDataOptions) { if (!m_connected) { error(EClientErrors.NO_VALID_ID, EClientErrors.NOT_CONNECTED, ""); return; }

//The key piece of this code, REQ_MKT_DATA, leads to a final int variable within the EClientSocket.java object, equal to 1. tickPrice() is not mentioned anywhere.

//This method provides stock price, but doesn't return a value. You have to put executable code within this one method. I cannot duplicate and change the name of this method (tickprice();) because none of my accessible code calls it, to my knowledge. It feels as if TWS is calling tickPrice from its end.

public void tickPrice( int tickerId, int field, double price, int canAutoExecute) { // received price tick String msg = EWrapperMsgGenerator.tickPrice( tickerId, field, price, canAutoExecute); m_tickers.add( msg ); }

0 投票
1 回答
1044 浏览

interactive-brokers - 下订单而不用 IBpy 传输?

我是新手IBpy,我想知道是否有任何方法可以在不发送订单并等待人工输入实际发送订单的情况下下订单?

我习惯placeOrder下订单,但我找不到不发送订单的方法。

任何帮助将不胜感激。

0 投票
3 回答
8073 浏览

interactive-brokers - 盈透证券代码列表

我想使用 IB Api,但无法弄清楚我们如何请求完整的交易品种列表和信息。

在我找到的文档中:reqScannerParameters() - 但不清楚如何获取纳斯达克股票的列表?

有没有更好的办法 ?

0 投票
3 回答
2649 浏览

forex - 如何通过盈透证券 TWS Java API 获取交易盈亏

是否有任何方法可以通过其 Java API 获得在 IB TWS 上进行的特定交易的损益(每日和迄今为止的总计)?

0 投票
2 回答
1221 浏览

java - 在 Java 中使用 Interactive Broker API 的 IOrderHandler 接口的正确方法是什么?

我目前正在开发一个使用 Interactive Broker 的 API 进行交易的 Java 应用程序。我遇到了一个问题,我不确定我做错了什么或者这是否是 API 中的错误。

此时,我目前可以使用以下调用提交我的订单:

我遇到的问题是,虽然订单通过 API 在 Trader Workstation 上传输和填写,但我没有收到已创建订单的任何更新。

我还验证了我实际上是通过 ILiveOrdersHandler 接收订单更新,它基本上提供了所有订单的状态更新。

我不知道这是我的编程问题还是底层 API 的问题;我还通过将 System.out.println() 调用添加到其程序中的相应处理程序,在 IB 提供的示例代码上确认了这种行为。

任何帮助将不胜感激。

0 投票
1 回答
4113 浏览

python - ibpy:提取多个合约的 API 响应

我有兴趣将 ibpy 与 Interactive Brokers API 一起使用,以获取给定 100 只股票的实时报价数据。下面的代码来自网络上的示例,适用于一只股票。有人能告诉我如何同时处理 100 只股票吗?

Python脚本:

命令行输出:

0 投票
1 回答
2541 浏览

python - reqHistoricalData() 使用 IBpy 返回空值?

我正在尝试使用 IBpy 从某些仪器返回历史数据,但是当我尝试文档中的代码时,我得到一个空结果。

我设法使用 R Ibroker 使它工作,但我真的更希望它使用 Python API 工作。

这是我正在测试的代码。

知道可能出了什么问题吗?

0 投票
3 回答
1949 浏览

java - 从 Interactive Brokers Java API 读取 minTick 的问题

我在使用 Interactive Brokers API 时遇到一些问题:当我通过使用请求合同详细信息时

我收到数据;其中包含字段 minTick,似乎始终显示 1.0E-4

当我使用 PlaceOrder 方法传输订单时,将价格设置为 0.0001 的倍数时遇到以下错误消息:

我不确定是什么导致了我是否错误地使用了这个值。

任何帮助,将不胜感激。

谢谢你。