Aggregate interactive brokers data in matlab
Aggregate interactive brokers data in matlab
Loading saved threads...
user1000650 · External communityPost link
External question — Quantitative Finance Stack Exchange
Author: user1000650
Original post: https://quant.stackexchange.com/questions/18568
License: CC BY-SA 3.0 — https://creativecommons.org/licenses/by-sa/3.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I am using matlab and interactive brokers API. I am getting real time data using
tickerID = ib.realtime({ct},'233',@(varargin)ibEventRealTimeData(varargin{:}));
where ib is the interface to interactive brokers TWS Activex object and ct is the contract.
I am getting all the events (ticksize, tickprice and so on) but I can't aggregate data/prices (for example, in 5 minute bars). What am I missing?
Thanks.
Quote
Report
Yair Altman · External communityPost link
External answer — Quantitative Finance Stack Exchange
Author: Yair Altman
Original post: https://quant.stackexchange.com/a/18580
License: CC BY-SA 3.0 — https://creativecommons.org/licenses/by-sa/3.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
In order to aggregate the 5-min bars, you need to add code within your
ibEventRealTimeData
function that remembers the previous values (possibly using a
global
or
persistent
variable) and appends the new data to it.
If you do not need realtime info, you could make a single request for 5-min historical data. But here too, IB sends the results in separate events that you would need to aggregate within your callback.
As an alternative you could use the
IB-Matlab product
, which connects IB and Matlab, and aggregates the information for you, in both the historical/intra-day request and the realtime bars request.
Quote
Report
dkhokhlov · External communityPost link
External answer — Quantitative Finance Stack Exchange
Author: dkhokhlov
Original post: https://quant.stackexchange.com/a/18884
License: CC BY-SA 3.0 — https://creativecommons.org/licenses/by-sa/3.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
Here is a pure Java library with Matlab examples for getting daily and minute aggregated bars. It is based on IB Java API. I wrapped it to have a simple interface:
http://www.spreadvectors.com/wisentgenus#code
IB has limitations when requesting historical data:
Making identical historical data requests within 15 seconds.
Making six or more historical data requests for the same Contract, Exchange and Tick Type within two seconds.
Do not make more than 60 historical data requests in any ten-minute period.
Quote
Report
Post Reply
Checking account access…