Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This is now fixed.
The
check_list
test function always returnsTrue
if one of the arrays is empty.Description for VAR is extremely dense; it definitely requires much more description on what should be used for the calculation of predicted gain/loss. Even the description in Investopedia provides a formula and denotes each term, which is infinitely easier to understand than the current kata description (which is hopeless to grasp).
The argument name in the code is misleading:
It is not an
asset
, it'sasset | currency
.Similarly, typo:
convidence
->confidence
. Tests also usesconv
whenconf
should be the correct term.Test messages are kind of unacceptable:
it only shows the expected value, but not the actual value.
This comment is hidden because it contains spoiler information about the solution
permutation tests
is passing in a tuple instead of a list.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 :-)
I would say this kata is pretty tough to solve, but I'm glad I finally completed it after 3 days of thoughts.
I liked this kata, but some parts of kata were pretty unclear to deal with. Still, I managed to resolve them and, with some accuracy tricks, I passed this problem.
Thanks for the kata! :)
No lists were harmed in this solution!
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:
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 ).
@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.
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.
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
nor
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.
Loading more items...