def quote_for_days_before(self, days_before): """ Finds the nearest quote to the days out delta provided for this maturity. """ date_looking_for = self._expiration_date - datetime.timedelta(days_before, 0, 0) target_quote = utility.find_nearest_of(date_looking_for, self._quotes, lambda x: x.quote_date()) return target_quote
def put_near(self, strike): """ Returns the put closest to the passed in strike price """ return utility.find_nearest_of(strike, self.puts, OptionsDay.strike, take_average_quote)
def nearest(self, date): return utility.find_nearest_of(date, self.vixdays, lambda x: x.date)
def nearest(self, date): if date not in self._cache: self._cache[date] = utility.find_nearest_of(date, self.vixdays, lambda x: x.date) return self._cache[date]
def nearest(self, date): if date not in self._cache: self._cache[date] = utility.find_nearest_of( date, self.vixdays, lambda x: x.date) return self._cache[date]