Data Flow
A website visitor never initiates an upstream market-data request.
Collection and Storage
A private production collector records a copper-price observation approximately every 60 seconds. Each observation is stored with a Unix timestamp and numeric price in the production SQLite history database.
The public API opens that database in read-only and query-only mode. It cannot write prices, change collector state or retrieve provider credentials.
Current Price and Freshness
The current price is the newest stored observation. The visible timestamp comes from that observation and is displayed in Indian Standard Time (IST). The API reports data as stale when the newest point is more than five minutes old.
Short browser, Cloudflare and Nginx caches reduce repeated database work. A cached response can therefore be seconds behind the newest stored point while remaining within the stated freshness window.
Daily Statistics
- Open
- The first stored price at or after 00:00 IST for the current calendar day.
- High
- The maximum stored price from 00:00 IST through the latest observation.
- Low
- The minimum stored price over the same interval.
- Previous close
- The final stored observation before the current IST calendar day. If no earlier day exists, the current day's open is used.
- Daily change
- Current price minus previous close. Percentage change divides that difference by previous close.
Historical Aggregation
Chart endpoints group observations into time buckets sized to keep responses bounded and fast. Daily and monthly tables use every stored point in the requested period to calculate open, high, low, close and arithmetic average.
Period changes and averages are returned only when the database covers the complete requested interval. This prevents a two-day database from being labelled as a 30-day trend.
Availability and Limitations
Market data can be delayed or unavailable. The frontend may show the last valid snapshot stored on the visitor's device, clearly labelled as a fallback. It does not change timestamps to create false freshness.
The result is a market reference, not a physical sale price. Copper form, grade, purity, quantity, location, taxes, freight, financing and seller margin can all change a real-world quote.
Corrections
If a calculation or presentation error is identified, the implementation and this methodology should be updated together. Stored market observations are not manually rewritten merely to make a chart look smoother.