Back to Posts
Listen to Thread

How can I take inflation and exchange rates - between the currency required to buy the stock and the investors home currency - into account when back-testing the value of an algorithm?

The first so I know my algorithm can outperform inflation, the second so I know whether if I invest in American stocks (in usd) might I find my returns significantly different when converted back to my home currency (gbp).

While we're at it, could you also take capital gains tax into account?

Also - :P - in a live-trading situation, could these be used for decision making? E.g. If the value of the dollar starts falling against the value of the pound at a fast rate, could you close positions and convert back to home currency? How does quantopian plan to handle home currencies in their live trading solution when it becomes available?

Also, is there any way to take a stocks reputation for paying dividends into account when deciding to buy? Can dividends be reflected in a backtest?

Sorry if I've been asking too many questions on this forum :P

Hello Adam,

Regarding performance relative to inflation, perhaps you could write a separate algorithm to buy a comparative security (e.g. sid(38986), Vanguard Short-Term Govt Bd Idx ETF (VGSH)) or a basket of securities. In other words, create your own benchmark.

Nice idea. Would there be a way of adding the inflation as a second benchmark line?

Adam, that is a great list of questions. The short answer, of course, is that anything is possible with code. The longer answer is about prioritization, which things we're going to make easier soonest.

  • We don't have any near-term plans to build in other currencies. That definitely is something that could be built as a function within Quantopian or Zipline. You generally want to compare your algo's performance to the benchmark. I think one way to do it would be to compare your algo to a benchmark that is the S&P traded in pounds. Or, use the Sharpe ratio. It currently shows how your algo is doing compared to the "no-risk" US Government bonds. You could re-compute the Sharpe in your algo and compare it to a different signal, like British bonds.
  • Taxation is also possible, but very complex. There are thousands of different tax regimes across the world. There are a lot of things for us to do before we tackle that gnarly problem!
  • Using currencies as trading signals is definitely on our list - sooner than tax information, for sure. We want to make it easy to add almost any signal to your algorithm, and currency behavior is very high on the list.
  • We haven't put dividends into our database yet, but that is pretty high on the list. We'll do it this winter, I think.

As for adding a second benchmark line, I really want to do that. We've been doing some early design work on adding to our graphing capability. The way it would work is that in your initialization code you'd declare certain variables to be graph able. During your event handling you'd update the value of the variables. Then, in the backtest, you can see your data as a line on the graph. Any feedback on that idea?

Thanks for all the questions Adam. Let me know if I didn't answer one.

Log in to reply to this thread.
Not a member? Sign up!