Is there any way to create candlestick on ODD TimeSpan from tick data by using xbar function.

97 views
Skip to first unread message

she wenhao

unread,
Dec 13, 2012, 11:44:22 AM12/13/12
to personal...@googlegroups.com
ear All KDB+ Gurus,

I have tick Data and I know that  I could convert it to minute bar easily by this way:

"select High:  max Price, Low: min Price, Open: first Price, Close: last Price by  1 xbar Time.minute from Trade where Symbol = `BAC"

And the tickdata looks like this:
Time                Symbol        Price
---------------------------------------------------
09:30:01.333       BAC            9.10
......

Now is my question, is  there any possible to convert the tick data into candlestick on some weird timespan? From example, 5 seconds, 7 seconds or 55 seconds. I know it sounds  weird but  just curious whether here is any advance command or function I  could use?


Thanks in advance.

Best

Wenhao
  

Kim Kuen Tang

unread,
Dec 13, 2012, 12:23:35 PM12/13/12
to personal...@googlegroups.com

Do you mean this?

select High:  max Price, Low: min Price, Open: first Price, Close: last Price by  5 xbar Time.second from Trade where Symbol = `BAC

--
You received this message because you are subscribed to the Google Groups "Kdb+ Personal Developers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/personal-kdbplus/-/r9nhd2cWOQcJ.
To post to this group, send email to personal...@googlegroups.com.
To unsubscribe from this group, send email to personal-kdbpl...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/personal-kdbplus?hl=en.

she wenhao

unread,
Dec 13, 2012, 12:27:06 PM12/13/12
to personal...@googlegroups.com
Thanks lot  Kuentang,

Yes, it is. I tried some  ODD timespan on this like by 7 xbar Time.second from Trade where Symbol = `BAC and it rocks. Really interesting that I could have some 7 second or 77 second bar, lol

Have a nice day~~~

Wenhao

Bohák András

unread,
Dec 14, 2012, 3:10:00 AM12/14/12
to personal...@googlegroups.com
If you liked 7 seconds, how about 7.123?:)

select High: max Price, Low: min Price, Open: first Price, Close: last Price by 7123 xbar Time from Trade where Symbol = `BAC
> To view this discussion on the web visit https://groups.google.com/d/msg/personal-kdbplus/-/3UOlB17SVTIJ.

abcfoots

unread,
Dec 14, 2012, 3:10:20 PM12/14/12
to Kdb+ Personal Developers
bin is useful if you want to aggregate over a non uniform grid

r:`s#09:30:01.333 09:31:02.332 09:35:00.0 10:40:00.0
select max[price],min[price]by Symbol,Time:r@r bin Time from trade
> > To view this discussion on the web visithttps://groups.google.com/d/msg/personal-kdbplus/-/r9nhd2cWOQcJ.
> > To post to this group, send email to personal...@googlegroups.com.
> > To unsubscribe from this group, send email to personal-kdbpl...@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/personal-kdbplus?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups "Kdb+ Personal Developers" group.
> > To view this discussion on the web visithttps://groups.google.com/d/msg/personal-kdbplus/-/3UOlB17SVTIJ.
> > To post to this group, send email to personal...@googlegroups.com.
> > To unsubscribe from this group, send email to personal-kdbpl...@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/personal-kdbplus?hl=en.- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages