0

I need to connect to Kx refinery and get the table data . Table Name : stock

I tried to use:
\c `:host:port //gives output as 25 80i
getTicks[`stock;startDate;endDate] //does not work ,shows error near getTicks
Dhanuushri
  • 15
  • 3
  • The command `\c` is used to set the console size, not for connections. Typically you would use `hopen` instead but I am not familiar with KX refinery. The docs also say `getTicks` takes a dictionary as its argument. – Thomas Smyth - Treliant Jun 13 '23 at 08:11

1 Answers1

2

There's several issues in your example that I think could be solved by reading the IPC docs: https://code.kx.com/q/basics/ipc/.

First and foremost \c is used for setting a limit on the size of the virtual console display. The 25 80 you see is just the size of the console (height and width)

So assuming this is a standard q process you're trying to connect to (e.g rdb, hdb, gateway) then you should just be able to open the port via:

q)h:hopen`:host:port

Note that this assumes there's no username or password required, in which case it would be

q)h:hopen`:host:port:username:password

Then, if getTicks is a function defined on the remote process you can run something like:

q)res:h(`getTicks;`stock;startDate;endDate)

to perform a synchronous (blocking) request to the server to call your function with your required arguments.

SeanHehir
  • 1,587
  • 9
  • 12
  • there is a rank error near h. @SeanHehir – Dhanuushri Jun 13 '23 at 10:23
  • Probably an issue with getTicks in that case. Thomas' comment on your initial post mentions that getTicks should take a dictionary, so maybe that's the problem? – SeanHehir Jun 13 '23 at 11:02
  • 1
    `getTicks` takes a single dictionary as a paramter: https://code.kx.com/refinery/server-api-guide/getticks.html ``q)res:h(`getTicks;params)`` – rianoc Jun 14 '23 at 06:26