¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io
Date

API error - Your API version does not support fractional size rules (during forex price extraction)

 

Hi,

I get the following message - 'Your API version does not support fractional size rules?. Please ' upgrade to a minimum version 163.' when extracting live forex prices specifically AUD.USD.? all other products are fine.... i am sure that i am on the latest version of the API (so not sure about u[grading to min version 163)..

does anyone have any ideas to help resolve this..? Thanks

regrads
Ed


RealTimeBar "open" Error

 

I'm using Python API version 10.20 and got an error when trying to get RealTimeBar data that said there was no attribute "open".? The error message traced back to "common.py" line 76.
?
I changed "open" to "open_" and everything worked.
?
Anyone else have this problem?


Re: TWS Build 10.20.1f dateformat problem

 

Ok, thank you.


On Mon, Dec 19, 2022 at 12:34 AM hymagik via <hymagik=[email protected]> wrote:

Yes, the API doc is correct in some place and are not in some others (as you find it on a page where text look 'strange')
However every code examples seems correct to me.

Dash is legit but implicitly saying that you are using UTC, adding TZ, is even a mistake.
If you use TZ (I recommend it) then you should NOT use dash (as you find that out)

From what I remember, for sake of consistencies only, there is even a way? to specify "UTC"? in the TZ,? without Dash. (or was it "GMT" ? UTC is not officially a TZ, GMT is)
Also be careful that some way of specifying time depend upon your option in TWS Time zone as specified at login.
And be careful in interpretation of historicalDataEnd date summary, it does change depending upon use UTC/use TZ and need to become familiar with. (if you use this summary)

In short
I use no dash and always specify TZ,
Seems safer to: stay consistent, and without impact from setup.



--
?dv,
Zsolt


Re: 1min historical data availability

 

The only thing I can think of, if you need Bid, is to grab "" via . I can't say for sure how much data you can get, but I was able to grab data for EUR.USD for May 9, 2022 (a little more than 7 month ago). You'll get a lot of data (up to 300 ticks per second or more) but it should be pretty straight forward to assemble 1min bars from that

´³¨¹°ù²µ±ð²Ô

..., {
??? "tsInS" : 1652079971,
??? "bPrice" : 1.05073,
??? "bSize" : 2000000,
??? "aPrice" : 1.05075,
??? "aSize" : 2000000,
??? "attr" : 0,
??? "type" : "BidAsk"
? }, { ??? "tsInS" : 1652079971,
??? "bPrice" : 1.05074,
??? "bSize" : 1000000,
??? "aPrice" : 1.05075,
??? "aSize" : 2000000,
??? "attr" : 0,
??? "type" : "BidAsk"
? } ...

On Sat, Dec 17, 2022 at 08:52 PM, John wrote:

Thank you both, since I posted this question, I have noticed indeed multiple gaps.

Yes I need bid, to backtest any strategy, you need to know the spread. I backtest on ticks over the past six months as the data is provided, and then on minutes beyond that for the past 5+ years, as it is the most accurate data IB provides.

No I don't want to use any other data provider, because FX is decentralized and IB has its own prices, and on high frequency scalping it makes a huge difference, I need the very data that I would get by executing via IB in order to backtest anything properly.

I lost money in the past making the assumption that other tick data sources could generate approximately the same signals, spreads and prices, and this assumption didn't hold in actual trading.





Re: TWS Build 10.20.1f dateformat problem

 

Yes, the API doc is correct in some place and are not in some others (as you find it on a page where text look 'strange')
However every code examples seems correct to me.

Dash is legit but implicitly saying that you are using UTC, adding TZ, is even a mistake.
If you use TZ (I recommend it) then you should NOT use dash (as you find that out)

From what I remember, for sake of consistencies only, there is even a way? to specify "UTC"? in the TZ,? without Dash. (or was it "GMT" ? UTC is not officially a TZ, GMT is)
Also be careful that some way of specifying time depend upon your option in TWS Time zone as specified at login.
And be careful in interpretation of historicalDataEnd date summary, it does change depending upon use UTC/use TZ and need to become familiar with. (if you use this summary)

In short
I use no dash and always specify TZ,
Seems safer to: stay consistent, and without impact from setup.


Re: TWS Build 10.20.1f dateformat problem

 

Thanks for pointing out the location of the log menu; now I have found
the problem.

I made a mistake during the API call; I forgot to put space between
the time and timezone parts.

The error message is correct, but the API documentation is not. NO
dash is needed for the timezone date.

Incorrect example: Example: IBM 20220930-15:00:00 US/Eastern
Working example: 20221218 11:08:25 US/Eastern
(I don't know why they wrote IBM in the example, no ticker is needed.)

Thanks to everyone.

Zsolt


On Sun, Dec 18, 2022 at 3:47 PM ´³¨¹°ù²µ±ð²Ô Reinold via groups.io
<TwsApiOnGroupsIo@...> wrote:

A while back, V10 TWS moved the "Diagnostics" options from the "Accounts" menu to "Help -> Troubleshooting -> Diagnostics". The "API Logs" option still exists so you can check that TWS indeed receives what you think your client sends.

´³¨¹°ù²µ±ð²Ô


On Sun, Dec 18, 2022 at 06:02 AM, Zsolt Soczo wrote:

Hello,
I tested TWS Build 10.20.1f, and it does not accept the given date
for Order Tif:
"20221218 05:50:15 US/Central"

ErrorMessage: End Time: The date, time, or time-zone entered is
invalid. The correct format is yyyymmdd hh:mm:ss xx/xxxx where
yyyymmdd and xx/xxxx are optional. E.g.: 20031126 15:59:00 US/Eastern
Note that there is a space between the date and time, and between the
time and time-zone. If no date is specified, current date is assumed.
If no time-zone is specified, local time-zone is assumed(deprecated).
You can also provide yyyymmddd-hh:mm:ss time is in UTC. Note that
there is a dash between the date and time in UTC notation.

I don't see why my date format is bad.

Embarrassingly, the API documentation says I have to use dash between
date components:

20220930-15:00:00 US/Eastern

Besides, the Account/Diagnostics menu is missing, so I cannot see the API log.

--
Thanks,
Zsolt



--
?dv,
Zsolt


Re: TWS Build 10.20.1f dateformat problem

 

A while back, V10 TWS moved the "Diagnostics" options from the "Accounts" menu to "Help -> Troubleshooting -> Diagnostics". The "API Logs" option still exists so you can check that TWS indeed receives what you think your client sends.

´³¨¹°ù²µ±ð²Ô


On Sun, Dec 18, 2022 at 06:02 AM, Zsolt Soczo wrote:
Hello,
I tested TWS Build 10.20.1f, and it does not accept the given date
for Order Tif:
"20221218 05:50:15 US/Central"

ErrorMessage: End Time: The date, time, or time-zone entered is
invalid. The correct format is yyyymmdd hh:mm:ss xx/xxxx where
yyyymmdd and xx/xxxx are optional. E.g.: 20031126 15:59:00 US/Eastern
Note that there is a space between the date and time, and between the
time and time-zone. If no date is specified, current date is assumed.
If no time-zone is specified, local time-zone is assumed(deprecated).
You can also provide yyyymmddd-hh:mm:ss time is in UTC. Note that
there is a dash between the date and time in UTC notation.

I don't see why my date format is bad.

Embarrassingly, the API documentation says I have to use dash between
date components:

20220930-15:00:00 US/Eastern

Besides, the Account/Diagnostics menu is missing, so I cannot see the API log.

--
Thanks,
Zsolt


Re: TWS Build 10.20.1f dateformat problem

Emanuele
 

Hi
maybe it¡¯s because markets are still closed (Sunday) worldwide, not due to format¡­
I am just a beginner and still walking through many problems, so take it just as a suggestion¡­
All the best?

Il giorno dom 18 dic 2022 alle 13:03 Zsolt Soczo <zsolt.soczo@...> ha scritto:
Hello,
? I tested TWS Build 10.20.1f, and it does not accept the given date
for Order Tif:
"20221218 05:50:15 US/Central"

ErrorMessage: End Time: The date, time, or time-zone entered is
invalid. The correct format is yyyymmdd hh:mm:ss xx/xxxx where
yyyymmdd and xx/xxxx are optional. E.g.: 20031126 15:59:00 US/Eastern
Note that there is a space between the date and time, and between the
time and time-zone.? If no date is specified, current date is assumed.
If no time-zone is specified, local time-zone is assumed(deprecated).
You can also provide yyyymmddd-hh:mm:ss time is in UTC. Note that
there is a dash between the date and time in UTC notation.

I don't see why my date format is bad.

Embarrassingly, the API documentation says I have to use dash between
date components:

20220930-15:00:00 US/Eastern

Besides, the Account/Diagnostics menu is missing, so I cannot see the API log.

--
Thanks,
Zsolt






Re: TWS Build 10.20.1f dateformat problem

 

Hi

My stupid suggestion is to check if the dash is transmitted correctly. Maybe you need double quote like ""/

But i guess you've already checked that?

On Sun, 18 Dec 2022 at 14:03 Zsolt Soczo <zsolt.soczo@...> wrote:
Hello,
? I tested TWS Build 10.20.1f, and it does not accept the given date
for Order Tif:
"20221218 05:50:15 US/Central"

ErrorMessage: End Time: The date, time, or time-zone entered is
invalid. The correct format is yyyymmdd hh:mm:ss xx/xxxx where
yyyymmdd and xx/xxxx are optional. E.g.: 20031126 15:59:00 US/Eastern
Note that there is a space between the date and time, and between the
time and time-zone.? If no date is specified, current date is assumed.
If no time-zone is specified, local time-zone is assumed(deprecated).
You can also provide yyyymmddd-hh:mm:ss time is in UTC. Note that
there is a dash between the date and time in UTC notation.

I don't see why my date format is bad.

Embarrassingly, the API documentation says I have to use dash between
date components:

20220930-15:00:00 US/Eastern

Besides, the Account/Diagnostics menu is missing, so I cannot see the API log.

--
Thanks,
Zsolt





--
Ed Gonen


TWS Build 10.20.1f dateformat problem

 

Hello,
I tested TWS Build 10.20.1f, and it does not accept the given date
for Order Tif:
"20221218 05:50:15 US/Central"

ErrorMessage: End Time: The date, time, or time-zone entered is
invalid. The correct format is yyyymmdd hh:mm:ss xx/xxxx where
yyyymmdd and xx/xxxx are optional. E.g.: 20031126 15:59:00 US/Eastern
Note that there is a space between the date and time, and between the
time and time-zone. If no date is specified, current date is assumed.
If no time-zone is specified, local time-zone is assumed(deprecated).
You can also provide yyyymmddd-hh:mm:ss time is in UTC. Note that
there is a dash between the date and time in UTC notation.

I don't see why my date format is bad.

Embarrassingly, the API documentation says I have to use dash between
date components:

20220930-15:00:00 US/Eastern

Besides, the Account/Diagnostics menu is missing, so I cannot see the API log.

--
Thanks,
Zsolt


Re: 1min historical data availability

 

Thank you both, since I posted this question, I have noticed indeed multiple gaps.

Yes I need bid, to backtest any strategy, you need to know the spread. I backtest on ticks over the past six months as the data is provided, and then on minutes beyond that for the past 5+ years, as it is the most accurate data IB provides.

No I don't want to use any other data provider, because FX is decentralized and IB has its own prices, and on high frequency scalping it makes a huge difference, I need the very data that I would get by executing via IB in order to backtest anything properly.

I lost money in the past making the assumption that other tick data sources could generate approximately the same signals, spreads and prices, and this assumption didn't hold in actual trading.





Re: 1min historical data availability

 

1- Do you really need "Bid" ?
Look odd to me to use Bid on Bar on old data.

2- IBKR is tailored (pretty well) to deliver data that are pertinent for immediate decision. (days to sub-seconds).
My guess is that they don't want to make money from data (but don't want to lose money delivering it either)

As the interest of the whole IBKR community is to avoid overloading IB with request for data you can get from other sources, hereafter some suggestion:

a- How much are your ready to pay for data ?
beyond a certain level go see Thomson/Reuters, GFIS, etc ...

b- IB know that there are plenty of data providers out there (doing great for extremely low cost) .
AlphaVantage, FinancialModeling, IEX, Polygon, ...
I am under the impression that IB have a deal with Polygon (or you can get a rebate, call IB to know about it in case Polygon is of interest to you)

c- For example of a third party (just take it as real example of one amongst many vendors of data feeds, free trial)
If you look for Trades (I don't think give you choice for Bid/Ask)
https://financialmodelingprep.com/api/v3//historical-chart/1min/EURUSD?from=2020-05-11&to=2020-05-12&apikey=YOURKEY
Deliver (truncated the whole set is 1516 bar)? Don't ask me what is the unit of volume.
[ {
? "date" : "2020-05-12 19:59:00",
? "open" : 1.08507000,
? "low" : 1.08505000,
? "high" : 1.08516000,
? "close" : 1.08509000,
? "volume" : 79
}, {
? "date" : "2020-05-12 19:58:00",
? "open" : 1.08509000,
? "low" : 1.08504000,
? "high" : 1.08510000,
? "close" : 1.08507000,
? "volume" : 42
}, {

....


Re: 1min historical data availability

 

¿ªÔÆÌåÓý

Just anecdotally I have found 1 minute data from both IB and IQFeed (which I use) to be very patchy. Similar to your experience, I have found large and apparently random gaps in the 1 minute data.? I have more experience with US equities than forex.? The # gaps increase significantly the further back you go. ?The gaps in IB are much worse than in IQFeed, which is part of the reason I use the latter.? I have queried IQFeed about the gaps and have not got a response. I have not bothered to query it with IB, assuming (rightly or wrongly) they are not that interested in addressing the issues, given how widespread it is in their data.? I¡¯m not criticising IQFeed particularly as it¡¯s the best 1 minute historical data I¡¯ve found without a five figure price tag.

?

If others are aware of the reasons for these gaps, or if data is in fact available and I¡¯m querying it wrong, or if there are better providers out there, I would be interested to know.? I find the lack of quality 1minute data a major limitation in developing intraday systems.

?

[Unrelated to the API: I¡¯ve had discussions with Richard Dale from Norgate Data who is considering generating a 1 minute historical database for FOREX/US equities which (I¡¯m sure) would be much higher quality ¨C if enough people contact him it might nudge him into actioning the project.]

?

Dave

?

From: [email protected] <[email protected]> On Behalf Of John
Sent: Thursday, 8 December 2022 10:57 PM
To: [email protected]
Subject: [TWS API] 1min historical data availability

?

Hello,

From the TWS documentation:

The other historical data limitations listed are general limitations for all trading platforms:
Bars whose size is 30 seconds or less?older than six months

However, I tried to source 1 min bars historically backwards from today,
and got only up to August 9th (~4 months) on EUR.CAD and EUR.AUD then faced the issue below; why?

Note I am able to source? beyond that date on other contracts like EUR.NZD with the same code.

Thanks!

reqHistoricalData(request.reqId, contract, end, '1 D', '1 min', 'BID', 1, 2, False, [])

?

request_historical_bars EUR CAD 20220809 22:23:00 UTC

request_historical_bars EUR AUD 20220809 22:23:00 UTC

...

ERROR 7 162 Historical Market Data Service error message:HMDS query returned no data: EUR.CAD@IDEALPRO Bid

Error. Id: 7 Code: 162 Msg: Historical Market Data Service error message:HMDS query returned no data: EUR.CAD@IDEALPRO Bid

ERROR 8 162 Historical Market Data Service error message:HMDS query returned no data: EUR.AUD@IDEALPRO Bid

Error. Id: 8 Code: 162 Msg: Historical Market Data Service error message:HMDS query returned no data: EUR.AUD@IDEALPRO Bid


Getting "Last" in historical futures data

Anders
 

Hi,

I've been looking to download historical futures data. I really want the "Close' field to be the last traded price and not the settlement price. However, I've just noticed this in the :

The daily bar size has several unique characteristics. This is true both in TWS and the API:

  • For futures, the close price of daily bars can be the settlement price if provided by the exchange.
Does anyone know if it's possible to specify that I want last traded price rather than settlement price? I'm pretty sure the answer is "no" but I just want to confirm.

Anders.


Re: 2 Factor Authentication Mandatory for Trading Now?

 

¿ªÔÆÌåÓý

Why don¡¯t you join the IBC User Group /g/ibcalpha, and then you¡¯d get up-to-date information on this and other topics.

?

And you¡¯d know that yes, IBC works perfectly with IB Key 2FA.

?

You don¡¯t mention which version of IBC you¡¯re using, but the best strategy is to upgrade to the latest 3.15.1.

?

Richard

?

?

?

From: [email protected] <[email protected]> On Behalf Of impcharts@...
Sent: 16 December 2022 04:15
To: [email protected]
Subject: [TWS API] 2 Factor Authentication Mandatory for Trading Now?

?

Since the start of this week, when I log on to TWS/IB Gateway, it always prompt for IB Key authentication, which makes IBC not working.
I called IB and they said that it's now mandatory even for trading.

Any work around for this? Is IBC is till a viable solution for auto log in?
Thanks.


Re: Can I get the dividend history of an ETF through API?

 

In case it helps someone, I was able to get the dividend history of AAPL using reqFundamentalData with reportType = "ReportsFinSummary" presumably this will work for ETFs as well.


2 Factor Authentication Mandatory for Trading Now?

 

Since the start of this week, when I log on to TWS/IB Gateway, it always prompt for IB Key authentication, which makes IBC not working.
I called IB and they said that it's now mandatory even for trading.

Any work around for this? Is IBC is till a viable solution for auto log in?
Thanks.


Re: Yikes smart exchange is not smart

 

"I was mistakenly under the impression that if I create a SMART sell order that it would fill at the best price"

Reg NMS is not required pre-market but it would be interesting what IB has to say about this.? I always assumed they'd route to the best price anyway.? Can? you provide the relevant data showing that they did not?


Re: Re-login failures with TWS auto-restart option.

 

Hi,
had to deal with this strange feature, too.

Recently discovered, that IBC provides a ?Solution?:

After changing
`ExistingSessionDetectedAction=primary`
the TWS seems to restart? seamless.

³Ò°ù¨¹?±ð

Hartmut Bischoff



Re: Yikes smart exchange is not smart

 

"... But I am probably the only person doing small cap."

Most probably not, but may I suggest to use Level II analysis to educate lot prices/volumes and dispersion of buyers/salers (kind of muti-factors spread) just less an issue on big cap (but still)
For that level II is a very valuable tool.