예제 #1
0
 def forward(self, close_ts, volume_ts):
     ts = tsf.rolling_corr(close_ts, volume_ts, 2)
     return -1 * (tsf.rank(tsf.rolling_mean_(tsf.shift(close_ts, 5), 20)) *
                  ts * tsf.rank(
                      tsf.rolling_corr(tsf.rolling_sum_(close_ts, 5),
                                       tsf.rolling_sum_(close_ts, 20), 2))
                  )  # .values
예제 #2
0
 def forward(self, vwap_ts, low_ts, volume_ts):
     output_tensor = (
         tsf.rank(tsf.rolling_corr(vwap_ts, volume_ts, 4)) * tsf.rank(
             tsf.rolling_corr(tsf.rank(low_ts),
                              tsf.rank(tsf.rolling_mean_(volume_ts, 50)),
                              12)))
     return output_tensor
예제 #3
0
 def forward(self, high_ts, low_ts, close_ts, volume_ts):
     divisor = (tsf.rolling_max(high_ts, 12) -
                tsf.rolling_min(low_ts, 12)).replace(0, 0.0001)
     inner = (close_ts - tsf.ts_min(low_ts, 12)) / (divisor)
     ts = tsf.rolling_corr(tsf.rank(inner), tsf.rank(volume_ts), 6)
     output_tensor = -1 * ts
     return output_tensor
예제 #4
0
 def forward(self, high_ts, close_ts, volume_ts, vwap_ts):
     output_tensor = ((((tsf.rank(
         (1 / close_ts)) * volume_ts) / tsf.rolling_mean_(volume_ts, 20)) *
                       ((high_ts * tsf.rank((high_ts - close_ts))) /
                        (tsf.rolling_sum_(high_ts, 5) / 5))) - tsf.rank(
                            (vwap_ts - tsf.shift(vwap_ts, 5))))
     return output_tensor
예제 #5
0
 def forward(self, high_ts, low_ts, close_ts, volume_ts):
     output_tensor = tsf.rolling_corr(
         tsf.rank((
             (close_ts - tsf.rolling_min(low_ts, 12)) /
             (tsf.rolling_max(high_ts, 12) - tsf.rolling_min(low_ts, 12)))),
         tsf.rank(volume_ts), 6)
     return output_tensor
예제 #6
0
 def forward(self, close_ts, volume_ts):
     output_tensor = (-1 * (
         (tsf.rank((tsf.rolling_sum_(tsf.shift(close_ts, 5), 20) / 20)) *
          tsf.rolling_corr(close_ts, volume_ts, 2)) * tsf.rank(
              tsf.rolling_corr(tsf.rolling_sum_(close_ts, 5),
                               tsf.rolling_sum_(close_ts, 20), 2))))
     return output_tensor
예제 #7
0
 def forward(self, volume_ts, close_ts):
     output_tensor = (
         ((-1 * tsf.rank(tsf.ts_rank(close_ts, 10))) *
          tsf.rank(tsf.diff(tsf.diff(close_ts, 1), 1))) * tsf.rank(
              tsf.ts_rank(
                  (volume_ts / tsf.rolling_mean_(volume_ts, 20)), 5)))
     return output_tensor
예제 #8
0
 def forward(self, close_ts, open_ts, vwap_ts, volume_ts):
     output_tensor = (
         tsf.rank(tsf.diff(
             ((close_ts * 0.6 + open_ts * 0.4)), 1)) * tsf.rank(
                 tsf.rolling_corr(vwap_ts, tsf.rolling_mean_(
                     volume_ts, 150), 15)))
     return output_tensor
예제 #9
0
 def forward(self, high_ts, low_ts, close_ts, volume_ts):
     output_tensor = (tsf.rank(
         tsf.rolling_corr(
             ((high_ts * 0.9) + (close_ts * 0.1)),
             tsf.rolling_mean_(volume_ts, 30), 10))**tsf.rank(
                 tsf.rolling_corr(tsf.ts_rank(((high_ts + low_ts) / 2), 4),
                                  tsf.ts_rank(volume_ts, 10), 7)))
     return output_tensor
예제 #10
0
 def forward(self, high_ts, low_ts, volume_ts, vwap_ts, close_ts):
     output_tensor = ((tsf.rank(
         tsf.shift(((high_ts - low_ts) /
                    (tsf.rolling_sum_(close_ts, 5) / 5)), 2)) *
                       tsf.rank(tsf.rank(volume_ts))) /
                      (((high_ts - low_ts) /
                        (tsf.rolling_sum_(close_ts, 5) / 5)) /
                       (vwap_ts - close_ts)))
     return output_tensor
예제 #11
0
 def forward(self, vwap_ts, volume_ts, low_ts):
     output_tensor = (tsf.rank(
         tsf.rolling_corr(
             tsf.rolling_sum_(((low_ts * 0.35) + (vwap_ts * 0.65)), 20),
             tsf.rolling_sum_(tsf.rolling_mean_(volume_ts, 40), 20), 7)) +
                      tsf.rank(
                          tsf.rolling_corr(tsf.rank(vwap_ts),
                                           tsf.rank(volume_ts), 6)))
     return output_tensor
예제 #12
0
 def forward(self, close_ts, returns_ts):
     return tsf.rolling_min(
         tsf.rank(
             tsf.rank(
                 tsf.rolling_scale(
                     torch.log(
                         tsf.rolling_sum_(
                             tsf.rank(
                                 tsf.rank(-1 * tsf.rank(
                                     tsf.diff((close_ts - 1), 5)))), 2))))),
         5) + tsf.ts_rank(tsf.shift((-1 * returns_ts), 6), 5)
예제 #13
0
 def forward(self, volume_ts, vwap_ts):
     output_tensor = ((tsf.rank(
         (vwap_ts - tsf.rolling_min(vwap_ts, 12)))**tsf.ts_rank(
             tsf.rolling_corr(
                 tsf.ts_rank(vwap_ts, 20),
                 tsf.ts_rank(tsf.rolling_mean_(volume_ts, 60), 2), 18), 3))
                      * -1)
     return output_tensor
예제 #14
0
 def forward(self, close_ts, volume_ts):
     output_tensor = (-1 * ((tsf.rank(
         ((torch.sign((close_ts - tsf.shift(close_ts, 1))) + torch.sign(
             (tsf.shift(close_ts, 1) - tsf.shift(close_ts, 2)))) +
          torch.sign((tsf.shift(close_ts, 2) - tsf.shift(close_ts, 3)))))) *
                            tsf.rolling_sum_(volume_ts, 5)) /
                      tsf.rolling_sum_(volume_ts, 20))
     return output_tensor
예제 #15
0
 def forward(self, close_ts, returns_ts):
     zeros = torch.zeros(returns_ts.size())
     downside_stds = tsf.rolling_downside_std(returns_ts, zeros, 20)
     inner = close_ts.clone()
     cond = returns_ts < 0
     inner = torch.where(cond, downside_stds, inner)
     output_tensor = tsf.rank(tsf.ts_argmax(inner**2, 5))
     return output_tensor
예제 #16
0
 def forward(self, close_ts, volume_ts):
     delta_close = tsf.diff(close_ts, 1)
     inner = torch.sign(delta_close) + torch.sign(tsf.shift(
         delta_close, 1)) + torch.sign(tsf.shift(delta_close, 2))
     alpha = (
         (1.0 - tsf.rank(inner)) *
         tsf.rolling_sum_(volume_ts, 5)) / tsf.rolling_sum_(volume_ts, 20)
     return alpha
예제 #17
0
 def forward(self, low_ts, return_ts, volume_ts):
     output_tensor = ((
         ((-1 * tsf.rolling_min(low_ts, 5)) +
          tsf.shift(tsf.rolling_min(low_ts, 5), 5)) * tsf.rank(
              ((tsf.rolling_sum_(return_ts, 240) -
                tsf.rolling_sum_(return_ts, 20)) / 220))) *
                      tsf.rolling_min(volume_ts, 5))
     return output_tensor
예제 #18
0
 def forward(self, open_ts, returns_ts):
     output_tensor = -1 * (tsf.rank(
         ((tsf.rolling_sum_(open_ts, 5) * tsf.rolling_sum_(returns_ts, 5)) -
          tsf.shift((tsf.rolling_sum_(open_ts, 5) *
                     tsf.rolling_sum_(returns_ts, 5)), 10))))
     return output_tensor
예제 #19
0
 def forward(self, open_ts, high_ts, low_ts, close_ts):
     alpha = -1 * (tsf.rank(open_ts - tsf.shift(high_ts, 1)) *
                   tsf.rank(open_ts - tsf.shift(close_ts, 1)) *
                   tsf.rank(open_ts - tsf.shift(high_ts, 1)))
     return alpha
예제 #20
0
 def forward(self, low_ts, volume_ts, returns_ts):
     return ((-1 * tsf.diff(tsf.rolling_min(low_ts, 5), 5)) * tsf.rank(
         ((tsf.rolling_sum_(returns_ts, 60) - tsf.rolling_sum_(
             returns_ts, 20)) / 55))) * tsf.ts_rank(volume_ts, 5)
예제 #21
0
 def forward(self, open_ts, close_ts, volume_ts):  # volume
     output_tensor = -1 * tsf.rolling_corr(
         tsf.rank(tsf.diff(torch.log(volume_ts), 2)),
         tsf.rank((close_ts - open_ts) / open_ts), 6)
     return output_tensor
예제 #22
0
 def forward(self, high_ts, volume_ts):
     output_tensor = tsf.rolling_corr(high_ts, tsf.rank(volume_ts), 5)
     return -1 * output_tensor
예제 #23
0
 def forward(self, low_ts):
     alpha = -1 * tsf.ts_rank(tsf.rank(low_ts), 9)
     return alpha
예제 #24
0
 def forward(self, high_ts, volume_ts):
     alpha = -1 * tsf.rank(tsf.rolling_std(high_ts, 10)) * tsf.rolling_corr(
         high_ts, volume_ts, 10)
     return alpha  #
예제 #25
0
 def forward(self, open_ts, close_ts):
     inner = close_ts / open_ts
     alpha = -1 * tsf.rank(tsf.ts_rank(open_ts, 10)) * tsf.rank(inner)
     return alpha
예제 #26
0
 def forward(self, open_ts, close_ts):
     alpha = tsf.rank(
         tsf.rolling_corr(tsf.shift(open_ts - close_ts, 1), close_ts,
                          200)) + tsf.rank(open_ts - close_ts)
     return alpha
예제 #27
0
 def forward(self, close_ts, returns_ts):
     inner = tsf.rolling_std(returns_ts, 2) / tsf.rolling_std(returns_ts, 5)
     return tsf.rank(2 - tsf.rank(inner) -
                     tsf.rank(tsf.diff(close_ts, 1)))  # .values
예제 #28
0
 def forward(self, open_ts, close_ts):
     alpha = tsf.rank(-1 + (open_ts / close_ts))
     return alpha
예제 #29
0
 def forward(self, open_ts, volume_ts):
     output_tensor = -1 * tsf.rolling_corr(tsf.rank(open_ts),
                                           tsf.rank(volume_ts), 10)
     return output_tensor
예제 #30
0
 def forward(self, high_ts, close_ts, volume_ts):
     ts = tsf.rolling_cov(high_ts, volume_ts, 5)
     alpha = -1 * tsf.diff(ts, 5) * tsf.rank(tsf.rolling_std(close_ts, 20))
     return alpha