LEAN is the open source
algorithmic trading engine powering QuantConnect. Founded in 2013 LEAN has been built by a
global community of 80+ engineers and powers more than a dozen hedge funds today.
Alpha League Competition: $1,000 Weekly Prize Pool
Qualifying Alpha Streams Reentered Weekly Learn
more
Does anyone have a good tutorial of implementing slippage? I've tried invoking it as a Transaction Model but it complains about it not being a correct cast. Are we not allowed to do this?
Securities["VXX"].TransactionModel = new ConstantSlippageModel(0.001m);
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.
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.
Michael Handschuh
50.5k Pro
,
A transaction model is a combination of a fee model/fill model/slippage model all in one type. The constant slippage model needs to be assigned to the SlippageModel property instead of the TransactionModel property.Securities["VXX"].SlippageModel = new ConstantSlippageModel(0.001m);
Here's the Security class with the various models that can be set.
0
Stephen Oehler
8.1k Pro
,
This is great, thanks Michael.
0
Stephen Oehler
8.1k Pro
,
I had an additional message here about how I couldn't get it to work, but I simply had forgotten the namespace. Thanks!
1
Michael Handschuh
50.5k Pro
,
For others with a similar issue, you'll need to add a using statement at the top of the code file:using QuantConnect.Orders.Slippage
1
Marc Nunes
957 Pro
,
I've set the slippage and I'm not seeing an effect on the backtest results...
for(int i=0;i
AddSecurity(SecurityType.Equity, tickers[i], Resolution.Minute);
Securities[tickers[i]].SlippageModel = new ConstantSlippageModel(0.10m);
Securities[tickers[i]].TransactionModel = new ConstantFeeTransactionModel(1);
}
Is the above not the way to set it?
0
Marc Nunes
957 Pro
,
I don't know why the code didn't copy well...
for(int i=0;i
tickersl.Add(tickers[i]);
AddSecurity(SecurityType.Equity, tickers[i], Resolution.Minute);
Securities[tickers[i]].SlippageModel = new ConstantSlippageModel(0.10m);
Securities[tickers[i]].TransactionModel = new ConstantFeeTransactionModel(1);
}
0
Warren Harding
58.2k Pro
,
If a transaction model is a combination of slippage, fill, and fee models then this:
Securities[tickers[i]].TransactionModel = new ConstantFeeTransactionModel(1);
might be overwriting this:
Securities[tickers[i]].SlippageModel = new ConstantSlippageModel(0.10m);
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...
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!