Laguna wrote: > Hi Gurus, > > I want to find the expiration date of stock options (3rd Friday of the > month) for an any give month and year. I have tried a few tricks with > the functions provided by the built-in module time, but the problem was > that the 9 element tuple need to be populated correctly. Can anyone > help me out on this one? > > Thanks a bunch, > Laguna > > Requirements: > > d0 = expiration(9, 2005) # d0 would be 16 > d1 = expiration(6, 2003) # d1 would be 20 > d2 = expiration(2, 2006) # d2 would be 17 >>> import calendar >>> [y[4] for y in calendar.monthcalendar(2005, 9) if y[4]!=0][2] 16 >>> [y[4] for y in calendar.monthcalendar(2003, 6) if y[4]!=0][2] 20 >>> [y[4] for y in calendar.monthcalendar(2006, 2) if y[4]!=0][2] 17
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4