开云体育

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

Invalid symbols


szeyu73
 

hello.

i found some problem in placing invalid symbols. for example, if i
place an order to BUY 100 shares of XYZ, which is not valid.

the TWS API won't tell my program thru the API (such as ErrMsg and
OrderStatus), but just make a popup in the Trader Workstation
program. hence i have no no way to know that the symbol is invalid.

my solution is to keep a list of avaliable symbols. i'll check if the
symbol is in the list before placing the order.

it works, but i have to update the list from time to time. is there
any better solutions?

thanks

---
dustin


bee_jay_61
 

I don?t have this problem but maybe you can do this:

When you place an order with an order id 12345 and an invalid symbol
(ex. "XYZ") than you get no error message and NO ORDERSTATUS. So if
you don?t get an ORDERSTATUS for the order id 12345 within a certain
time, try to cancel that order with order id 12345. Normally than you
will get an error message "Can't find order with id 12345". This
could be an indicator that the symbol was invalid.

Or another way that could help you:

Call ReqMktData for that symbol. If the symbol does not exist you
will get an error message like "Security definition request returned
0 items for ticker id 123". Check the error message for that text.
That?s what I do when I call ReqMktData.

Greetings from Germany

BeeJay


--- In twsapi@y..., szeyu73 <no_reply@y...> wrote:
hello.

i found some problem in placing invalid symbols. for example, if i
place an order to BUY 100 shares of XYZ, which is not valid.

the TWS API won't tell my program thru the API (such as ErrMsg and
OrderStatus), but just make a popup in the Trader Workstation
program. hence i have no no way to know that the symbol is invalid.

my solution is to keep a list of avaliable symbols. i'll check if
the
symbol is in the list before placing the order.

it works, but i have to update the list from time to time. is there
any better solutions?

thanks

---
dustin


szeyu73
 

thanks BeeJay.

it seems that your first method will work and i may change to your
algorithm later.

the second one will work at the beginning. but i think there is a
limit of 40 symbols in reqMktData, as i read in other threads here.
it may fail some time later.

i'd suggest IB to raise an ErrMsg in this case.

thanks very much again from hong kong

---
dustin

--- In twsapi@y..., bee_jay_61 <no_reply@y...> wrote:
I don?t have this problem but maybe you can do this:

When you place an order with an order id 12345 and an invalid
symbol
(ex. "XYZ") than you get no error message and NO ORDERSTATUS. So if
you don?t get an ORDERSTATUS for the order id 12345 within a
certain
time, try to cancel that order with order id 12345. Normally than
you
will get an error message "Can't find order with id 12345". This
could be an indicator that the symbol was invalid.

Or another way that could help you:

Call ReqMktData for that symbol. If the symbol does not exist you
will get an error message like "Security definition request
returned
0 items for ticker id 123". Check the error message for that text.
That?s what I do when I call ReqMktData.

Greetings from Germany

BeeJay


--- In twsapi@y..., szeyu73 <no_reply@y...> wrote:
hello.

i found some problem in placing invalid symbols. for example, if
i
place an order to BUY 100 shares of XYZ, which is not valid.

the TWS API won't tell my program thru the API (such as ErrMsg
and
OrderStatus), but just make a popup in the Trader Workstation
program. hence i have no no way to know that the symbol is
invalid.

my solution is to keep a list of avaliable symbols. i'll check if
the
symbol is in the list before placing the order.

it works, but i have to update the list from time to time. is
there
any better solutions?

thanks

---
dustin


bee_jay_61
 

Maybe the second method works too. I never used 40 or more symbols in
ReqMktData so I don?t know what kind of error message will appear if
the TWS checks for 40 symbols.

But maybe the TWS checks first for an invalid symbol regardless how
many symbols are in ReqMktData. Than it should allways work. You have
to try it out.

This method is easier than the first one.

BeeJay



--- In twsapi@y..., szeyu73 <no_reply@y...> wrote:
thanks BeeJay.

it seems that your first method will work and i may change to your
algorithm later.

the second one will work at the beginning. but i think there is a
limit of 40 symbols in reqMktData, as i read in other threads here.
it may fail some time later.

i'd suggest IB to raise an ErrMsg in this case.

thanks very much again from hong kong

---
dustin

--- In twsapi@y..., bee_jay_61 <no_reply@y...> wrote:
I don?t have this problem but maybe you can do this:

When you place an order with an order id 12345 and an invalid
symbol
(ex. "XYZ") than you get no error message and NO ORDERSTATUS. So
if
you don?t get an ORDERSTATUS for the order id 12345 within a
certain
time, try to cancel that order with order id 12345. Normally than
you
will get an error message "Can't find order with id 12345". This
could be an indicator that the symbol was invalid.

Or another way that could help you:

Call ReqMktData for that symbol. If the symbol does not exist you
will get an error message like "Security definition request
returned
0 items for ticker id 123". Check the error message for that
text.
That?s what I do when I call ReqMktData.

Greetings from Germany

BeeJay


--- In twsapi@y..., szeyu73 <no_reply@y...> wrote:
hello.

i found some problem in placing invalid symbols. for example,
if
i
place an order to BUY 100 shares of XYZ, which is not valid.

the TWS API won't tell my program thru the API (such as ErrMsg
and
OrderStatus), but just make a popup in the Trader Workstation
program. hence i have no no way to know that the symbol is
invalid.

my solution is to keep a list of avaliable symbols. i'll check
if
the
symbol is in the list before placing the order.

it works, but i have to update the list from time to time. is
there
any better solutions?

thanks

---
dustin