A US stock quality strategy with cash conversion rules
A stock quality strategy needs separate profitability and cash-conversion decisions. Rank trailing gross profit relative to a declared asset denominator, but admit a stock only when positive net income is covered by operating cash flow. Keep financial-statement periods and availability aligned, then reconstruct quarterly replacements and net cash. A high profitability score alone does not satisfy the strategy.
This guide uses fictional nonfinancial US companies and frozen quarterly snapshots. CoTrading quality-strategy capabilities remain planned or unverified. The numbers are synthetic accounting and selection tests, not evidence that a quality label removes valuation, operating or market risk.
Define the financial fields independently
Use trailing twelve-month gross profit, net income and operating cash flow, assembled from four consecutive nonoverlapping quarters. Use total assets at the same reporting endpoint as the denominator. This contract chooses ending assets rather than average assets; switching the denominator would be another specification.
The SEC financial-statement guide distinguishes period flows from a balance-sheet snapshot and describes gross profit in the income statement. Preserve source concepts, units and dates rather than match fields by a familiar label alone. Financial amounts in the fixture use compatible normalized USD units; trade prices and account cash are ordinary USD.
Restrict the research universe to nonfinancial companies. A bank or insurer should not be forced into a manufacturing-style gross-profit mapping merely to keep coverage high. A missing source concept remains missing. The synthetic financial-company flag represents an upstream classification input, not a historical classification service supplied by the code.
Apply the cash gate before ranking
Require net income strictly positive and operating cash flow at least as large as net income. This can be expressed without dividing by net income, avoiding a zero-denominator interpretation. Equality passes; a smaller cash flow fails. The threshold is a declared research policy, not a universal definition of economic quality.
The profitability score is gross profit divided by positive assets. It is an accounting ratio, not an expected stock return. A company can have a very high score and fail cash conversion, while a lower-score company can satisfy both requirements. Export the gate reason separately from the numeric rank.
Exclude missing fields, nonfinite observations, nonpositive assets and mismatched flow/asset dates before ranking. Do not fill a missing gross-profit figure with zero or copy a later balance sheet backward. Those shortcuts change the eligible population and can make an apparent quality effect come from data treatment rather than the declared mechanism.
Rebuild availability and TTM context
The SEC EDGAR API documentation explains submissions and fact context. It does not automatically deliver the exact point-in-time quality panel required here. Keep accession, period, unit, availability and any revision record for each component.
The March 31 decision uses supplied facts available February 15, ending December 31. The June 30 decision uses facts available May 15, ending March 31. The script filters availability before choosing a version. Later cash-flow improvement cannot authorize an earlier selection, even if it is now the most recent record in a downloaded file.
Quarter labels must be four consecutive periods; duplicate labels are rejected. Asset date must match the flow endpoint. In the rolling update, old quarters retain their values and the new quarter replaces the oldest one, rather than restating overlapping observations without a source explanation.
Hand-check the first quality basket
For S01 through S20, trailing gross profit is twenty plus the stock number, assets one hundred, net income ten and operating cash flow twelve. S20’s profitability score is forty divided by one hundred, 0.4. All twenty pass the cash gate and rank from S20 down through S01.
S21 has gross profit one hundred and assets one hundred, a higher score of one, but initial operating cash flow four does not cover income ten. It is excluded. S22 is financial, S23 has negative income, S24 lacks a gross-profit component and S25 has zero assets. Each receives a distinct reason rather than a misleading low score.
At the second decision, S21’s newly available four-quarter operating cash flow reaches twelve while its other required values remain compatible. It now passes and enters first, followed by S20 through S02; S01 leaves. The example demonstrates a gate changing eligibility, not merely a movement in the profitability rank.
Reconcile quarterly orders from a cash account
Start with 10,000 and execute the first supplied basket on April 1. Buy twenty shares of each selected stock at twenty, 400 per name, with a fictional fee of one per order. Cash becomes 1,980, entry fees twenty and open-price equity 9,980. The stock sleeve is equal notional and deliberately leaves a cash reserve.
On the supplied July 1 rebalance, sell twenty S01 at nineteen and pay one, receiving 379. Buy twenty S21 at twenty and pay one, spending 401. Cash becomes 1,958 and cumulative fees twenty-two. The nineteen continuing positions create no new orders.
At the declared July 2 terminal open, sell the twenty remaining positions at twenty-one and pay twenty more fees. Net terminal proceeds are 8,380 and final cash is 10,338, with zero holdings. Gross modeled price gain is 380 and total fees forty-two. This constructed gain does not estimate historical quality-strategy performance.
Test the gate boundary and incompatible facts
Set operating cash flow exactly equal to income ten while keeping the first ordinary stock’s other fields. The cash gate must pass. Set it to nine and the gate must fail. These assertions distinguish at-least coverage from an accidentally strict greater-than rule.
A different counterexample changes only the asset date to an incompatible future period; the result is period mismatch. Repeating one quarterly label four times produces a flow-period error. Neither is repaired by the fact that a gross-profit/assets division could still return a finite number.
Negative income is excluded before any coverage ratio is interpreted. A positive cash flow divided by a loss would not express the approved gate. Keep that policy explicit rather than let the sign of a ratio decide eligibility accidentally. The source data must support the actual accounting meanings, not merely contain numbers with those names.
Run the quality acceptance pack
Download the complete example, save it as R589.py and run python R589.py with Python 3.12 or later. It uses only the standard library and synthetic inputs. The source is docs/growth/research/round-5/examples/R589.py.
Assertions verify both exact twenty-stock lists, S20’s score, every first-period exclusion reason, cash equality and failure boundaries, mismatched periods and unavailable dates. All initial, replacement and terminal orders are asserted with quantities, prices and fees, alongside cash 1,980, 1,958 and 10,338 and final zero holdings.
Preserve what the quality label does not prove
Archive the universe, financial mappings, four-quarter construction, asset convention, cash gate, availability policy, quarterly schedule, sizing and costs. Reconstruct one high-score rejection and one accepted replacement before applying the design to a larger historical sample.
Changing a cash-flow definition, asset denominator or classification creates a new research version. Identify the first changed fact and decision rather than explain only the final curve. Completion means the profitability-plus-cash rule and modeled ledger can be rebuilt independently; it does not prove a durable moat, attractive valuation or immunity to losses because a stock passed an accounting screen.
Review the gate and score as separate evidence
A useful rebalance export contains two decisions for S21: its profitability rank and its cash-conversion eligibility. The first snapshot has score one yet fails because four is below ten; the second passes because twelve covers ten. These numbers explain the replacement without attributing it to a stronger gross-profit ratio. Preserve the rejected high-score record as well as selected names. Otherwise a later auditor may incorrectly conclude that the strategy simply bought the twenty largest ratios without a cash gate.
FAQ
Does the highest gross-profit/assets score automatically enter?
No. Positive income, cash coverage and valid period inputs must also pass.
Does operating cash flow exactly equal to income qualify?
Yes. This contract uses at-least coverage, with an explicit equality assertion.