Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6900799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:35:33+00:00 2026-05-27T07:35:33+00:00

I am learning KDB+ and have loaded the tic data into the table W

  • 0

I am learning KDB+ and have loaded the tic data into the table W as below. My question is, how to transfer the data into 5 (or n) minutes OHLCVA?

"Stk_ID","Date","Time","Price","Chg","Vol","Amt","Ty"
300032,2011-03-03,09:51:40,20.40,0.00,10.0,20400.0,S
300032,2011-03-03,09:51:30,20.40,-0.01,9.0,18360.0,S
300032,2011-03-03,09:51:00,20.41,0.01,2.0,4082.0,B
300032,2011-03-03,09:51:00,20.40,-0.01,115.0,234599.0,S
300032,2011-03-03,09:50:45,20.41,0.00,10.0,20410.0,S
300032,2011-03-03,09:50:45,20.41,-0.02,7.0,14287.0,S
300032,2011-03-03,09:50:20,20.43,-0.01,4.0,8172.0,S
300032,2011-03-03,09:50:05,20.44,0.01,25.0,51100.0,B
300032,2011-03-03,09:50:00,20.43,-0.01,28.0,57204.0,S

I use such Q code to get 1 minute data, but don’t know how to get 5 minutes . :

select Open: first price,High: max price, Low: min price,Close: last price,Vol: sum vol, Amt: sum amt,Avg_Price: ((sum amt)%(sum vol))%100 by stk_id,time.hh,time.mm from asc W

result:

stk_id hh mm| Open  High  Low   Close Vol  Amt           Avg_Price
------------| ----------------------------------------------------
000001 9  30| 16.24 16.24 16.22 16.24 3253 5282086       16.23758
000001 9  31| 16.22 16.24 16.21 16.21 1974 3204276       16.2324
000001 9  32| 16.23 16.23 16.2  16.2  3764 6102207       16.21203
000001 9  33| 16.21 16.21 16.19 16.2  4407 7143120       16.20858
000001 9  34| 16.2  16.2  16.19 16.19 1701 2756614       16.20584
000001 9  35| 16.19 16.21 16.19 16.21 2756 4466988       16.20823
000001 9  36| 16.22 16.25 16.22 16.24 3123 5076089       16.25389
000001 9  37| 16.25 16.27 16.25 16.27 1782 2897340       16.25892
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:35:33+00:00Added an answer on May 27, 2026 at 7:35 am

    Rather than grouping separately by time.hh and then time.mm, I’d recommend doing a singe group:

    by stk_id,time.minute
    

    From there, all you need to do for 5 minute buckets is use xbar:

    by stk_id,5 xbar time.minute
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Learning jquery, so please be kind :) Using PHP, I have a table with
learning about loops (still a beginner) in VB.net. I have got the below code
Learning php! I have a sql database which contains a table called 'images' which
Learning Javascript and have a question about global variables. From my reading, most recommend
Learning from my last question , most member names seem to get included in
Learning from my broad question here ... I was wondering how I could go
Learning rails and something smells a little funny. I have the following form for
(learning c#) I have a C# WPF application which when a certain form is
Learning .NET: I have a form with a split container, I want to load
learning Jquery and integrating with PHP - getting there, but have one last challenge

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.