¿ªÔÆÌåÓý

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

Re: Flex Queries: Order Reference always empty

 

OrderRef will be in reports only for the most recent session. Workaround: configure the system to send daily reports by mail, then collect and collate them.


Re: Paper Trading with MKT orders

 

I would strongly recommend that you record the pricing that IB believes is available at the time, it will tell you whether it is a data issue or a simulated trade issue. At least if the data lines up you know where to focus, if it does not, well, you have your answer?

Best wishes,

M

On Wed, 10 Mar 2021, 20:59 kris k, <kaykay.krish8@...> wrote:
Thanks Mark. I do account for timing differences in my backtest (i.e I assume there is a time delta between when my model signal is generated and when the orders are actually placed. So in backtest, I look for the price traded at that specific time and evaluate model performance). I even assume worst?of bid/ask at that time.? But IB paper trading ends up far worse

On Wed, Mar 10, 2021 at 12:42 PM mark collins <mark.collins@...> wrote:
To really understand this you'll need to account for possible differences in the exchanges, as well as the timing differences. Lastly you need to know that paper trades in the IB system are approximated, you may find real money trades differently.

As a start I would want to validate that the prices reported are possibly tradable at the times reported in both places.

Best wishes,


M

On Wed, 10 Mar 2021, 20:10 , <kaykay.krish8@...> wrote:
Hello

Can anyone tell me how the IBKR paper trading via APIs is simulated ? This is how I am testing my system. I have a 3rd party tick data that I consume and build my predictions real-time (so I am not using any of the data feed from IBKR). When I place MKT order, is IB paper trading going to assume top of the bid/ask or is this last trade price or something else. I am not able to find any details on this. I would be grateful if anyone provide pointers.? When I compare my model performance after end of day using 3rd party tick data, I find the paper trading account and my own backtest significantly differs (I do account for slippage in time for my model computation and when the trade actually get placed)

Thanks
kris


Re: Paper Trading with MKT orders

 

Thanks Mark. I do account for timing differences in my backtest (i.e I assume there is a time delta between when my model signal is generated and when the orders are actually placed. So in backtest, I look for the price traded at that specific time and evaluate model performance). I even assume worst?of bid/ask at that time.? But IB paper trading ends up far worse

On Wed, Mar 10, 2021 at 12:42 PM mark collins <mark.collins@...> wrote:
To really understand this you'll need to account for possible differences in the exchanges, as well as the timing differences. Lastly you need to know that paper trades in the IB system are approximated, you may find real money trades differently.

As a start I would want to validate that the prices reported are possibly tradable at the times reported in both places.

Best wishes,


M

On Wed, 10 Mar 2021, 20:10 , <kaykay.krish8@...> wrote:
Hello

Can anyone tell me how the IBKR paper trading via APIs is simulated ? This is how I am testing my system. I have a 3rd party tick data that I consume and build my predictions real-time (so I am not using any of the data feed from IBKR). When I place MKT order, is IB paper trading going to assume top of the bid/ask or is this last trade price or something else. I am not able to find any details on this. I would be grateful if anyone provide pointers.? When I compare my model performance after end of day using 3rd party tick data, I find the paper trading account and my own backtest significantly differs (I do account for slippage in time for my model computation and when the trade actually get placed)

Thanks
kris


Flex Queries: Order Reference always empty

corneliu maftuleac
 

I am using orderRef field of an order to mark an order as it belongs to a specific strategy.
However when using flex queries to retrieve the list of orders the OrderReference field is always empty.

As specified on the docs: The order reference number as defined by the user on the order ticket.?

Any ideas how to retrieve order reference?


Re: Paper Trading with MKT orders

 

To really understand this you'll need to account for possible differences in the exchanges, as well as the timing differences. Lastly you need to know that paper trades in the IB system are approximated, you may find real money trades differently.

As a start I would want to validate that the prices reported are possibly tradable at the times reported in both places.

Best wishes,


M


On Wed, 10 Mar 2021, 20:10 , <kaykay.krish8@...> wrote:
Hello

Can anyone tell me how the IBKR paper trading via APIs is simulated ? This is how I am testing my system. I have a 3rd party tick data that I consume and build my predictions real-time (so I am not using any of the data feed from IBKR). When I place MKT order, is IB paper trading going to assume top of the bid/ask or is this last trade price or something else. I am not able to find any details on this. I would be grateful if anyone provide pointers.? When I compare my model performance after end of day using 3rd party tick data, I find the paper trading account and my own backtest significantly differs (I do account for slippage in time for my model computation and when the trade actually get placed)

Thanks
kris


Paper Trading with MKT orders

 

Hello

Can anyone tell me how the IBKR paper trading via APIs is simulated ? This is how I am testing my system. I have a 3rd party tick data that I consume and build my predictions real-time (so I am not using any of the data feed from IBKR). When I place MKT order, is IB paper trading going to assume top of the bid/ask or is this last trade price or something else. I am not able to find any details on this. I would be grateful if anyone provide pointers.? When I compare my model performance after end of day using 3rd party tick data, I find the paper trading account and my own backtest significantly differs (I do account for slippage in time for my model computation and when the trade actually get placed)

Thanks
kris


Multiple connections and multiple accounts

 

I have a few accounts under a Friends? and Family umbrella account which
I trade using multiple python based models.?? I had been successfully
trading two models against one of the accounts, but when I added another
model trading against a second account I ran into a problem with
account? and position updates.? I should point out that each model is
independent, requesting it's own data subscriptions and placing it's own
trades.

I had been using reqAccountUpdates() to automatically update account
values and portfolio stats.? That failed when I added the second account
because reqAccountUpdates can only be subscribed to a single account at
a time even across multiple connections.? I shifted to using
reqAccountUpdatesMulti() combined with reqPositionsMulti() in all models
and this seems to work.? The potential weakness is that one looses the
AccountReady flag with this option.

I'm wondering if I am missing something that is obvious to the veterans
on the list.? Or, a better question might be, what are others doing in
this regard?? Are you tracking account balances and position sizes
within your code rather than using api requests?? I do that in some
cases for position size but typically like to access cash balances from
the api.

While I'm asking questions let me ask one about data subscription
lines.? If hypothetically each of my three models is subscribing to the
same 10 symbols is that 10 data lines or 30?

Thanks for your thoughts,

Hugh


Re: tickeByTickData or Depth Level 2 does not work when using ISIN instead of conID or symbol

 

Thanks for checking this.

Your example works for contract details but have you seen this working for market depth level 2 or level 1 as well which is the case I am asking about?

Side note: Will download this tool. Are there other tools like this as well that you know of?

Thanks,


On Tue, Mar 9, 2021, 5:17 PM JR <TwsApiOnGroupsIo@...> wrote:
Maybe you want to check your setup, Bruce. The ISIN example contract lookup example works just fine in Richards amazing Contract Inspector.



On Tue, Mar 9, 2021 at 03:53 PM, Bruce B wrote:
Thanks Stew. Noted your tip about why conID might give faster response.
?
The error I get you think is because I didn't input contract ID or symbol like it says? If so then:
A) Why does the sample file not include it?
B) What is the point of adding ISIN if it still need conID or symbol like the error says?

Code: 321
, Msg: Error validating request.-'b0' : cause - The symbol or the local-symbol or the security id must be entered
?
This is from Contract samples.java which exists in cpp++ samples too:
?
public static Contract ByISIN() {
Contract contract = new Contract();
contract.secIdType("ISIN");
contract.secId("US45841N1072");
contract.secType("STK");
contract.currency("USD");
contract.exchange("SMART");
return contract;
}
?
Anyone else knows why I get the error? Maybe ISIN use is limited to orders only and can't be used with market data subscriptions?
?
Thanks,
?

On Fri, Mar 5, 2021, 2:32 PM Stewie D <sdouglas@...> wrote:
Hey Bruce

Answering your questions, I believe MD subs will be Market Data subscriptions.
Using conID instead of other symbols will be faster and more reliable - conID is the identifier that IB will use internally in their system for a given contract, so using this guarantees you will get results for the correct instrument and will avoid IB having to do additional lookups. Some queries may only work with the contract ID. I've been away from the API for a while so may be out of date, but I don't think things have changed drastically in this regard.

Cheers

Stew

On 05/03/2021 16:11, Bruce B wrote:
Hi Peter,

Thanks for the feedback.

What is MD subs?

I am using conID and it works well. What is the reasons for *always using conID instead of ISIN or Symbol for example?

- Bruce

-- 
Stewart Douglas
sdouglas@...

?

?


automated RTD download completion detection

 

Does anyone know how to make a routine that determines when all the RTD cells have been updated?.? That way the next procedure can detect it and run based on the data.? I currently have to wait and manually look to see when I think the cells have been updated but it seems like there should be some automated way of doing it.? The problem I have with automating it is that RTD won't update while I'm running the routine to download and check it.? Also, if I tell the system to wait, RTDs doesn't update during the wait or even if I put in a DoEvents command.


Re: tickeByTickData or Depth Level 2 does not work when using ISIN instead of conID or symbol

 

Maybe you want to check your setup, Bruce. The ISIN example contract lookup example works just fine in Richards amazing Contract Inspector.



On Tue, Mar 9, 2021 at 03:53 PM, Bruce B wrote:
Thanks Stew. Noted your tip about why conID might give faster response.
?
The error I get you think is because I didn't input contract ID or symbol like it says? If so then:
A) Why does the sample file not include it?
B) What is the point of adding ISIN if it still need conID or symbol like the error says?

Code: 321
, Msg: Error validating request.-'b0' : cause - The symbol or the local-symbol or the security id must be entered
?
This is from Contract samples.java which exists in cpp++ samples too:
?
public static Contract ByISIN() {
Contract contract = new Contract();
contract.secIdType("ISIN");
contract.secId("US45841N1072");
contract.secType("STK");
contract.currency("USD");
contract.exchange("SMART");
return contract;
}
?
Anyone else knows why I get the error? Maybe ISIN use is limited to orders only and can't be used with market data subscriptions?
?
Thanks,
?

On Fri, Mar 5, 2021, 2:32 PM Stewie D <sdouglas@...> wrote:
Hey Bruce

Answering your questions, I believe MD subs will be Market Data subscriptions.
Using conID instead of other symbols will be faster and more reliable - conID is the identifier that IB will use internally in their system for a given contract, so using this guarantees you will get results for the correct instrument and will avoid IB having to do additional lookups. Some queries may only work with the contract ID. I've been away from the API for a while so may be out of date, but I don't think things have changed drastically in this regard.

Cheers

Stew

On 05/03/2021 16:11, Bruce B wrote:
Hi Peter,

Thanks for the feedback.

What is MD subs?

I am using conID and it works well. What is the reasons for *always using conID instead of ISIN or Symbol for example?

- Bruce

-- 
Stewart Douglas
sdouglas@...

?

?


Re: tickeByTickData or Depth Level 2 does not work when using ISIN instead of conID or symbol

 

Thanks Stew. Noted your tip about why conID might give faster response.

The error I get you think is because I didn't input contract ID or symbol like it says? If so then:
A) Why does the sample file not include it?
B) What is the point of adding ISIN if it still need conID or symbol like the error says?

Code: 321
, Msg: Error validating request.-'b0' : cause - The symbol or the local-symbol or the security id must be entered
?
This is from Contract samples.java which exists in cpp++ samples too:

public static Contract ByISIN() {
Contract contract = new Contract();
contract.secIdType("ISIN");
contract.secId("US45841N1072");
contract.secType("STK");
contract.currency("USD");
contract.exchange("SMART");
return contract;
}

Anyone else knows why I get the error? Maybe ISIN use is limited to orders only and can't be used with market data subscriptions?

Thanks,


On Fri, Mar 5, 2021, 2:32 PM Stewie D <sdouglas@...> wrote:
Hey Bruce

Answering your questions, I believe MD subs will be Market Data subscriptions.
Using conID instead of other symbols will be faster and more reliable - conID is the identifier that IB will use internally in their system for a given contract, so using this guarantees you will get results for the correct instrument and will avoid IB having to do additional lookups. Some queries may only work with the contract ID. I've been away from the API for a while so may be out of date, but I don't think things have changed drastically in this regard.

Cheers

Stew

On 05/03/2021 16:11, Bruce B wrote:
Hi Peter,

Thanks for the feedback.

What is MD subs?

I am using conID and it works well. What is the reasons for *always using conID instead of ISIN or Symbol for example?

- Bruce

-- 
Stewart Douglas
sdouglas@...


Is it possible to get Book Depth Level 2 from historical data?

 

Hi,

Is it possible to get "Book Depth Level 2" detail levels from Historical Data requests? In streaming data this comes from these requests:




I am wondering what the equivalent is in Historical Data. If this is not available, what is the highest detail possible to get from Historical Data and which function provides this?

Thanks,


reqHeadTimeStamp Duplicate Query Error

 

My script requests the head timestamp of 200 contracts to query data.? I have been having a few issues:

  1. I will be able to pull 100 ish values then I get a 162 error saying "request has timed out".? Even if I cancel the request and resubmit, I still get this error.??
  2. I occasionally get a "duplicate query" error.? Even when I run the below code, which cancels the reqid and sleeps for good measure before placing a new one, I still get this error.
self.cancelHeadTimeStamp(reqid)
time.sleep(1)
self.reqHeadTimeStamp(reqid, contract, "BID", True, 1)
Is there any clarity into what these errors exactly mean?? Am I being throttled?? Sometimes the script works perfectly, and other times it gets held up.

Mike


Error validating request.-'bO': cause - Invalid order type was entered

 

Hi, may I ask why there will be such an error message? I have checked my codes and it seems like there is nothing wrong there in the order part. Thank you very much.




Re: Projected Earnings Date with RTD or DDE

 

Thanks, that awesome.? Very simple data set so it should be easy and quick to download.? ?I'm not sure why IB doesn't just make it a simple RTD or DDE Ticker.? Fortunately I focus on the CBOE stock with weekly options so this should help me allot until I figure out how to get this from IB.


Re: Projected Earnings Date with RTD or DDE

Stuart Cracraft
 

I don¡¯t know how in IB but you can find it for a set of stocks at:



I plan to have it scan for all 20,000+ stocks I track but right now it¡¯s just tracking a dynamically updated list from the cboe.com which are the stocks with weekly options.

The change is trivial to make.

On Mar 8, 2021, at 7:05 AM, thurman.aerospace@... wrote:

Does anyone know how to pull the projected earnings date using either RTD or DDE?


Projected Earnings Date with RTD or DDE

 

Does anyone know how to pull the projected earnings date using either RTD or DDE?


How to really do MOO orders?

 

I posted a similar question on the ib_insync list last week, but didn't get any response.

This issue is for paper trading of equities on the LSE.

I am trying to place "market on open" orders based on the order types described in?. I have tried placing orders for the opening auction, and "market" orders on the open. This is for both main market and aim listed stocks. This is what I have found:

contract.exchange = "SMART"
order.orderType="MTL"
order.tif="AUC"

Contracts?traded on the LSE only appear to go through. These appear to be mainly AIM stocks. Contracts traded on LSE?plus BATEUK, CHIXUK, TRQUK etc. don't go through. Those orders that?do go through don't appear to achieve the opening price as reported by Yahoo & LSE.

Routing to the exchange directly by setting:

contract.exchange=contract.primaryExchange

with the order settings as above results in the error message:

'Error 10052, reqId 967: Invalid time in force:AUC'

(Opening exchange orders?are supported by LSE, as reported at?.)

Trying:

order.orderType="MKT"
order.tif = "OPG"

with either contract.exchange="SMART"?or contract.exchange=contract.primaryExchange results in all the orders being cancelled with the error message

'Error 10052, reqId 1351: Invalid time in force:OPG'

Leaving aside the topic of whether it is sensible to place market on open orders due to lack of liquidity, has anyone had any success achieving the opening price?

Thanks.




Re: CAC40 option chains reqSecDefOptParams

 

That's indeed a very good answer. I didn't know about Europe Index options, even though we only trade CAC40 FUTURE, DAX Future,...
I thought CAC40 options were those of the futures, not of the index.
Now, reqSecDefOptParams (Idreq, "CAC40", "", "IND", 946200)? works fine ! Beware NOT to mention MONEP for 3rd parameter, and leave it blank. This was my mistake also.
And reqContractDetails returns CAC40 option chains, when passing CAC40 Index as parameter.
Thanks a lot!
Francois


Re: How to retrieve current bid/ask for a combo order?

 

I'm trading stock options for US stocks and yes, I receive both bid and ask (tick 1 and 2). So I subscribe to all stocks that are part of the spread in question and once I have received all bids and asks I can calculate the bid/ask for the combo.