universal-portfolios icon indicating copy to clipboard operation
universal-portfolios copied to clipboard

Question about data and TCO algorithm

Open Yccc0903 opened this issue 11 months ago • 0 comments

Sorry, I'm poor in coding, and have some question.

  1. What is the type of data (nyse_o, sp500, and so on.)? It dosen't looks like "raw stock price" or "price relatives".
  2. About TCO1 algorithm, I want to know what are "p" and "history"?
  3. And why it is "history.iloc[-2] / p" in reversal type? I study the paper, they use "1/xt" to predict next price relatives in TCO1.

Thanks for your help!

[TCO.py]

class TCO1(TCO): def init(self, type="reversal", **kwargs): self.type = type super().init(min_history=1, **kwargs)

def predict(self, p, history):
    if self.type == "reversal":
        return history.iloc[-2] / p
    elif self.type == "trend":
        return p / history.iloc[-2]
    else:
        raise NotImplementedError()

Yccc0903 avatar Feb 29 '24 14:02 Yccc0903