Challenge Question - Intermediate level(Python(5+yr exp)) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

31st Dec 2022, 12:30 PM
Patrick ONeil
Patrick ONeil - avatar
2 Answers
0
could you please provide us complete code
8th Jan 2023, 4:07 PM
Rajababu Shah
Rajababu Shah - avatar
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 ....
9th Jan 2023, 3:44 PM
Patrick ONeil
Patrick ONeil - avatar