コード例 #1
0
ファイル: yfRef.py プロジェクト: maylathant/VIXVarSwap
 def setSpotHist(self, start, end):
     '''
     Get history of daily spot prices
     :param start: start date
     :param end: end date
     :return: Series of spot prices
     '''
     self.spotHist = yf.download([self.undl], start=start,
                                 end=incDate(end))['Close']
     return self.spotHist
コード例 #2
0
ファイル: yfRef.py プロジェクト: maylathant/VIXVarSwap
 def setSpot(self, spotDate=''):
     '''
     :param spotDate (string date):
     :return: void, sets self.spot price to spot of self.mydate
     '''
     spotDate = self.mydate if spotDate == '' else spotDate
     self.spot = yf.download([self.undl],
                             start=spotDate,
                             end=incDate(spotDate))['Close'][0]
     return self.spot
コード例 #3
0
ファイル: yfRef.py プロジェクト: maylathant/VIXVarSwap
 def setVolHist(self, start, end, name='^VIX'):
     '''
     Get history of daily spot prices and set to self variable
     :param start: start date
     :param end: end date
     :param name: Name of volatility parameter
     :return: Series of vol prices
     '''
     self.volHist = yf.download([name], start=start,
                                end=incDate(end))['Close']
     return self.volHist
コード例 #4
0
ファイル: yfRef.py プロジェクト: maylathant/VIXVarSwap
 def setVol(self, volDate='', volIndex='^VIX'):
     '''
     :param volDate: Date to pull (default is self.mydate
     :param volIndex: Name of volatility index in yahoo finance
     :return: vol index (scaler)
     '''
     volDate = self.mydate if volDate == '' else volDate
     self.volPoint = yf.download([volIndex],
                                 start=volDate,
                                 end=incDate(volDate))['Close'][0]
     return self.volPoint
コード例 #5
0
ファイル: yfRef.py プロジェクト: maylathant/VIXVarSwap
 def setVolIdx(self,
               volidx,
               scale=0.02,
               voldate='',
               flattener=1,
               spacing=0.05):
     '''
     :param volidx (string): Name of a vol index for which to base the skew
     :param scale (double): Scaling factor for vol skew
     :param voldate (string date): Date to pull volatility
     :param flattener (double): Scaling factor. Amount to flatten (or steepen) skew
     :param spaceing: Determines the courseness the grid of strikes (how far apart strikes are)
     :return: The skew with the volidx being the ATM point
     spaced apart by 1% of the underlying
     '''
     voldate = self.mydate if voldate == '' else voldate
     myvol = yf.download([volidx], start=voldate,
                         end=incDate(voldate))['Close'][0]
     return self.computeSkew(myvol, scale, flattener, spacing=spacing)
コード例 #6
0
ファイル: yfRef.py プロジェクト: maylathant/VIXVarSwap
 def getVolIdx(self,
               volidx,
               scale=0.02,
               voldate='',
               flattener=1,
               skip=True,
               spacing=0.05):
     '''
     :param volidx (string): Name of a vol index for which to base the skew
     :param scale (double): Scaling factor for vol skew
     :param voldate (string date): Date to pull volatility
     :param flattener (double): Scaling factor. Amount to flatten (or steepen) skew
     :param skip (bool): If true then just get self.vol
     :param spaceing: Determines the courseness the grid of strikes (how far apart strikes are)
     :return: Returns the current vol index with a different skew and sets it to self.vol
     '''
     if len(self.vol) < 1 or not skip:
         voldate = self.mydate if voldate == '' else voldate
         myvol = yf.download([volidx], start=voldate,
                             end=incDate(voldate))['Close'][0]
         return self.computeSkew(myvol, scale, flattener, spacing=spacing)
     return self.vol