[R-SIG-Finance] Does anybody know how to connect to KDB from within R?

Daniel Cegielka daniel.cegielka at gmail.com
Fri Sep 25 01:03:25 CEST 2009


Michael pisze:
> Very cool.
>
> I did the source thing. I am using Windows XP.
>
> Are there any sample database/code/project that I could try if this
> R-KDB connection works or not?
>
> I would love to explore a bit to see how I could achieve synergy by
> combining the power of R and KDB/Q together.
>
> Any pointers?
>
> Thanks a lot!
>   

https://code.kx.com/trac/browser/kx/kdb%2B


trade:([]time:`time$();sym:`symbol$();price:`float$();size:`int$())

`trade insert(09:30:00.000;`a;10.75;100)
`trade insert(09:31:00.000;`a;10.76;100)
`trade insert(09:32:00.000;`a;10.77;100)
`trade insert(09:33:00.000;`a;10.77;100)

q)select from trade
time         sym price size
---------------------------
09:30:00.000 a   10.75 100
09:31:00.000 a   10.76 100
09:32:00.000 a   10.77 100
09:33:00.000 a   10.77 100

q)select from trade where price>10.75
time         sym price size
---------------------------
09:31:00.000 a   10.76 100
09:32:00.000 a   10.77 100
09:33:00.000 a   10.77 100

q)select sum size by sym from trade
sym| size
---| ----
a  | 400


or in web browser

http://127.0.0.1:5000/
http://127.0.0.1:5000/trade
http://127.0.0.1:5000/?select from trade where price > 10.75

best,
daniel



More information about the R-SIG-Finance mailing list