Ejemplo n.º 1
0
 def get_quantiles(self, n):
     """Return a list of analysers for n quantiles."""
     return [IntAnalyser(qt, IntPerformance.get_returns(self.startdate, self.freq)) \
             for qt in api.quantiles(self.alpha, n)]
Ejemplo n.º 2
0
 def get_qtail(self, q):
     """Long the top quantile and at the same time short the bottom quantile."""
     return IntAnalyser(
         api.qtop(self.alpha, q).astype(int) -
         api.qbottom(self.alpha, q).astype(int),
         IntPerformance.get_returns(self.startdate, self.freq))
Ejemplo n.º 3
0
 def get_ntail(self, n):
     """Long the top n stocks and at the same time short the bottom n stocks."""
     return IntAnalyser(
         api.top(self.alpha, n).astype(int) -
         api.bottom(self.alpha, n).astype(int),
         IntPerformance.get_returns(self.startdate, self.freq))
Ejemplo n.º 4
0
 def get_nbottom(self, n, index=None):
     """Only analyse the bottom n stocks as long holding."""
     return IntAnalyser(api.bottom(self.alpha, n), IntPerformance.get_returns(self.startdate, self.freq),
             IntPerformance.get_index_returns(self.startdate, self.freq, index=index)) \
            if index is not None else \
            IntAnalyser(api.bottom(self.alpha, n), IntPerformance.get_returns(self.startdate, self.freq))
Ejemplo n.º 5
0
 def get_qbottom(self, q, index=None):
     """Only analyse the bottom quantile as long holding."""
     return IntAnalyser(api.qbottom(self.alpha, q), IntPerformance.get_returns(self.startdate, self.freq),
             IntPerformance.get_index_returns(self.startdate, self.freq, index=index)) \
            if index is not None else \
            IntAnalyser(api.qbottom(self.alpha, q), IntPerformance.get_returns(self.startdate, self.freq))
Ejemplo n.º 6
0
 def get_short(self, index=None):
     """Only analyse the short part."""
     return IntAnalyser(-self.alpha[self.alpha<0], IntPerformance.get_returns(self.startdate, self.freq),
             IntPerformance.get_index_returns(self.startdate, self.freq, index=index)) \
            if index is not None else \
            IntAnalyser(-self.alpha[self.alpha<0], IntPerformance.get_returns(self.startdate, self.freq))
Ejemplo n.º 7
0
 def get_longshort(self):
     """Pretend the alpha can be made into a long/short portfolio."""
     return IntAnalyser(
         api.neutralize(self.alpha),
         IntPerformance.get_returns(self.startdate, self.freq))
Ejemplo n.º 8
0
 def get_original(self):
     """**Be sure** to use this method when either the alpha is neutralized or you know what you are doing."""
     return IntAnalyser(
         self.alpha, IntPerformance.get_returns(self.startdate, self.freq))