Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Please Help...Interest rate environment algo

Hi guys,

I'm new to quantopian so I don't know if it's ok to ask for help in this Forum...

I wanted to create a simple algo, based on the current interest Environment in relation to the 12-month average.

Rules:
Be invested in the S&P500 if:
- the current interest rate for 0.5 Year Treasuries is lower than its 12-month average
- the current interest rate for 3 Year Treasuries is lower than its 12-month average
- the S&P500 trades currently above its 12-month average

else:
be investet in cash (iShares Money Market as Proxy)

Sadly it doesn't work (it's not generating any trades) and I'm not able to solve the issue (even with the very useful Docs).

I'm thankful for ANY suggestions.
Thank you!
Best,
Emanuel

2 responses

Welcome! Sure this is a great place to get help.

The biggest issue with the algo is that it never scheduled the 'trade' method so it never got executed. Add this line in 'initialize'.

    schedule_function(trade, date_rules.every_day(), time_rules.market_open())

There were a few other issues too. Attached is an algo that runs and trades. Good luck.

Awesome! Thanks Dan