Hello all
I am developing an app that is expected to update it’s data continiously using websocket connections (I am only bringing that up to calrify that several messages with data could be comming per second.)
I am getting the data need to update my model from Kraken (bitcoin trading plarform) but the problem I am currently wrestling with right now is that the data are actually coming in a structure as shown below:
[
34,
{
"a": [
"0.042062",
21000,
"21000.00000000"
],
"b": [
"0.041960",
63306,
"63306.95000000"
],
"c": [
"0.041960",
"0.00000011"
],
"v": [
"2453051.00336514",
"8208496.19778969"
],
"p": [
"0.041922",
"0.042844"
],
"t": [
606,
1557
],
"l": [
"0.041383",
"0.041383"
],
"h": [
"0.042414",
"0.044987"
],
"o": [
"0.042107",
"0.044318"
]
},
"ticker",
"ADA\/EUR"
]
As you can probably guess the mostof the field are float but somehow serialized as strings
and in some cases there is an list of string and inbitween the string there is an int as for example in the “a” field.
My question was how would you handle such a case when it comes to decode into elm values.
Would it be a good idea to create some type alias to immitate this kind of structure (is it even possible given the mixed lists ?) or would you just go with regex and just find the values of interest and if so what would be the performance implications in your experience ?
thanks in advance