Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Robin hood live trading

I am wondering if someone would be able to help me put this algorithm into the Robinhood framework, it is using unsettled funds to make purchase orders causing my portfolio to have a negative value. I am still just learning how to build algorithms but since I want to go live with this algorithm I want to make sure its done the proper way.

6 responses

I'm no expert, but I'll take a stab. It's being executed every minute and trying to order every time the conditions are met. I changed the schedule to run only at open. Second, I put in a check to make sure that it isn't trying to sell shares you don't own.

Your money management is the biggest issue. Currently you can only hold two positions at a time since is set to buy 50%. I changed it a little so buys are made based on how much cash is available. Returns are diminished, though you're not using negative cash. Should give you something to play around with.

Please correct me if I'm wrong, but if Dave's Algo didn't solve the problem you may need to look at line 14 on his
14: trade = context.portfolio.cash / 4
context.portfolio.cash is a sum of both settled and unsettled funds while context.account.settled_cash ignores unsettled funds
14: trade = context.account.settled_cash / 4

william,

This logic for entering long position

if rsis[stock] < context.LOW_RSI and sma_10 < sma_30:  

is pretty dangerous in bear market.
I would recommend to backtest algo from 2007 before turning it live.

Nice catch Ethan. I use Robinhood Instant so unsettled funds aren't an issue.

Dave, thank you so much for the help. being so new to this there are things in your code I would have never even considered or thought of so thank you again.
and Ethan thank you also I wasn't sure about the difference between context.portfolio.cash and context.account.settled_cash or I should say I wasn't positive if context.portfolio.cash used unsettled funds or just cash available. so thank you for making that clear

Vladimir, Thank you for the warning. Ideally I would only like to sell my long positions after a 10% profit is made but like i said before being so new to coding and building algorithms i am not sure how to put that into the elif part of the algo if you could help that would be much appreciated.