0
Challenge Question - Intermediate level(Python(5+yr exp))
Perpetual Rollover Dates within Quantitative Finance, find the nearest yet furthest price for crude oil from the example above. I have solved this and will show work. Good luck. https://www.sololearn.com/compiler-playground/cRTdl6Vzowgr
2 Answers
0
could you please provide us complete code
0
prices = load_crude_oil_prices() # any dataset
exp_dates = find_expiration_dates(prices)
nearest_prices = [] # init -> store
furthest_prices = [] # init -> store
for date in exp_dates: # loop
nearest_price furthest_price = find_nearest_furthest_prices(prices, date)
nearest_prices.append(nearest_price) # append
furthest_prices.append(furthest_prices)
volatilities = calculate_volatilities(nearest_prices, furthest_prices) # volatility without freq, still need weights of freq
....