Insert mixed list into table

Hi,

I’m receiving the following data from a websocket. Each line is a separate message. 

“d()”

“d(1,1,‘250’,‘250’,‘-100’);\n”

“y(17);\nd(1,1,‘250’,‘250’,‘-100’);\n”

How can I insert the data above into a table such as this as I receive it?

trade:(currentTimestamp:();index:();field:();price:();quote:();volume:()) 

I can get as far as printing a slightly-better formatted string to the console, but no further. 

.z.ws:{myfunc}

myfunc:{a:(“;\n” vs x); b:a where 10 < count each a;0N!b}

Thanks in advance for any help. 

Here is one solution but modify the function depending on your contract with client regarding data format that it will send to your service.
I am making following assumptions:

a) Your myfunc is correctly identifying the data part.

b) Data part will always be wrapped in ‘d(…)’

myfunc:{a:(“;\n” vs x); b:a where 10 < count each a; updTrade each b}

updTrade:{

  d: “,” vs ssr[-1_2_x;“'”;“”] ; / remove single quotes from data and separate data values

  td:.z.z, “IIIII” $’ d;  / convert to proper types and add timestamp. Here its converting to Integer

  `trade insert td

}

That worked perfectly first time! Thanks again for the help with this.