Hi Thomas,
Thank you for your reply.
The way you suggest probably won’t work, cause the server side doesn’t allow me to make a connection, but I will try the way you suggest later, maybe I am wrong.
Btw, I try another way at the meantime,
server side:
\p 5000
.u.subscribers:()
trade:([]sym:n?```3``;size:n?``100``;price:n?1f)
.u.sub:{ .u.subscribers:.u.subscribers,:.z.w }
\t 1000
.z.ts:{ neg.u.subscribers }
client side:
trade:( sym:() ; size:() ; price:() )
h:hopen 5000
upd:{ [t;x] t upsert x }
h(`.u.sub)
Same here, I want the server to publish data every per second to the trade table on the client side.
Still something wrong here …
Cheers mate,
Jimmy
thomas...@aquaq.co.uk? 2016?3?14??? UTC??5?29?39???
Hi Jimmy,
I made a few changes to get your example.
namely opening a server on port 5004 and client on 5004 and how to run .u.sub.
In order to run .u.sub on the server from the client side you need to use the command: h(.u.sub
). The second backtick tells q to run the function with an empty set of parameters, which is what you wish to do. Using h(`.u.sub) just returns the function definition as no parameters are applied.
In addition, if a connection to the client (5004) from the server (5005) is not made then running h(.u.sub
) will result in an error as h is not set.
More information on feed set ups can be found at http://code.kx.com/wiki/Startingkdbplus/tick.
SERVER
\p 5005
n:100
trade:(sym:n?`
3
;size:n?
100
;price:n?1f)
h:hopen 5004
.u.sub:{ .z.ts:{ h(upd;
trade;1?trade) }}
\t 1000
CLIENT
\p 5004
h:hopen 5005
upd:{ [t;x] t upsert x }
h(.u.sub
)
Hope this information helps.
Regards,
Thomas Smyth
AquaQ Analytics