Skip to content
All library documents

Daily Backtest Cash Availability After Same-Day Stock Sales

Article BigQuant

Summary

The document presents a Chinese A-share backtest question: after selling a holding at the open, a daily-frequency strategy places a purchase near the close but buys only a small amount. The author wonders whether the simulator updates available cash only on the following day or whether the strategy needs minute-level testing. The accompanying code sells positions that no longer meet the daily buy list, then sizes new orders using the portfolio cash reported during that same daily handler. It also rounds share quantities down to board lots and checks whether a security can trade.

No reply or test result establishes the engine’s cash-settlement or order-processing behavior, so the underlying cause remains unresolved. The example is useful for identifying a backtest timing and execution question, but it does not show that changing to minute data would fix it. Other possible contributors visible in the code include when orders are processed, whether sale proceeds are reflected before sizing purchases, and the difference between the buy list and currently held symbols. A reliable diagnosis would require engine-specific documentation or a controlled comparison of order timing and cash values.

Key ideas

  • The strategy submits sale orders before calculating cash for new purchases in the daily handler.
  • Purchase size depends on portfolio cash at the time the handler reads it.
  • The code rounds orders down to lots of one hundred shares, which can reduce small allocations to zero.
  • The document raises a cash-update timing question but provides no answer or backtest evidence.
  • Minute-level testing is suggested as a possibility, not demonstrated as a solution.

Tags

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