Skip to content
All library documents

Managing Unfilled Limit Orders and Position Quantities

Article FMZ forum · Author: xionglonghui

Summary

The post describes a trader rewriting a strategy from a simple domain language into JavaScript and encountering execution-state problems with limit orders. The trader asks whether the platform prices limit orders from the latest close or the best bid and ask, and reports that orders can remain unfilled. An attempt to access the first item in the open-orders result fails when that result has no entries; the trader wants to cancel and reprice outstanding orders.

It also asks how position queries should be interpreted when an exit order is still pending, since a close can be rejected for insufficient position even though the submitted order quantity appears correct. The author seeks guidance on retry counts, timing, price selection that preserves profit, and reliable close sizing. The text provides questions and a small problematic example, not solutions or execution data. Its value is as a set of practical issues to investigate in asynchronous order handling; exact API behavior depends on the trading platform and is not resolved here.

Key ideas

  • Open-order results may be empty, so code must account for the absence of a first order before accessing its identifier.
  • The post asks how limit prices relate to close prices and the best bid or ask.
  • Pending orders complicate the relationship between submitted quantities and confirmed holdings.
  • The author seeks a retry and repricing policy that balances execution against price control.
  • No definitive API guidance or tested resolution is included.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.