¿ªÔÆÌåÓý

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

Trades run using python script remotely not running as expected


 

I am not sure if anyone will be able to help me with this as this seems to be a very niche problem.

For a while I have been running my script trade.py which creates bracket orders and exits by printing "trades complete". I login to my trade server using ssh and run the script using python3 trades.py.

However, if I try to automate this by using a python script on my main server, which in turn uses subprocesses run or asyncssh, ssh ¡­ host name ¡­ python3 trades.py, the script runs all the way, and prints trades complete, however I do not see any trades being execute.

I checked the logs in both cases and they look exactly the same, as if trades had been placed. But in the second instance no trades are actually executed.

I am not sure why the tws api behaves this way, does anyone have any ideas or suggestions on how I can troubleshoot this issue?


 

Perhaps maybe track down the professor who is teaching that class and ask him not to use Maven as a classroom example.? Just to prevent this from happening again.? Or maybe that is too much?

Hunter


On Wednesday, July 5, 2023 at 02:42:12 PM PDT, omgwtfsalty@... <omgwtfsalty@...> wrote:


I am not sure if anyone will be able to help me with this as this seems to be a very niche problem.

For a while I have been running my script trade.py which creates bracket orders and exits by printing "trades complete". I login to my trade server using ssh and run the script using python3 trades.py.

However, if I try to automate this by using a python script on my main server, which in turn uses subprocesses run or asyncssh, ssh ¡­ host name ¡­ python3 trades.py, the script runs all the way, and prints trades complete, however I do not see any trades being execute.

I checked the logs in both cases and they look exactly the same, as if trades had been placed. But in the second instance no trades are actually executed.

I am not sure why the tws api behaves this way, does anyone have any ideas or suggestions on how I can troubleshoot this issue?


 

Sorry I don¡¯t understand what you mean. What¡¯s maven?


 

Sorry, I posted that to the wrong list, please ignore my last message.

Hunter

On Wednesday, July 5, 2023 at 02:47:18 PM PDT, Hunter C Payne via groups.io <hunterpayne2001@...> wrote:


Perhaps maybe track down the professor who is teaching that class and ask him not to use Maven as a classroom example.? Just to prevent this from happening again.? Or maybe that is too much?

Hunter


On Wednesday, July 5, 2023 at 02:42:12 PM PDT, omgwtfsalty@... <omgwtfsalty@...> wrote:


I am not sure if anyone will be able to help me with this as this seems to be a very niche problem.

For a while I have been running my script trade.py which creates bracket orders and exits by printing "trades complete". I login to my trade server using ssh and run the script using python3 trades.py.

However, if I try to automate this by using a python script on my main server, which in turn uses subprocesses run or asyncssh, ssh ¡­ host name ¡­ python3 trades.py, the script runs all the way, and prints trades complete, however I do not see any trades being execute.

I checked the logs in both cases and they look exactly the same, as if trades had been placed. But in the second instance no trades are actually executed.

I am not sure why the tws api behaves this way, does anyone have any ideas or suggestions on how I can troubleshoot this issue?


 

The classic gotcha in these situations is the gateway configuration on the host machine,
Configuration > API > Settings > Read-Only API

Hope this helps.


 

Good suggestion
Listening to errors is vital because sending an order in RO or even a simple reqIds (int numIds) trigger an error message if APi is not in RW