开云体育

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

Re: Submit orders to TWS via API


 

Hi Bruce,

many thanks for your reply

please see response?inline

On Thu, May 6, 2021 at 1:30 AM Bruce B <bruceb444@...> wrote:
Ed,

Here is the key line from you:

"However when connected to live mode it does not execute successfully"?

If you detail what you mean by "successfully" your problem will be solved. This is a general term. You didn't say if you are getting an error OR not. And if Yes, what is the error?
>>>I am connected to TWS and get a confirmation message... but when the order is placed there is no confirmation from TWS of success or failure...? ?no messages....but will check logs as suggested
i am also catching all exception with following code..? ?this may be preventing any messages from tws... will check again
?except: # catch *all* exceptions
? ? ? ? #e = sys.exc_info()[0]
? ? ? ? #print( "<p>Error: %s</p>" % e )
? ? ? ? print (file=sys.stderr)?



If you are not getting an error in your callback, check API logs in TWS.
>>>will do
?

If this works in demo, it should work in love too.
>>>i agree...? and the single execution version works live as well... however that is not useful for me as i need the program to run independently in the background
?

Mostly, this issue comes back to IDs. Reset ID in TWS helps.
>>>?i did reset the ID to 1...? ?the latest ID is always captured before order is placed... which removes the potential for that issue?

Also, sometimes you need to turn API settings OFF and ON for connection. Maybe it misbehaves with binding to ports.
>>>not sure what you mean by turning API settings off/on...pls explain

Thanks again
Ed

?
- Bruce

On Wed, May 5, 2021, 7:19 PM Ed Bell <ed.ebell@...> wrote:
Hi Scott

Thanks for reply..? Read-Only box is unchecked?

I need to mention that when i run the version of the program which is single execution it works...? ?however the version i shared which runs in a continuous loop does not work


regards
Ed



On Wed, May 5, 2021 at 11:25 PM <sbtuttle@...> wrote:
Hi Ed,
Just a wild guess - check to ensure the "Read-Only API" setting in the TWS API Settings dialog is NOT checked.

Cheers,
Scott

Join [email protected] to automatically receive all group messages.