Question: Implement a user defined function (UDF) for Equation (3.1). The UDF is to be called calculate_btc_prices(btc_vol, btc_initial_price, datelist, rand_num) where btc_vol and btc_initial_price are the
Implement a user defined function (UDF) for Equation (3.1). The UDF is to be called calculate_btc_prices(btc_vol, btc_initial_price, datelist, rand_num) where btc_vol and btc_initial_price are the volatility of BTC and BTC price on the start date of analysis. datelist is a np.array providing the list of trading dates. rand_num is a np.array providing many values of Z that is needed to generate many BTC prices. The UDF is to return a dataframe of simulated BTC prices, to be indexed by dates.
Equation 3.1: St = St-1 exp (-0.5*vol^2*1/365 + vol*sqrt(1/365*Z) St, St-1 is the BTC prices on day t and t-1 respectively. Z is a random number drawn from a standard normal distribution.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
