KX Community

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

Home Forums KX Academy Failures on “tradeContext has correct format.”

  • Failures on “tradeContext has correct format.”

    Posted by Yu on August 21, 2024 at 3:36 pm

    Hi team,

    I saw other people asking same thing but I am facing the same problem on fandamental capstone exercise 3.1.

    The table format looks correct according to other threads but it fails and I have no clue.
    Could anyone please have eyes on this?

    Here’s the screenshot of meta tradeContext and the result.

    Thank you!

    Yu replied 4 months ago 2 Members · 8 Replies
  • 8 Replies
  • megan_mcp

    Administrator
    August 21, 2024 at 5:14 pm

    Hi @Yu

    When creating your tradeContext table are selecting from the trade table or a variation of the trade table that you have created yourself?

    This is how I see some people get caught out, as the format of these manually created tables are incorrect.

    Let me know!

    Many thanks,

    Megan

    • Yu

      Member
      August 22, 2024 at 8:13 am

      This is what I do

      tradeContext:aj[option_idtime;select from trade where date= max date;select option_id,time,ask,bid from nbbo where date= max date]

      The trade table is the original one.

      • megan_mcp

        Administrator
        August 22, 2024 at 9:45 am

        Hi @Yu

        Can you try sorting time in ascending order? I realise this may not be obvious in the question itself so I will look in to adjusting this question for future users.

        Thanks,

        Megan

        • Yu

          Member
          August 22, 2024 at 9:55 am

          I tried this way but didn’t work as it changed the format.

          Is this the correct way to do it?

          Yu

          • megan_mcp

            Administrator
            August 22, 2024 at 10:33 am

            Hi @Yu

            `time xasc select option_id, time ..

            Hope this helps!

            • Yu

              Member
              August 22, 2024 at 12:19 pm

              Hi megan,

              I tried a couple of sorting but seems I lose the partition on option_id no matter how I do.

              Do you expect it? Or are there any ways to keep the partition?

              Regards,

              Yu

            • megan_mcp

              Administrator
              August 22, 2024 at 12:38 pm

              Hi @Yu

              Sorry my mistake .. sorting the time by ascending order wasn’t the error.

              In the exercise it states “This should have two extra columns – bid and ask”

              I’ve noticed you have formatted your table to have your ask column before your bid column which has resulted in the formatting being incorrect.

              I’ve tested your code by swapping the two columns and the test passed.

              Hope this helps.

              Megan

            • Yu

              Member
              August 22, 2024 at 12:44 pm

              Megan,

              Ah, it finally worked.

              Thank you very much for the advice!

              Regards,

              Yu

Log in to reply.