Marsel,
Your algo would trigger the order as defined in your code, quantopian allows a few order types (market, stop, limit, and stop/limit). Assuming you are placing market orders, which is the default, then the full order will continue to try to fill until the end of trading for the day, then will cancel itself.
It is not looping back through the algorithm, a market order will to try to fill until the end of the day. If you want to cancel it sooner, you have to code the cancellation process separately.
In most live markets you can process an order type "fill or kill", which tries to execute the entire order and if the entire order can't be placed, then it cancels it immediately, no partial fills.
You can approach the limited liquidity in a few ways:
1. code some trading logic to adjust your orders to match some percentage of the available volume, until your desired amount is filled. This can also help reduce slippage costs, keep you from pushing up the market on yourself.
2. place the full market order then use cancel_order timed to execute shortly after, although this will result in partial fills it would not continue to try to fill until the end of the day.
If you have some code to share, I can try to help you with it.
Best,
Cory