Author |
Topic: Volume Format (7 messages, Page 1 of 1) |
||||
---|---|---|---|---|---|
Moderators: VPfau | |||||
estrader Posts: 55 Joined: May 04, 2007 |
How do I format volume so that there are 0 decimal places?
lbVolume.Text=string.Format("Last Volume {0}", Contract.PriceToString(Contract.CurrentPrice.LastVol)); The above formats to 2 decimal places. |
||||
SergeK -Developer- Posts: 475 Joined: Jan 26, 2007 |
volume is an integer value, so you should not format it using Contract.PriceToString method.
the default formatting, like lbVolume.Text=string.Format("Last Volume {0}", Contract.CurrentPrice.LastVol); is enough. |
||||
estrader Posts: 55 Joined: May 04, 2007 |
Excellent. Thanks. Same thing with LastDateTime?
|
||||
SergeK -Developer- Posts: 475 Joined: Jan 26, 2007 |
PriceToString is used only for price values, such as last, ask, bid, open, close, high, low and settlement. It formats values using given contract parameters : tick size, decimal places and divisor (for tick sizes such as 1/32).
Also note that LastDateTime value is in UTC - you may want to convert it to local time. |
||||
estrader Posts: 55 Joined: May 04, 2007 |
Thanks again for your assistance. I am slowly working my way through the Example API whilst learning C# at the same time. It's a great language but I am not familiar with the syntax. I have managed to display LastDateTime but converting it will be my next task.
|
||||
estrader Posts: 55 Joined: May 04, 2007 |
Thanks again for your help skorostelyoff. Maybe this is a more appropriate area for this thread. I am working through the Example API and learning C# at the same time. I am not familiar with the syntax. I have managed to display LastDateTime but converting the time to local will be my next learning curve. I also just want to just display the time without the date as well.
Edited by estrader on May 9, 2007 at 03:13 AM |
||||
SergeK -Developer- Posts: 475 Joined: Jan 26, 2007 |
Sorry, I did not provide an example:
LastDateTime.ToLocalTime() converts its UTC value to local time of user's computer. |
||||
SergeK -Developer- Posts: 475 Joined: Jan 26, 2007 |
I would recommend you to read following articles in MSDN:
http://msdn2.microsoft.com/en-us/library/system.datetime.aspx http://msdn2.microsoft.com/en-us/library/system.datetime.toshorttimestring.aspx http://msdn2.microsoft.com/en-us/library/8kb3ddd4.aspx |
||||