Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
can i run 2 different programms at the same time.

We have an algorithm implemented using IB's TWS API where in we have 2 different programs to take care of LONG and SHORT. Both the programs actually enter the trade by executing entry order and placing exit order as a limit or stop loss order.

for Ex:- the program which takes care of LONG will first enter trade buy executing a buy order and then it places 2 sell orders one as a LIMIT order and another as stop-loss order. Executing one of them will cancel the the other order automatically(OCA-one cancels ALL order).Now we got to know about how we can implement OCA orders manually in quantopian.The problem now is with the 2 separate programs.Can we really have 2 different programs running at the same time? Quantopian allows it?

In IB we can get the pending orders and position details that is created by one program in another i.e if our LONG handling program creates a pending order and when we request for the pending order from SHORT handling program it will return us the pending orders that are created by SHORT handling along with those pending that are created from LONG handling program.Briefly telling it will just return all the pending orders in the system. So is this possible in quantopian?

8 responses

Don't think so

Do you hold both long and short positions open? If you do not and I think ti is also illegal in many cases, why do you need two programs?

suraj n e: most likely not, the orders id are private to Algorithm instance but

Just merge the logic of the two programs, this way accessing open orders is not an issue.


Sol Marte: that sounds odd, what law would that be?

I'm not sure there's a legal issue, but IB won't allow a single account to be both long and short the same security.

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Why to use the same STOCK, try to Hedge with other Stocks that have Inverse correlation or different mean reversion. You can run 2 separate programs in quantopian with different accounts/credentials.
EG

Sol marte: every minute we collect OHLC data and compute signals if we get the trade entry signal we enter the trade and then since we don have OCA order in quantopian we need to place to different orders(as mentioned early in question) and we need to keep on polling the order status continiously of the 2 placed order till the end.
say we entered the long trade and we are waiting for the long exit to happen in a same program during the time between we don compute any signals during which we may miss a short entry signal. so we need 2 different programs.

thanks every body for your reply.

Holding both a long and short position in the same security even with different brokers is in most cases considered manipulation and it is illegal.

http://en.wikipedia.org/wiki/Wash_trade

http://definitions.uslegal.com/w/wash-trading/