| Both sides previous revision Previous revision Next revision | Previous revision |
| developers:apiv2:pricing [2026/09/07 22:07] – [Prices and Decimals are Represented as Strings] chad | developers:apiv2:pricing [2026/09/07 22:23] (current) – [Ticks and cash value] chad |
|---|
| </code> | </code> |
| |
| They are sent as text to avoid binary floating-point rounding. **Parse them into your language's native decimal type**, not a ''double''. ''Price'' is used for market/order prices; ''Decimal'' is used for order volumes and cash values. | T4 uses text to avoid binary floating-point rounding. **Parse them into your language's native decimal type**, not a ''double''. ''Price'' is used for market/order prices; ''Decimal'' is used for order volumes and cash values. |
| |
| ===== Volumes ===== | ===== Volumes ===== |
| |
| * **Order routing** — volumes (''volume'', ''max_show'', ''max_volume'', fill volumes) are ''Decimal'' **strings**. This lets fractional exchange quantities (e.g. Kalshi ''"1.50"'') pass through unchanged. The service scales them to/from T4's internal integer volume using the market's volume scale. | * **Order routing** — volumes (''volume'', ''max_show'', ''max_volume'', fill volumes) are ''Decimal''. This allows the API to support fractional exchange quantities (e.g. Kalshi). |
| * **Market data** — depth and trade volumes are plain integers (''int32''). | * **Market data** — depth and trade volumes are plain integers (''int32''). |
| |
| ===== Price format ===== | ===== System Price format ===== |
| |
| Set ''price_format'' on ''LoginRequest'' to choose how ''Price'' strings are formatted: | T4 publishes prices in different formats. The setting controls how prices are formatted in the trading and all other platform API's (chart's, etc.) |
| |
| ^ ''PriceFormat'' ^ Meaning ^ | <note>If you expect ES to look like ''5954.75'' instead of ''595475'', choose **Real**.</note> |
| | ''PRICE_FORMAT_DECIMAL'' | Human decimal price (default). | | |
| | ''PRICE_FORMAT_REAL'' | Exchange "real" price. | | |
| | ''PRICE_FORMAT_CLEARING_DECIMAL'' | Clearing price. | | |
| |
| ''MarketDetails'' carries the matching precision fields: ''decimals'', ''real_decimals'', ''display_decimals'', ''clearing_decimals''. | Set [[https://github.com/CTS-Futures/t4-api-tools/blob/main/proto/t4/v2/common/enums.proto#L35|PriceFormat]] on [[https://github.com/CTS-Futures/t4-api-tools/blob/main/proto/t4/v2/auth/auth.proto#L9|LoginRequest]] to choose how ''Price'' strings are formatted: |
| |
| ===== Ticks and cash value ===== | <WRAP 75%> |
| | ^ PriceFormat ^ Description ^ Example (ES) ^ |
| | | ''PRICE_FORMAT_REAL'' | Human-readable decimal placement used by most trading UIs. | <code>5954.75</code> | |
| | | ''PRICE_FORMAT_DECIMAL'' | Raw exchange representation, without UI-friendly decimal placement. | <code>595475</code> | |
| | | ''PRICE_FORMAT_CLEARING_DECIMAL'' | Typically used for data imports and exports only. | <code>595475</code> | |
| | </WRAP> |
| |
| * ''min_price_increment'' (in ''MarketDetails'') is the tick — the smallest valid price step. e.g. tick ''25'' → …, 4000.00, 4025.00, 4050.00, … | See [[developers:systempricing|System Price Format]] for more information. |
| * ''point_value'' (in ''MarketDetails'') converts a price move to cash: ''(price2 − price1) × point_value''. e.g. 4200.00→4225.00 at ''point_value'' 0.5 = 12.50 per contract. | |
| |
| ===== Timestamps, dates and ids ===== | |
| |
| * **Timestamps** — ''google.protobuf.Timestamp'' (UTC). ''Heartbeat.timestamp'' is UTC epoch **milliseconds**. | |
| * **Dates** — ''trade_date'' and similar are ''int64'' date values. | |
| * **Ids** — ''exchange_id'', ''contract_id'', ''market_id'', ''account_id'', ''user_id'' are strings, obtained from login and the [[developers:markets|Instruments API]]. | |
| |
| ===== Reference ===== | |
| |
| ''proto/t4/v2/common/price.proto'' and ''proto/t4/v2/common/enums.proto''. | |
| |