KX Community

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

Home Forums KX Academy Fundamental Capstone 3.3 “type” error in testing

  • megan_mcp

    Administrator
    April 22, 2025 at 9:22 am

    Hi Martin,

    Can you share with me what your asize, bsize and int_table variables are? 

    Many thanks,

    Megan

    • Martin

      Member
      April 22, 2025 at 10:56 am

      Hello Megan,

      asize and bsize are the last two columns in the nbbo (new_nbbo) table (see asize_bsize.png). I remove them to create the tradeContext table, as the table shown in the markdown as a sample does not have these two columns.

      Int_table is the resultant table after running the asof join on the trade and nbbo tables. It still has the asize and bsize columns (see int_table.png). I have included the metadata for the int_table (see int_table metadata.png).

      Thanks,

      Martin

      • This reply was modified 1 month ago by  Martin.
      • megan_mcp

        Administrator
        April 22, 2025 at 2:58 pm

        Hi Martin,

        Ah yes, apologies my bad. First of all, the question states that we need all of the trade data but only the two extra columns from the nbbo table (bid and ask). 

        If you take a look at the sample data, the only two matching columns between the two tables are option_id and time. So we can rule date out of the equation when joining.  

        Secondly, it states we need to the last date in the database. We can achieve this by using:

        where date = last date
        

        In our select queries. Using these tips, try and recreate the tradeContext table and send me the results either on this thread or by private message 🙂 

        Many thanks,

        Megan

        • This reply was modified 1 month ago by  megan_mcp.
  • Martin

    Member
    April 23, 2025 at 12:29 am

    Hello Megan,

    Thank you for getting back to me. 

    While the sample data schema for nbbo has no date column, the nbbo table that is  provided for the exercise has one, with four distinct dates (see nbbo_table.png). If I then exclude the `date column while running aj[], the test for exercise 3.1 (whether tradeContext Has Correct Format) is failed. 

    After using the “where date = last date” clause, the table is as seen in the image tradeContext.png. However, the code for exercise 3.3 (creating badTrades table) still fails with the error “abort in before block due to error \”type\””. Despite the fail at 3.3, the rest of the tests are passed.

    Failing code snippet:

    badTrades:select from classifyTrade[tradeContext] where exQuality=0b

    Have a good day.

    Kind regards,

    Martin

    • This reply was modified 1 month ago by  Martin.
    • This reply was modified 1 month ago by  Martin.
  • megan_mcp

    Administrator
    April 30, 2025 at 1:10 pm

    This has been resolved offline.

Log in to reply.