# Limit order for long-short example

**URL:** <https://forum.alpaca.markets/t/limit-order-for-long-short-example/950>\
**Category:** Alpaca Integration Applications\
**Created:** [March 13, 2020, 5:16pm UTC](https://forum.alpaca.markets/t/limit-order-for-long-short-example/950 "2020-03-13T17:16:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nobs](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/nobs/32/493_2.png) [@nobs](https://forum.alpaca.markets/u/nobs)\
**Post date:** [March 13, 2020, 5:16pm UTC](https://forum.alpaca.markets/t/limit-order-for-long-short-example/950/1 "2020-03-13T17:16:26Z")

</div>

Hi,

I am a newbie here. Does anyone know how I can change from market order to limit order using the long-short example available on github?

self.alpaca.submit\_order(stock, qty, side, “market”, “day”)

I would like to replace above with something like:  
self.alpaca.submit\_order(stock, qty, side, “limit”, “day”, float(position.avg\_entry\_price) )

The problem is that the limit price is an array derived from another loop above the order submission function and has different prices for each stock in the portfolio. I have a feeling that it will require that I define a new function to get these prices onto an array, appending it to a variable outside the function and use it in the submit order. I don’t seem to get a head-start on this. Somebody help!
