This is an old revision of the document!
Pricing and Data Types
The WebSocket API represents prices using the Price and Decimal types. Both of these types wrap a string value for precision and consistency across different programming languages.
Clients should always parse Price and Decimal values into their programming language’s native decimal type for calculations.
Price and Decimal Types
The Price type is used for market prices, while the Decimal type is used for generic decimal values in messages. Both follow the same structure:
- Price – Represents a price in the market (e.g., bid/ask prices, last traded price).
- Decimal – Represents numerical values such as volumes, margins, or risk parameters.
Example representation:
* Price = `"4200.50"` * Decimal = `"5.25"`
In all cases, clients should parse these values into decimal for calculations.
Proto Converter Tools
The T4 API Tools repository provides tools for converting between .NET decimals and Protobuf Price/Decimal types.
Note: Reach out to support if you would like an API tool for a language we have not covered yet.
Platform | Proto Converter Tool |
---|---|
.Net | ProtoConverters.cs |