Price class: format converters
After you get a Price object that is both valid and tradable, you can use the following methods to extract the price in different formats.
Desired format | Price class method |
---|---|
Points | ToDecimal() |
Ticks | ToTicks() |
TT Display | ToString() |
Full price (in contract currency) | ToPrimaryCurrency() |
Full price (in trader's currency) | ToNativeCurrency() |
Full price (in specific currency) | ToCurrency() |
For example, assume that the variable inst represents a valid InstrumentDetails instance for the Eurex FGBL-Dec20 futures contract. You could use these methods as follows to display the price in the various formats:
Price p = Price.FromString(inst,"114.73");
Console.WriteLine("Points: " + p.ToDouble() + ", Ticks: " + p.ToTicks() +
", TT Display: " + p.ToString() + ", Full Price: " + p.ToPrimaryCurrency());
The result of this code snippet would be:
Points: 114.73, TT Display: 114.73, Full Price: 114730.00