Ad
  • Default User Avatar

    Thanks for your kind words.

    i happy the the sheer length of the kata-description-text did not scare you away from this kata ( since i think the that the underlying topic is pretty interesting ).

    Have a nice day :-)

  • Default User Avatar

    i think that carloscerro is right.

    The valuation-test seems to rely on an unchanged input variable.

    please check the following code. It will fail for the first basic test (One toggle), but will succeed if you out-commend the lines 2 and 3:

    def solve(puzzle):
      if 0 < len(puzzle):
        puzzle[0][0] = (puzzle[0][0] + 1) % 2
      return [(1, 1)]
    
  • Default User Avatar

    Hi Reswin,

    thanks for the feedback.
    In fact, uttumuttu did a good job and seems to be very clever in general.

    PS:
    This kind of approach ( using past or self-defined relative shifts for the risk-factors ) is not only used to calculate Vaule-at-Risk, but also other by risk-measures like "expected shortfall", or scenarios ( e.g. black friday ) or sensitivities ( checking how much win/loss e.g. a yield shift of 1% would induce ).

  • Default User Avatar

    Sorry have written, before thinking:

    VAR is not sub-additive in both dimensions ( over Risk-Classes and over sub-Positions ).

    Will modify th desciption accordingly.

  • Default User Avatar

    Hi uttumttu,

    thanks a lot for your input.
    Since i am very new to writing kata, i do need some help indeed.
    It's in fact a thin line between spoiling too much of the algorythm/implementation or potentially frustrate someone trying to solve it.

    i don't know, if that is common practise, but feel free to apply some your suggestions to the description, as well.

    I added the following section ( it's near the end ), but i do get the feeling, that the whole kata description may be too long now ( distracting interested people ) for such a relative simple calculation :

    We had no Forex risk involved in this example, since the equity was listed in your base-currency.
    Please ensure that the shifts of the foreign currency are taken into account, as well, when calculating the 'Total'-VAR for a foreign-currency-equity-positions.

    You then might notice some kind of strange behaviour of your VAR-results:
    VAR is not additive !

    So neither

    total VAR = equity VAR + currency VAR
    

    nor

    VAR(EQ_all) = VAR(EQ1) + VAR(EQ2)
    for an Equity position EQ_all that consists fo Equity position 1 ( EQ1 ) + Equity position 2 ( EQ2 )
    

    In fact, the VAR for a given position might be lower or equal than the sum of the VAR of it's parts.

    When looking at the different Riskclasses, it's even 'worse': The total-VAR can be lower, equal or bigger than the sum of equity-VAR and currency-VAR.

    Keep in mind, that the Value-at-Risk measurement is based on the potential top losses (relative shifts) only. And these top losses ( for individual equities or riskclasses ) may have occurred on different historical days ( for the equities/riskclasses ) involved.

  • 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 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

    Thanks a lot, awsomead.
    Your're awesome ( and that's not only a lame joke ).
    description is updated.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Shame on me,
    thanks for point out these issues.

    Should be fixed, now.

  • Default User Avatar

    Hi Uttumuttu,

    i added a short section describing the difference in underlying Quantile-definition between the common VAR-approach and the numpy.quantile method.
    And the two digit round for the VAR Result.

    thanks a lot for your comment.

  • Default User Avatar

    thanks for your comments.
    you are absoulutly correct.
    Un-published the kata for now and will revise/fix these issues.

  • Default User Avatar

    thanks for your comments.
    you are absoulutly correct.
    Un-published teh kata for now and will revise/fix these issues.

  • Default User Avatar

    Issue should be resolved

  • Default User Avatar

    ok.
    So i added a section with randomized tests.

    In order to validate the results of these test, i had to add my solution into the "Test Cases" section ( and do need to execute my solution on the randomized input data, as well ).
    Is there a better way to do this ( validation of randomized tests ) ?
    i guess the calculation time that my solution needs, will now be part onto the total Validation time ( < 12 000 ms).

  • Loading more items...