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

Update: slightly cleaned up code and buy mechanism

This is the one I am using now. It is still a bit rough and it is definitely a work in progress.

Credit goes to many people I reckon.
Thanks Peter Bakker for apparently resurrecting noko.csv and my Robin Hood VIX Mix Rogue Trader.
See https://www.quantopian.com/posts/robin-hood-vix-mix-rogue-trader#5a842f0d29805d177db7c877
Huge thanks to everyone especially Kory Hoang who contributed to Ballistic XIV.
See https://www.quantopian.com/posts/ballistic-xiv-slash-vxx-my-best-long-xiv-slash-vxx-strategy-to-date#5a7fc95d80c659001165d057
Huge thanks to those that contributed to the VIX MoreSignals aka BigSignal. That is what I call it. It is probably known by something else in other threads. I do not remember who did the most work on that, but it is much appreciated.

If you get a chance, take a look at Kory Hoang algo noted above. It did very well!

Kory's algo already is comfortable to sit in cash while still making nice profits. I think combining it with MoreSignals makes a slightly improved buying, selling, and sitting in cash mechanism.

15 responses

Charles, do you have this hooked up live to Robinhood or IB?

@Tyler
Short answer: Robinhood
Long answer: Both the algo and my Robinhood integration are still very much a work in progress.

Hi Charles, I see a lot of the sells going through at 4:00PM - are you manually trading this? Won't you miss the signal due to the 15 minute delay?

To simulate what the result would be if the whole period SVXY is 50% and UVXY is 75% of the performance see here! The metrics stay OK

Update: I deleted the previous post because I found some obvious logic errors. I tweaked the parameters and also added additional UVXY buy mechanism. I also made it run MoreSignals if not exist already. That could help if you start in middle of trading session.

@Thomas
Yes, sometimes trades are manual and on days that I have all my automation running correctly, then trades are automated. You are right. I noticed that potential problem too. In this version, I added a TooLateToAct trigger. So, if the condition for sale exists at 3 minutes after market open the next morning, then it will sell at that time. Of course you will not know until 18 or so minutes after market open. Obviously not a perfect situation. It is our reality as Quantopian paper trade users though. I very much appreciate Q for providing this platform.

Update: There was an obvious error in the post that I just now deleted. It had default to buy UVXY at market open. I also made some additional changes that are helpful. I made the stop loss to be variable according to signals.

Using this version now. It is unlikely to grab huge gains, like what was possible around Feb 5th, 2018. It does however seem to get steady returns if given enough time. It tends to be cash overnight if it had a good profit in trading session. That lowers overall return but also avoids overnight reversals. Still a work in progress.

Update: Changed the format of price logging to 2 decimal places.

Improved I think. Fixed a minor logging error. Restricted and added to buying and selling mechanisms. It struggles the most with the last six months and 2013 through early 2014.

Ever so slight improvement. Maybe you like. I tried to extract more profit from the "HaveToThink" #8 signal in MoreSignals by adding a conditional UVXY buy. Normally it only suggests SVXY for #8.

Feel free to ignore this version. I am using it as of now.

context.RobinHoodMargin = 0 # I prefer to not use margin.

MaxLeverage = 0.45 # Because we are day trading, we have to attempt to NOT use same day sell cash to buy shares, so that we can completely exit the same day if necessary. So 0.45 avoids that in a same - day sell, buy, sell situation.

Obviously, you should do what fits your situation / preferences.

A slight improvement.
Has a lower Max DrawDown
Always cash available, no rush sale just to make a withdrawal
Reasonable Risk Metrics
Pvr metrics seem good
2018-03-20 15:00 _pvr:735 INFO PvRp 1.5626 %/day cagr 0.856 Portfolio value 415818 PnL 350818
2018-03-20 15:00 _pvr:736 INFO Profited 350818 on 29697 activated/transacted for PvR of 1181.3%
2018-03-20 15:00 _pvr:737 INFO QRet 539.72 PvR 1181.32 CshLw 35302 MxLv 0.51 RskHi 29697 MxShrt 0

Sorry, yet I am confused on the function of TarPer you defined in this algo. I used the built-in order_target_percent, instead of your TarPer, and the result is totally different. Is this TarPer-style ordering more advanced?

@Di Wang,
I would not call it more advanced. It is a matter of personal preference. I like to customize the behavior. This way I know what it is doing.

I am surprised that so far no change to the RSI and Dispersion aka standard deviation seem necessary. I thought I would have to adjust those as a result of the changes that ProShares made to SVXY and UVXY effective February 28, 2018.
SVXY went from -1.0 exposure to -0.5.
UVXY went from +2.0 exposure to +1.5.
Performance since February 28 seems to be satisfactory so far.
I have not researched how RSI is calculated, so I don't know if that would need adjustment.
However, it does seem like standard deviation would result in different numbers after the change.

Thanks for sharing this. Just wondering How are you trading this live? I'm looking for options to port this. Quantconnect? MultiCharts? your own comp?

@Sam,
There has been much discussion in other threads.
I have a custom configuration on my laptop using TCL / Expect, PyAutoGUI, and Robinhood API.
My setup only executes the paper trade orders and they are always at least 15 minutes delayed, which is an obvious disadvantage.

@Charles,
Why do we need to wait for a 15 minutes delayed result, instead of trading with live data? Consider that you could already operate the robinhood api?