KX Community

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

Home Forums KX Academy fundamentals capstone 4.7

  • fundamentals capstone 4.7

    Posted by Kal8na on April 13, 2024 at 1:43 pm

    In 4.7 exercise I don’t understand how to implement the code for it. maybe I don’t understand what the question is asking. can you please explain this?

    lestat-jin replied 6 months ago 4 Members · 5 Replies
  • 5 Replies
  • megan_mcp

    Administrator
    April 15, 2024 at 9:12 am

    Hi @kal8na

    Let me break down question 4.7 for you:

    There are a few different ways this can be done but using iteration is included as a suggestion.

    Let me know if you require further assistance.

    Thanks,

    Megan

    • lestat-jin

      Member
      June 19, 2024 at 1:42 pm

      just to borrow the thread as I’m stuck on this as well: so I managed to complete the task with script:

      edgeCor:`edge`qty`numTrds!(1;cor[timeSeries[`edge];timeSeries[`qty]];cor[timeSeries[`edge];timeSeries[`numTrds]])

       

      the output is a dictionary with type 99h and values of 1 0.8059053 0.7830214

      however it failed the section testing with 4.7 error: “edgeCor Has Correct Format”

       

      I didn’t implement it with iterators but I don’t think that is the reason it failed the test. not sure why it says incorrect format–do I need to output values in percentage terms (there is no way in Q to output a numeric in % without converting it into string first?)

       

      any ideas please? thanks!

    • lestat-jin

      Member
      June 20, 2024 at 12:03 pm

      using a different approach and now it passed the section testing:

      corKey:`edge`qty`numTrds

      correlations:cor[timeSeries[edge]] each timeSeries[corKey]

      edgeCor:corKey!correlations

       

      the results visually identical, though the earlier approach failed with 4.7 format testing:

      edgeCor:`edge`qty`numTrds! (1;cor[timeSeries[`edge];timeSeries[`qty]];cor[timeSeries[`edge];timeSeries[`numTrds]])

      would be good to understand why (cannot see how the testing function 4.7 written so cannot debug…) Thanks.

       

      P.S. apologies borrowing the thread, let me know if should create a separate discussion for this.

       

      • Laura

        Administrator
        June 21, 2024 at 4:17 pm

        Hi,

        Don’t worry about jumping on the thread, it’s good to have it on one thread to help others!

        I ran your two solutions and then ran

        type each edgeCor 

        on each.

        And while the output dictionary looked the same for both outputs, using the input of “1” in your first attempt defaulted the types to:

        edge   | -7
        qty | -9
        numTrds| -9

        when the correct types should be (and are in your second attempt)

        edge   | -9
        qty | -9
        numTrds| -9

        Hope this helps!

        Laura

        • lestat-jin

          Member
          June 26, 2024 at 6:46 pm

          I see, should be 1.0 in the manual construction, thanks a lot!

Log in to reply.