Skip to content

Seeking Assistance with Index-Based Rotation Strategy Implementation #71

Answered by edtechre
McHill007 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @McHill007,

Sorry for the late response.

My strategy is based on the values of NASDAQ 100, S&P 500, DAX, and CAC 40. To conduct a backtest over multiple years (e.g., starting from the year 2000), I need a way to rotate stocks based on their index affiliation. Is there a possible solution for this?

You can use pybroker.param to store index constituents and check for membership in your strategy e.g.

pybroker.param('qqq', ...)

if ctx.symbol in pybroker.param('qqq'):

I am facing challenges when mixing stocks from different indices, such as NASDAQ 100 stocks with DAX stocks. This leads to an error: decimal.InvalidOperation: [<class 'decimal.InvalidOperation'>]. Is this due to different t…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by edtechre
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants