¿ªÔÆÌåÓý

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

orderReference missing in flex reports


James Smith
 

I set order reference through the API. It is visible in the JClient in
Portfolio in Order Ref. column. It is also visible in Trade Log in the
column Order Ref. But it is missing in Flex Reports. The column Order
Reference is empty for Level of Detail set to Orders, or filled with
"--" for Level of Detail set to Execution. How to overcome this?


 

If you put the "level of detail" at "executions" in the "trades" part, and add "order reference", you should be able to find "Order references" you need in the Flex reports.


Happy New Year for all API users!


James Smith
 

On 01/01/2016 10:53 AM, James Smith james.smith@... [TWSAPI]
wrote:
I set order reference through the API. It is visible in the JClient in
Portfolio in Order Ref. column. It is also visible in Trade Log in the
column Order Ref. But it is missing in Flex Reports. The column Order
Reference is empty for Level of Detail set to Orders, or filled with
"--" for Level of Detail set to Execution. How to overcome this?
On 01/01/2016 12:50 PM, lcrouzet42@... [TWSAPI] wrote:


If you put the "level of detail" at "executions" in the "trades" part,
and add "order reference", you should be able to find "Order references"
you need in the Flex reports.

Thanks for response, but I asked for something different. I do have
Order reference column in a flex report, but with empty values.

I have found only one similar post. As I understand IB clears some data
including order reference for Flex Reports at midnight.

From Davqe drosen@...
"I am using the OrderReference field to store values for the strategies.
I have created a Flex Report for Trade Confirms that I run at the end of
each day to download the Trades with the Order Reference field
populated. (apparently they haven't found a way to keep that field for
more than a day). But, if I have trades after 5:30pm on Day 1, they are
part of the report that gets run at the end of Day 2 (basically doing it
as session days as opposed to calendar days). This is the behavior I
would expect and want. Except, the orders placed on the previous
calendar day (but part of the current session day) don't maintain the
Order Reference information in the Flex Reports. I verified this with IB
Support. It appears for some reason they reset that value around
midnight in some portion of their system that is read for Flex Reports,
though it is kept in the Trade Log I see in TWS from previous days.

I like the Flex Report because I can easily automate without having to
create a new application to extract information via the API.

Anyone have insight into how they are tracking the information they
wouldn't mind sharing?"


 

I have the same issue. I am on my paper account and the orderReference comes empty.

Any idea why ?


<Order accountId="DU1549207" acctAlias="" model="" currency="USD" assetCategory="STK" symbol="XLNX" description="XILINX INC" conid="276222" securityID="US9839191015" securityIDType="ISIN" cusip="983919101" isin="US9839191015" listingExchange="NASDAQ" underlyingConid="" underlyingSymbol="" underlyingSecurityID="" underlyingListingExchange="" issuer="" multiplier="1" strike="" expiry="" putCall="" principalAdjustFactor="" transactionType="" tradeID="" orderID="295174965" execID="" brokerageOrderID="" orderReference="" volatilityOrderLink="" clearingFirmID="" origTradePrice="" origTradeDate="" origTradeID="" orderTime="20200131;145705" dateTime="20200131;145705" reportDate="20200131" settleDate="20200204" tradeDate="" exchange="" buySell="BUY" quantity="1" price="85.61" amount="85.61" proceeds="-85.61" commission="-0.8591" brokerExecutionCommission="" brokerClearingCommission="" thirdPartyExecutionCommission="" thirdPartyClearingCommission="" thirdPartyRegulatoryCommission="" otherCommission="" commissionCurrency="USD" tax="0" code="" orderType="LMT" levelOfDetail="ORDER" traderID="" isAPIOrder="" allocatedTo="" accruedInt="0" rfqID="" />


 

Flex on paper accounts is very um... patchy (in my experience anyway)

M


On Sat, 1 Feb 2020 at 09:58, Dragos Durlut <dragos.durlut@...> wrote:
I have the same issue. I am on my paper account and the orderReference comes empty.

Any idea why ?


<Order accountId="DU1549207" acctAlias="" model="" currency="USD" assetCategory="STK" symbol="XLNX" description="XILINX INC" conid="276222" securityID="US9839191015" securityIDType="ISIN" cusip="983919101" isin="US9839191015" listingExchange="NASDAQ" underlyingConid="" underlyingSymbol="" underlyingSecurityID="" underlyingListingExchange="" issuer="" multiplier="1" strike="" expiry="" putCall="" principalAdjustFactor="" transactionType="" tradeID="" orderID="295174965" execID="" brokerageOrderID="" orderReference="" volatilityOrderLink="" clearingFirmID="" origTradePrice="" origTradeDate="" origTradeID="" orderTime="20200131;145705" dateTime="20200131;145705" reportDate="20200131" settleDate="20200204" tradeDate="" exchange="" buySell="BUY" quantity="1" price="85.61" amount="85.61" proceeds="-85.61" commission="-0.8591" brokerExecutionCommission="" brokerClearingCommission="" thirdPartyExecutionCommission="" thirdPartyClearingCommission="" thirdPartyRegulatoryCommission="" otherCommission="" commissionCurrency="USD" tax="0" code="" orderType="LMT" levelOfDetail="ORDER" traderID="" isAPIOrder="" allocatedTo="" accruedInt="0" rfqID="" />



--
(T) +44 (0) 131 2202413 ?? (M) +44 (0) 7528 551604 ? (W)
Gulfstream Software - Winner Risk Management Awards 2010
This message is subject to :


 

I also have a live account with some spare change.

?

I will try to also run it there. Maybe i'll see a difference.


 

I ran into this in Feb 2019 on a live account and was told by IB that it ¡®operates as designed¡¯, meaning OrderRef in a FlexQuery will always be blank.? This is obviously odd since it is available as a selection in the report setup.

?

A workaround is to log all order and execution messages to a database at runtime, both of which contain any OrderRef value included when placing the order.? Also logged is the unique PermId for every order, which is the key you can use for linking orders, order legs, and executions for any reporting based on OrderRef.

?

Incidentally, if you are using TWS and set ¡®Show trades for:¡¯ to ¡®Last 7 Days¡¯ before you connect the API, the initial execution messages received after API connection will include the OrderRef.? So basically, TWS has visibility to OrderRef, but they are dropped at IB before they can make it into a FlexQuery.


 

Order Ref is available in flex reports for the last single trading day. One way to retrieve it regularly is to set up an email subscription.


 

On Sun, Feb 2, 2020 at 10:43 AM, ds-avatar wrote:
Order Ref is available in flex reports for the last single trading day. One way to retrieve it regularly is to set up an email subscription.
Thank you for that clarification.? I was running into problems trying to get OrderRef out of flex reports for prior periods.


 

That is a very good idea.?

Regarding getting data at runtime, I am already doing that.?

Is wanted a failsafe for the app crashing for more than a couple of days.?