'Unable to read beyond the end of the stream.' with ibtws
Show older comments
Hi all,
I recently purchased the trading toolbox and I've been following the tutorial on how to obtain historical market data but I always get his error message
'Unable to read beyond the end of the stream.' Hope someone can help.
Here is my code
ib = ibtws('',7497);
ibContract = ib.Handle.createContract;
ibContract.symbol = 'MSFT';
ibContract.secType = 'STK';
ibContract.exchange = 'SMART';
ibContract.currency = 'USD';
bdc = 13;
startDate = daysadd(today,-20,bdc);
endDate = daysadd(today-1,-1,bdc);
1 Comment
Sandro Hantke
on 4 Jan 2020
Hello, have you already solved the problem? I have the same problem and no solution to it. greetings
Answers (1)
Annie Leonhart
on 4 Jan 2020
1 vote
You need to be subscribed to realtime data on IB.
You need these subscriptions on IBKR:
CBOE Realtime: $1/m
US Equity and Options Add-On Streaming Bundle: $4.50/m
US Securities Snapshot and Futures Value Bundle: $10/m
9 Comments
Sandro Hantke
on 5 Jan 2020
Thank you, Annie!
Annie Leonhart
on 5 Jan 2020
Let me know if the problem persists after subscribing to the required datafeeds
Allen Lee
on 29 Mar 2020
ib = ibtws('',7496);
ibForex = ib.Handle.createContract;
ibForex.symbol = 'CL';
ibForex.secType = 'FUT';
ibForex.primaryexchange = 'NYMEX';
ibForex.exchange = 'SMART';
ibForex.currency = 'USD';
ibForex.LastTradeDateOrContractMonth ='20200421';
startdate = floor(now)-1;
enddate = floor(now);
barsize = '1 min';
ticktype = 'BID';
d = history(ib, ibForex, startdate, enddate, barsize, ticktype)
Hello I have the same problem, and I have already signed up NYMEX Real-Time data, but still getting the same error mesage. Please help, thank you.
Annie Leonhart
on 29 Mar 2020
Change exchange to match the primary exchange
Allen Lee
on 30 Mar 2020
i tried that, but it runs afterward, but matlab is stuck in busy for a long time and not return anything.
Any idea why this is happening?
Annie Leonhart
on 30 Mar 2020
How long is a long time?
Allen Lee
on 30 Mar 2020
it just wont stop unless i force stop it,
i tried to change the bar size to 8 hours, so that it will fetch less data.
but still, the code wont stop
Annie Leonhart
on 30 Mar 2020
Edited: Annie Leonhart
on 30 Mar 2020
ib = ibtws('',7496);
ibForex = ib.Handle.createContract;
ibForex.symbol = 'CL';
ibForex.secType = 'FUT';
ibForex.primaryexchange = 'NYMEX';
ibForex.exchange = 'NYMEX';
ibForex.LastTradeDateOrContractMonth ='202004';
startdate = floor(now)-1;
enddate = floor(now);
barsize = '1 min';
ticktype = 'BID';
d = history(ib, ibForex, startdate, enddate, ticktype, barsize)
Try this.
If this doesn't work, you should download and use the IB Gateway and turn the log on. Then when you run it, you can see what it's doing and I can better see what's going on :)
Allen Lee
on 30 Mar 2020
ib = ibtws('',7496);
ibForex = ib.Handle.createContract;
ibForex.symbol = 'CL';
ibForex.secType = 'FUT';
ibForex.primaryexchange = 'NYMEX';
ibForex.exchange = 'NYMEX';
ibForex.LastTradeDateOrContractMonth ='20200421';
startdate = floor(now)-1;
enddate = floor(now);
barsize = '1 min';
ticktype = 'BID';
d = history(ib, ibForex, startdate, enddate,ticktype, barsize)
i tried this and it finally worked. thanks
Categories
Find more on Transaction Cost Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!