Back

Trading small orders with OANDA

Hi.

Oanda does allow its users to trade very freely, trading other quantity than lot/mini-lot/micro-lot sizes (for instance 53 456 EUR/USD and not either 53 000 or 54 000). That is also possible when using QC to trade on OANDA.

 

However, OANDA allows also to trade than micro-lot size of 1000.

But when using QC to trade on OANDA in backtesting mode, these orders of less than 1000 EUR/USD are not accepted, and we got the error message instead;

"Backtest Handled Error: Unable to submit order with id -10 which quantity (100) is less than lot size (1000)."

Is this a bug, that will be corrected, maybe by updating SetBrokerageModel(BrokerageName.OandaBrokerage)?

If it is not a bug, why do you prevent QC users to trade as freely on OANDA as they can be used to -when they trade on OANDA directly? 

Thanks for the answer.

Update Backtest







Hi Laurent Crouzet 
it seems you are using the default brokerage model for FXCM, which has a lot size of 1000 for EURUSD.

If you insert this line in the Initialize method, the lot size will be set to 1 and the order should go through without errors:

SetBrokerageModel(BrokerageName.OandaBrokerage);


This example algorithm runs in the cloud with no errors:
 

public class BasicTemplateAlgorithm : QCAlgorithm
{
public override void Initialize()
{
SetStartDate(2013, 10, 07); //Set Start Date
SetEndDate(2013, 10, 11); //Set End Date
SetCash(100000); //Set Strategy Cash

SetBrokerageModel(BrokerageName.OandaBrokerage);
AddForex("EURUSD", Resolution.Second);
}

public override void OnData(Slice data)
{
if (!Portfolio.Invested)
{
Buy("EURUSD", 100);
}
}
}


If the SetBrokerageModel line is removed, you will get the lot size error.

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.


Thanks, Stefano!

The issue was the order of the code: I wrote the SetBrokerageModel line below the AddForex...
0

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