Jump to content
Sign in to follow this  
justin nelson

Currency being transferred as 'doubles' - Should it be ints for better accuracy?

Recommended Posts

Guest sky.sanders

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

 

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

 

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×