I have tried to use vix data with
from QuantConnect.Data.Custom.Fred import *
class FocusedLightBrownDolphin(QCAlgorithm):
def Initialize(self):
# set up
self.SetStartDate(2005, 1, 1)
# self.SetEndDate(2020, 5, 1)
self.SetCash(50000)
self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Margin)
self.vix = self.AddData(Fred, Fred.CBOE.VIX).Symbol
but I got an error:
Algorithm.Initialize() Error: During the algorithm initialization, the following exception has occurred: Loader.TryCreatePythonAlgorithm(): Unable to import python module ./cache/algorithm/main.pyc. AlgorithmPythonWrapper(): ModuleNotFoundError : No module named 'QuantConnect.Data.Custom.Fred'; 'QuantConnect.Data.Custom' is not a package
at <module>
from QuantConnect.Data.Custom.Fred import *
===
at Python.Runtime.PythonException.ThrowIfIsNull(IntPtr ob)
at Python.Runtime.PythonEngine.ImportModule(String name)
at Python.Runtime.Py.Import(String name)
at QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper..ctor(String moduleName) at /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/AlgorithmFactory/Python/Wrappers/AlgorithmPythonWrapper.cs:line 74
in main.py: line 1
ModuleNotFoundError : No module named 'QuantConnect.Data.Custom.Fred'; 'QuantConnect.Data.Custom' is not a package Stack Trace: During the algorithm initialization, the following exception has occurred: Loader.TryCreatePythonAlgorithm(): Unable to import python module ./cache/algorithm/main.pyc. AlgorithmPythonWrapper(): ModuleNotFoundError : No module named 'QuantConnect.Data.Custom.Fred'; 'QuantConnect.Data.Custom' is not a package
at <module>
from QuantConnect.Data.Custom.Fred import *
===
at Python.Runtime.PythonException.ThrowIfIsNull(IntPtr ob)
at Python.Runtime.PythonEngine.ImportModule(String name)
at Python.Runtime.Py.Import(String name)
at QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper..ctor(String moduleName) at /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/AlgorithmFactory/Python/Wrappers/AlgorithmPythonWrapper.cs:line 74
in main.py: line 1
ModuleNotFoundError : No module named 'QuantConnect.Data.Custom.Fred'; 'QuantConnect.Data.Custom' is not a package (Open Stacktrace)
Fred Painchaud
Hi Mislav,
Yes, “Fred” is not in there.
I believe maybe this
and this
might help you.
Tell me if they don't.
Fred
Vladimir
Mislav Sagovac,
Try to replace
self.vix = self.AddData(Fred, Fred.CBOE.VIX).Symbol
by
self.vix = self.AddData(CBOE, "VIX").Symbol
Mislav Sagovac
I have tried first data source (CBOE):
Fred Painchaud
Hi Mislav,
Hmmm, I am sorry about this. Indeed, the examples seem outdated. It looks like the data is not available anymore or if available, available in some other ways.
I tried to find that/those other way/s.
This link seems interesting:
It is very specific VIX data however so it might not cover your need. Sorry if it does not.
I also found this:
and this:
but they don't work anymore.
It looks like VIX data was removed and is not available for free in QC Cloud anymore……..
You could download the data here:
https://www.cboe.com/tradable_products/vix/vix_historical_data/
And then load it into QC through Custom Data:
But that would need some customization if you want to live trade using VIX (re-fetch the CSV each day to get the latest day data, etc)
Fred
Mak K
Hi Mislav, Fred,
VIX data is still available for free on Quantconnect however it is not live data, the data is T+2 I believe and to add it to your algo you need to put this line in your initialize and remove the import line, that one doesn't work anymore for some reason;
And this in your OnData or wherever you plan to use it;
Options are also available for VIX I believe, if you need code for that let me know and I will look it up.
Thanks!
Fred Painchaud
Hi Mak,
I believe options are in my post above:
Just in case…
And thanks for the CBOE trick.
For the sake of everyone, it is fetched from QuantConnect.Data.Custom.Intrinio.IntrinioEconomicDataSources now. It is automatically imported in the Cloud.
Fred
Mislav Sagovac
Thanks for help!
How to import CBOE data?
This returns error:
from QuantConnect.Data.Custom.CBOE import *
Mak K
Hi Mislav,
You don't need any import lines anymore, it is fetched automatically, hope it's clear now, let me know if you have further questions!
Thanks!
Fred Painchaud
Hi Mislav,
Mak already mentioned “and remove the import line” in his post. So you need to remove it, it is no longer correct, as stated also.
That's if you work in the Cloud.
If you work locally, you need to import “QuantConnect.Data.Custom.Intrinio.IntrinioEconomicDataSources”, as mentioned in my post, so “from QuantConnect.Data.Custom.Intrinio.IntrinioEconomicDataSources import *”.
Fred
Arthur Asenheimer
How about
?
And in case you also need index options you can do:
Refer to the following pages in datasets:
Mislav Sagovac
Mak K
I am still getting an error:
I have removed part where I import CBOE from custom data
Mislav Sagovac
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!