justin nelson 15 Report post Posted July 18, 2013 I noticed that currency numbers are being represented as ‘doubles’ in the API. Should they be in integer values instead in order to be more accurate and avoid rounding errors? See for example OrderDTO 1 MitchDimoulakis reacted to this Share this post Link to post
Guest sky.sanders Report post Posted July 26, 2013 Actually, the meta specifies ‘number’ which is, admittedly, ambiguous. JSON Schema allows for a ‘format’ attribute. We currently use this attribute to identify WCF formatted dates. It is my opinion that a ‘currency’ and ‘decimal’ format value be introduced into our schema/smd. e.g. { "id": "OrderDTO", "type": "object", "description": "An order for a specific Trading Account", "properties": { .... "OpenPrice": { "type": "number", "description": "???", "minimum": 0, "maximum": 999999999, "format": "currency" }, .... Share this post Link to post
justin nelson 15 Report post Posted August 7, 2013 Actually, the meta specifies ‘number’ which is, admittedly, ambiguous. JSON Schema allows for a ‘format’ attribute. We currently use this attribute to identify WCF formatted dates. It is my opinion that a ‘currency’ and ‘decimal’ format value be introduced into our schema/smd. e.g. { "id": "OrderDTO", "type": "object", "description": "An order for a specific Trading Account", "properties": { .... "OpenPrice": { "type": "number", "description": "???", "minimum": 0, "maximum": 999999999, "format": "currency" }, .... Right, I saw that it was a ‘number’. I’m just curious about how the numbers are being dealt with on the back end. Share this post Link to post
Guest mrdavidlaing Report post Posted August 7, 2013 Actually, the meta specifies ‘number’ which is, admittedly, ambiguous. JSON Schema allows for a ‘format’ attribute. We currently use this attribute to identify WCF formatted dates. It is my opinion that a ‘currency’ and ‘decimal’ format value be introduced into our schema/smd. e.g. { "id": "OrderDTO", "type": "object", "description": "An order for a specific Trading Account", "properties": { .... "OpenPrice": { "type": "number", "description": "???", "minimum": 0, "maximum": 999999999, "format": "currency" }, .... @justin nelson On the backend they are C# doubles – we care a lot about precision for some markets like FX, which are quoted to the 5th decimal place. That said; I think we should actively specify a currency format that doesn’t get confused with Javascript’s Number (which has precision problems – http://yuiblog.com/blog/2009/03/10/when-you-cant-count-on-your-numbers/); and ensure that we provide tools in CIAPI.Js to deal with this Share this post Link to post