KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums KX Academy Fundamental Capstone Project Exercise 3.1

  • Fundamental Capstone Project Exercise 3.1

    Posted by pravigak on October 13, 2023 at 12:00 am

    I cannot seem to get the aj function to work to create the tradeContext table.

    This is my code:

    tradedata: select from trade where date = last date
    nbbodata: select option_id, time,bid, ask from nbbo where date = last date
    tradedata:`time`option_id xasc tradedata
    nbbodata: `time`option_id xasc nbbodata
    tradeContext: aj(`option_id`time;tradedata;nbbodata)

    The output I get is
    k){.Q.ft[.Q.ajf0[0;1;x;;z]]y}[(`option_id`time;+`date`option_id`trade_id`time`price`qty`side`edge`exch_id`broker_id!(2020.08.06 2020.08.06 20…

    Not entirely sure how to fix it.

    pravigak replied 9 months, 3 weeks ago 3 Members · 2 Replies
  • 2 Replies
  • Laura

    Administrator
    October 16, 2023 at 12:00 am

    Hi  ,

    Your code is correct, you just need to take another look at the brackets you are using for the aj.

    I’ve added the correct syntax below if you want to take a look:

    tradeContext: aj[`option_id`time;tradedata;nbbodata]

    Hope this helps!

    Laura

  • kdbguru

    Member
    October 31, 2023 at 12:00 am

    What you are unintentionally doing is passing the list as a single argument. And so, it’s returning you back the projection of the aj function.

    You should be able to differentiate between () & []. While () is used for a list, [] is used to pass the arguments to a function and “;” is used as a separator for the parameters.

Log in to reply.