Closing positions at the end of the day

Brett_SpenceBrett_Spence Posts: 11
edited March 2017 in Trade Expression

I am trying to close positions close the close of the trading day using a market order. I currently use LIME, but have tried many of the ECN's. For some reason, some of the market orders don't get filled. I initially had the timer go off 60 seconds before the close and a whole bunch of trades never got closed. Now I am at 8 minutes and I still have open positions. My symbol_universe includes only stocks with average volume > 1000000 so I wouldn't expect it to be an issue? My understanding of market orders is that you always get a fill - no matter how bad?

Is there a best practice for closing a position at/near the close? My code is the standard market order code:

trade_data = {}
                orderPrice = 0.0
                voodooGuid = '{1721044d-9395-493c-8e37-ac42d58c77de}' # Sell Market LIME LSR
                order.algo_sell( md.symbol, voodooGuid, 'exit', price=orderPrice, allow_multiple_pending=False, user_key=None, collect=trade_data )
                self.HasPosition = False
                service.terminate()

Comments

  • I unchecked "Allow partial fills" and that seems to have resolved the problem.

  • shayneshayne Posts: 70

    the system has been tweaked to increase executions on low volume stocks.

Sign In or Register to comment.