KX Community

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

Home Forums KX Academy Fundamentals Capstone 5.2 length error

  • Fundamentals Capstone 5.2 length error

    Posted by kenan_davidsonyahoo-com on March 25, 2024 at 7:02 pm

    5.1 is correct and passes and I’m stuck with a length error for 5.2.

    Here is my code:

    avgEdgePerOption: select avgEdge: avg edge by option_id from trade where date = last date

    edgeProfile: select numTrds: count i, avgEdge: avg edge, minQty: min qty, maxQty: max qty by option_id from trade where date = last date, edge > avgEdgePerOption[`avgEdge]

    kenan_davidsonyahoo-com replied 1 month ago 2 Members · 2 Replies
  • 2 Replies
  • megan_mcp

    Administrator
    March 26, 2024 at 10:17 am

    Hi @Kenan

    The problem lies with your last bit of code ‘edge > avgEdgePerOption[avgEdge]’.
    You are only able to index into a dictionary, not a table. So as avgEdgePerOption returns as a table, when you run ‘avgEdgePerOption[avgEdge]’ it returns nothing (screenshot below).

    This is what causes the length error as edge is a list and avgEdgePerOption[`avgEdge] is an empty dictionary.

    Hope this helps!

    Thanks,

    Megan🙂

  • kenan_davidsonyahoo-com

    Member
    March 26, 2024 at 9:31 pm

    Hi Megan,

    Thank you for your help. I pass all the tests but format for 5.2.

    This is my code:

    edgeProfile: select numTrds: count i, avgEdge: avg edge, minQty: min qty, maxQty: max qty by option_id from trade where date = last date, edge > avg edge

    I attached the test results and my schema for edgeProfile.

    • This reply was modified 1 month ago by  Kenan.

Log in to reply.