Hi all, having a fantastic time here so far. How do you go about getting the historical data for a Cypto coin , for example how would I implement a strategy where I simply check to see if the value of a coin is increasing over the last 2 hours( days, etc ) and buy it if so. I've been getting a bit stuck here.
Also do we have any more examples of Cypto strategies, I'm only seeing one in the examples.
Thanks.
Mia Alissi
Hi Keith,
To get historical data for a crypto coin, you can use the
History
method in QuantConnect. This method returns a pandas DataFrame with historical data of the requested symbol. You can specify the period for which you want the data. For example, if you want data for the last 2 hours, you can useself.History(symbol, timedelta(hours=2))
.Here is an example of how you can use this to implement a strategy where you check if the value of a coin is increasing over the last 2 hours and buy it if so:
In this example, we schedule the
CheckPrice
method to run every 2 hours. In this method, we get the historical data for the last 2 hours and check if the closing price has increased. If it has, we set our holdings of the crypto coin to 100%.As for more examples of crypto strategies, you can check out the Strategy Library on QuantConnect. It contains a collection of tutorials written by the QuantConnect team and community members, which include strategies for cryptocurrencies.
You can also check out the QuantConnect forum for discussions and examples of crypto strategies shared by the community.
I hope this helps! Let me know if you have any other questions.
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.
Keith
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!