Market Data Fields Explained: Change Percentage Conventions, Validation, and Display Practices

    This article explains how market data snapshots are composed, how to infer and document the base price used for percentage change, and how to validate snapshots before storage and display. It covers common field definitions, consistency checks, time zone requirements, and a Decimal-based data model with validation logic.

    Market data often compresses the price state within a given statistical window into a set of fields. Before processing such data, you need to understand what each field means; otherwise, display or calculation errors related to conventions are easy to introduce. Common fields include:

    • Latest price: The price of the most recent trade when the snapshot is generated. This is the most time-sensitive field.
    • Open price: The price at the start of the statistical window. The window may be a calendar day or a rolling 24 hours; the data source documentation should specify the exact convention.
    • High price and low price: The upper and lower price bounds observed within the statistical window, used to assess the price range.
    • 24-hour change amount: The latest price minus the base price, representing the absolute change.
    • Percentage change: The change amount divided by the base price, then multiplied by 100, representing the relative change.
    • Market capitalization: Circulating supply multiplied by price. The result depends on the circulating supply provided by the data source; the page itself usually does not display circulating supply.
    • Market cap rank: The position by market capitalization within the coverage of the same data source. It changes over time.

    These fields have mathematical relationships and can be used to validate one another. For example, the latest price should fall between the low price and the high price, and the change amount and percentage change should corroborate each other.

    II. Base Price for Percentage Change

    Percentage change is meaningful only when the base price is clearly defined. Different data sources may choose different base prices. Three common choices are the closing price of the previous statistical period, the open price of the current statistical window, and the trade price 24 hours earlier. When displaying the data, you must state which convention is used.

    The base price can be inferred from the fields on the page:

    1. base price = latest price - change amount
    2. percentage change (%) = change amount / base price × 100

    Using the values in this example:

    • Base price = 0.09149 - 0.002797 = 0.088693
    • Percentage change = 0.002797 / 0.088693 × 100 ≈ 3.153%

    The inferred base price of 0.088693 is essentially consistent with the open price of 0.08869, indicating that the percentage change in this data set is calculated using the open price of the statistical window as the base price. This inference only demonstrates internal numerical consistency; it does not replace the convention documented by the data source.

    III. Data Consistency Validation

    After collecting a snapshot, run consistency validation before storage and display. At a minimum, check the following rules:

    1. The high price must not be less than the low price.
    2. The latest price must fall between the low price and the high price.
    3. The open price must fall between the low price and the high price.
    4. The base price inferred from the change amount must be positive.
    5. The percentage change shown on the page must match the calculated result within rounding tolerance.
    6. The update time must include time zone information. If the page only provides a string such as “2026-11-24 14:25:40”, the time zone is unknown; confirm it with the data source before storing it.
    7. Market capitalization and rank must be non-negative, and rank must be a positive integer.

    A snapshot that fails validation should not directly overwrite historical data. Record the failure reason and send it to a manual or automated review process.

    IV. Example Code: Data Model and Validation

    The following code uses Decimal to store prices, avoiding cumulative floating-point errors. The sample values come from the snapshot above, and the update time is treated as UTC. In actual use, follow the data source documentation.

    1. from dataclasses import dataclass
    2. from datetime import datetime
    3. from decimal import Decimal
    4. @dataclass(frozen=True)
    5. class QuoteSnapshot:
    6. last_price: Decimal
    7. open_price: Decimal
    8. high_price: Decimal
    9. low_price: Decimal
    10. change_amount: Decimal
    11. change_pct: Decimal # percentage, e.g. 3.153 means 3.153%
    12. updated_at: datetime # must be timezone-aware
    13. def validate_snapshot(q: QuoteSnapshot, pct_tolerance: Decimal = Decimal("0.001")) -> list[str]:
    14. errors: list[str] = []
    15. if q.high_