Ad
  • Default User Avatar

    What Kata is this a duplicate of? Is it maybe "Equal to 24"? In this case, this Kata would not be an exact duplicate, since here parentheses are not allowed here whereas they are in "Equal to 24". Hence, this could be considered an easier version of "Equal to 24".

  • Default User Avatar

    I tried solving the Kata, not knowing that it is a duplicate. Just wanted to let you know that I could solve, so your description is clear and everything works. Looking forward to your next Kata!

  • Default User Avatar

    @uttumuttu's second suggestion to describe VAR was helfpul for me: "The simplest explanation (of VAR) is that each equity's total shifts are obtained as the relative shifts of its currency-converted price series." I enjoyed the kata because it not only allowed me to practice Python but also to learn about VAR.

  • Default User Avatar

    Hi Reswin,

    thanks for the hint.
    i did add the provided and the expected results for teh large randomized tests.

  • Default User Avatar

    Hi Marty,
    this was very helpful, thank you. My solution now passes all the description related tests and most of the random larger tests. The output I am getting for the failed tests is "False should equal True", which does not help me in finding my error(s). Would it be possible to change this to something like: "get_var is returning incorrect value: 96.02 should equal 104.89"?

  • Default User Avatar

    Hi Reswin,

    VAR is not additive ( not over the different assets, nor for the different risk-classes).
    You cannot calculate the VAR for one Equity(-position) and then add another.
    You have to calculate the potential, relative shifts (based on the history) for your whole position, and then (sort and) calculate the VAR for the whole position.

    (i marked the first comment as a spoiler. That's why it is "hidden")

  • Default User Avatar

    I could solve my problem with rounding: I rounded past relative shifts to 6 digits because you wrote you rounded them to 6 digits (for better readability). I can pass the tests if I don't round.

    I am still struggling with how VAR is calculated, except for the simple cases where only one equity is involved.

    @Marty3000: I cannot see your comment, you seem to have hidden it.

  • Custom User Avatar

    There is an error in the description, specifically in the example for past relative shifts:

    [0.044444, -0.010638, -0.021505, -0.010989, 0.111111, 0.04, -0.009615, -0.019417, -0.019802, 0.0]
                                                                                            Error ^
    

    That last item should be 0.010101. It is correct in the sample tests, but not in the description.

  • Default User Avatar

    I am having two issues:

    (1) I seem to have a problem with rounding, as I am getting this error message in the tests: "1-Day Equity Value at Risk for your 100 MartyCorp - Equities and a confidence level of 0.90 is 206.54 USD: 206.53 should equal 206.54"

    (2) It's not clear to me how to calculate total VAR for equtiy and foreign exchange risk. For each day I calculate the value shift due to the change in equity rates and the change in foreign exchange rate and I then add the two amounts.
    I am enjoying this kata and would appreciate a hint so that I can finish it.