Closed byroncoetsee closed 2 weeks ago
Hi How come most of the structs use string on almost all of the variables which would always be, for example, a float64?
string
float64
For example:
type CreateOrderResponse struct { Price string `json:"price"` OrigQuantity string `json:"origQty"` ExecutedQuantity string `json:"executedQty"` }
Could be
type CreateOrderResponse struct { Price float64 `json:"price,string"` OrigQuantity float64 `json:"origQty,string"` ExecutedQuantity float64 `json:"executedQty,string"` }
Which would allow one to actually do maths on those values without having to convert from a string every time...
I'm happy to make the change and submit a PR - I just want to check the reasoning (if any) for keeping them strings.
float64 is an inaccurate data type, you should not use it in price calculation, please use another decimal lib instead, for example, github.com/shopspring/decimal
No response for a long time, close this issue
Hi How come most of the structs use
string
on almost all of the variables which would always be, for example, afloat64
?For example:
Could be
Which would allow one to actually do maths on those values without having to convert from a string every time...
I'm happy to make the change and submit a PR - I just want to check the reasoning (if any) for keeping them strings.