I want to perform backtest on Hang Seng Index Futures
I have got the data
you can see the data and data format with this link
But it just considered the Index Point as USD and there is no contract multiplier for that.
so anyone got any ideas?
QUANTCONNECT COMMUNITY
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.
Mia Alissi
Based on the provided code, it seems that 'Ma' is trying to backtest a trading strategy on the Hang Seng Index Futures using custom data. The custom data is read from a CSV file hosted on a remote server. The data includes date, open, high, low, close, and volume information.
The code appears to be correctly structured for the most part. However, there are a few potential issues that might arise:
The
HSI
class, which is a custom data type, is used to parse the CSV data. TheReader
method in this class is responsible for parsing each line of the CSV file. It correctly checks if the line is not empty and if the first character is a digit before proceeding. However, it does not handle potential exceptions that might occur during parsing, such as aValueError
if the data cannot be converted to a float. It would be a good idea to wrap the parsing code in a try-except block to handle potential exceptions.The
CustomAlgorithm
class is the main algorithm class. It correctly initializes the algorithm, adds the custom data, sets up the indicators, and defines the trading conditions. However, the trading conditions are quite complex and might not always be met, which could lead to infrequent trades. It would be a good idea to review these conditions and adjust them if necessary.The
OnData
method in theCustomAlgorithm
class is responsible for executing trades based on the trading conditions. It correctly checks if the algorithm is still warming up and if the slice contains the required symbol before proceeding. However, it does not handle potential exceptions that might occur during order placement, such as anInsufficientBuyingPowerException
if there is not enough cash to place an order. It would be a good idea to wrap the order placement code in a try-except block to handle potential exceptions.The
OnData
method also updates the stop price of the stop market order if the order has been filled and the new stop price is greater than the old one. However, it does not check if the stop market order is still active before updating it, which could lead to an error if the order has already been canceled or filled. It would be a good idea to check the status of the order before updating it.The
OnData
method places market orders, stop market orders, and limit orders based on the trading conditions. However, it does not keep track of these orders or cancel them if the trading conditions change. It would be a good idea to keep track of these orders and cancel them if necessary.Please note that these are potential issues and might not actually cause any problems during backtesting. It would be a good idea to run the backtest and review the results and logs to identify any actual issues.
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.
Jacob Amaral
Figured it out, thought I'd share to help the community since no one posts there answers lol
Ma Ho Tung
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!