Back

Buying Futures Using MarketOrder

Could someone tell me how I can place a Market open order for a Future on Natural Gas?

I am trying to back test the following Natural Gas Future from Quandl SCF database "SCF/CME_NG1_OB".

Should my code be using either:

MarketOnOpenOrder("SCF/CME_NG1_OB", numberOfContracts*ContractSize);

OR

MarketOnOpenOrder("SCF/CME_NG1_OB", numberOfContracts);

OR

another method?

If i use numberOfContracts*ContractSize then the number becomes a long not an int, since for natural gas the contractSize is 10,000,000,000.

 

Appreciate the help.

Update Backtest








Quandl data is a special kind of custom data since it is a build-in custom data. Nonetheless, it is custom data and the engine does not know that 1 contract has a given lot size. Therefore, we should use

​​​​​​​MarketOnOpenOrder("SCF/CME_NG1_OB", numberOfContracts);

Knowing the lot size, we can round of the number of contracts and only submit trades with multiples of lot size (10 000, 20 000, 30 000, etc in Natural Gas case).

In the past month, QuantConnect has launched its Futures and Options suppport. We can backtest and live trade futures contracts. Please checkout the attached project.
In this case, the data is not custom and has information about the asset (lot size, minimum price variation, etc). For instance, if you buy 1 lot of /NG, you are buying 10 000 units of it.
Note that at this moment we just have minute resolution data for futures. You will need to write some extra logics to set a MarketOnOpenOrder. 

0

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.


Update Backtest





0

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.


Loading...

This discussion is closed