universal-portfolios
universal-portfolios copied to clipboard
Question about data and TCO algorithm
Sorry, I'm poor in coding, and have some question.
- What is the type of data (nyse_o, sp500, and so on.)? It dosen't looks like "raw stock price" or "price relatives".
- About TCO1 algorithm, I want to know what are "p" and "history"?
- 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()