The grader for this task is using a function called “payoff” that is not defined anywhere. Hence my submission results into the error mentioned in the title.
I can define the function myself, but looking at the grader code, I see it is called like this: payoff(i, ins[1], ins[2], ins[3]), which means it does not get the strike price (K) as an argument (K is ins[0]). So, how is one supposed to define a function payoff without knowing the strike price?
hey @hayk28, run into the same problem at first. You have to define the payoff function. Look at the func definition here: QuantumMonteCarlo Docs, that should give you the hint on how to define your functions.
Hi @Javi512, thanks for your reply! I have already familiarized myself with the QuantumMonteCarlo docs and I know how to build its inputs. My problem is in principle not related to the MonteCarlo itself.
The payoff function internally used by the grader is not defined anywhere. I can define it myself, to get it running, but what should this function do? Does it return the terminal price of the basket? It certainly cannot return the payoff (as its name suggests), because it does not get K passed to it as argument (and I cannot edit it, because it is in the grading / immutable part of the code). Unless I am missing something obvious, this seems like a contradiction, and a flaw in the challenge definition (grader code)
Ok, for anyone else that came here because of the same problem - Neither the challenge description nor the template code tell you, but you have to define a function called payoff with the following arguments payoff(index, w, time, strike_price), where index is a number in range(64) identifying a grid point, the rest are self explanatory.
The internal code of the grader calls this function like payoff(i, ins[1], ins[2], ins[3]) where ins is the input. According to the challenge description the input is given in the order K, w, rho, T, but in reality it is rho, w, T, K, hence the payoff function does get the correct arguments needed for its calculation, contrary to what I thought earlier, that K is missing.