KX Community

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

Home Forums KX Academy Fundamentals Capstone 5.2 length error

  • Fundamentals Capstone 5.2 length error

    Posted by Kenan 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 replied 9 months 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

    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.

Log in to reply.