开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

How to programatically approve a transaction: Security is under Surveillance


 

Hi all,

Sorry about the poor subject line.

I am trying to buy a stock and am getting the following error in my logs.
56989180,SRF,STK,,,0,,,NSE,NSE,INR,SRF,SRF,False,,,,combo:
eason:Security is under Surveillance Measure - The scrip PE is greater than
50 for the previous 4 trailing quarters.<br><br><br>Would you like to
continue?.
{"rejects":[{"buttons":[{"options":[{"fixstr":"8229=SURVEILLANCE","text":"Ye
s, transmit the order."}],"style":"chk"}],"id":29,"text":"Security is under
Surveillance Measure &ndash; The scrip PE is greater than 50 for the
previous 4 trailing quarters. <br><br>Would you like to
continue?","textsep":"125"}],"version":"1.0"}

How do I get around this? Is the answer to use the advancedErrorOverride
property of the order object? If yes, what do I enter as its value?

Pranav


 

Welcome Pranav!

I'd check that the option API -> Settings -> "Show advanced order reject UI always" is unchecked.

Also, select all bypass options you are comfortable with in API -> Precautions.

And your thought about the advancedErrorOverride field of the Order class may help. The documentation says that "advancedErrorOverride accepts a comma-separated list with parameters containing error tags. This list will override the mentioned errors and proceed with the order placement". From your log it sounds like you could try setting the field to "8229".

闯ü谤驳别苍

?

?

?
On Wed, Mar 26, 2025 at 10:09 AM, Pranav Lal wrote:

Hi all,

Sorry about the poor subject line.

I am trying to buy a stock and am getting the following error in my logs.
56989180,SRF,STK,,,0,,,NSE,NSE,INR,SRF,SRF,False,,,,combo:
eason:Security is under Surveillance Measure - The scrip PE is greater than
50 for the previous 4 trailing quarters.<br><br><br>Would you like to
continue?.
{"rejects":[{"buttons":[{"options":[{"fixstr":"8229=SURVEILLANCE","text":"Ye
s, transmit the order."}],"style":"chk"}],"id":29,"text":"Security is under
Surveillance Measure &ndash; The scrip PE is greater than 50 for the
previous 4 trailing quarters. <br><br>Would you like to
continue?","textsep":"125"}],"version":"1.0"}

How do I get around this? Is the answer to use the advancedErrorOverride
property of the order object? If yes, what do I enter as its value?

Pranav


 

开云体育

Hi 闯ü谤驳别苍,

Thanks for the welcome. <smile

?

I made the changes but no go.

Here is the log output.

ERROR -1 1743033608079 2104 Market data farm connection is OK:hfarm

ERROR -1 1743033608080 2107 HMDS data farm connection is inactive but should be available upon demand.apachmds

ERROR -1 1743033608080 2158 Sec-def data farm connection is OK:secdefhk

56989180,SRF,STK,,,0,,,NSE,NSE,INR,SRF,SRF,False,,,,combo:

eason:Security is under Surveillance Measure - The scrip PE is greater than 50 for the previous 4 trailing quarters.<br><br><br>Would you like to continue?. {"rejects":[{"buttons":[{"options":[{"fixstr":"8229=SURVEILLANCE","text":"Yes, transmit the order."}],"style":"chk"}],"id":2,"text":"Security is under Surveillance Measure &ndash; The scrip PE is greater than 50 for the previous 4 trailing quarters. <br><br>Would you like to continue?","textsep":"125"}],"version":"1.0"}

?

<snip I'd check that the option API -> Settings -> "Show advanced order reject UI always" is unchecked.

PL] Is there a configuration file where I can check this value?

?

I use a screen reader and given that TWS uses its own jvm, the screen reader is unable to talk to java unless I can put the java access bridge into the jvm.

?

Pranav


 

开云体育

Hi all,

?

Problem solved. I had to use a key value pair when specifying the string in the advancedErrorOverride property.

advancedErrorOverride="8229,SURVEILLANCE"

?

Pranav


 

Glad that worked, Pranav, and thank you for sharing the solution.

You asked about files where you can read TWS/IBGW settings from. Each account folder under the TWS/IBGW installation folder (the random looking folder names with 40 lower case characters) contains a file called tws.xml (for TWS), ibg.xml (for IB Gateway), or both depending on what you used for login. Those files contain all configuration and layout information. There are also daily backup copies such as tws.Wed.xml.

Unfortunately, those files are encrypted and, in order to decrypt them, you'd have to log into TWS/IBGW:

  • In TWS you'd go to "File" -> "Layout Settings" -> "Save Decrypted Settings As". A window will pop up that warns about the fact that the file may contain personal information. The window asks whether you want to continue and has a Yes (left) and No (right) button. In case you select Yes, a file selector window opens where you can select the folder and file names for the decrypted information.
  • In IBGW you'd go to "File" -> "Gateway/Layout Settings" and a text window with the decrypted XML content comes up. The window has three buttons called (from left to right) "Copy to Clipboard"m "Export Settings", and "Close".

The XML documents are length and have sections for many different layout and operational settings. Among them sections for API "Settings", "Precautions", and "News Configuration".

I always wanted to make some tools to automate the monitoring and changing of TWS/IBGW configurations as well as TWS tabs so that I can guarantee consistency between multiple accounts. Reading and updating the XML files once decrypted is not that hard, but the decryption and recovery steps have to be done manually at this point (as far as i know).

闯ü谤驳别苍

?

?

?

On Thu, Mar 27, 2025 at 11:40 AM, Pranav Lal wrote:

Hi all,

?

Problem solved. I had to use a key value pair when specifying the string in the advancedErrorOverride property.

advancedErrorOverride="8229,SURVEILLANCE"

?

Pranav