Marigold / universal-portfolios

Collection of algorithms for online portfolio selection
Other
779 stars 214 forks source link

Question about data and TCO algorithm #109

Open Yccc0903 opened 9 months ago

Yccc0903 commented 9 months ago

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()