I'm trying to create and test an alpha offline providing custom data to it. I have the custom data working with an algorithm, but am struggling to get it working with an alpha. Can you use custom data with an alpha?
QUANTCONNECT COMMUNITY
I'm trying to create and test an alpha offline providing custom data to it. I have the custom data working with an algorithm, but am struggling to get it working with an alpha. Can you use custom data with an alpha?
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.
Rahul Chowdhury
Hey Sam,
It is possible to use custom data with AlphaModels. There are two ways to do it.
class Main(QCAlgorithm): def Initialize(self): ... self.SetAlpha(MyAlphaModel(self)) class MyAlphaModel(AlphaModel): def __init__(self, algorithm): algorithm.AddData(MyCustomData, "CustomDataTicker")
Â
Sam Smucker
That did it for me :) I originally had it asÂ
AddData<CryptoData>("BTCUSDT", Resolution.Minute) var symbols = new[] { "BTCUSDT" } .Select(x => QuantConnect.Symbol.Create(x, SecurityType.Crypto, Market.GDAX)); SetUniverseSelection(new ManualUniverseSelectionModel(symbols));
Which would throw some kind of error that it couldn't find "BTCUSDT". I think it threw the error because the data was labeled as "BTCUSDT.CRYPTODATA" and the Universe Symbol was "BTCUSDT".Â
I realized my error when I carefully read yourÂ
1. Call AddData in the main class and pass its symbols to ManualUniverseSelectionModel
The error went away when I changed it to:
var s = AddData<CryptoData>("BTCUSDT", Resolution.Minute); SetUniverseSelection(new ManualUniverseSelectionModel(new Symbol[] { s.Symbol }));
Big thank you!
Sam Smucker
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!