Back

Resolution.Tick & ask/bid data?

I think I might be be missing something here.

So let's say I'm running an algorithm with Resolution.Tick.

OnData I can get Tick from Ticks. I see Price and LastPrice, but I don't get anything for Ask or Bid.

Attached project Debugs: 204.70000000, 0, 0

Where 204.7 is the Price, but 0 and 0 are ask and bid.

Is this info not available?

Documentation states "Because of current data limitations we can only provide Trade ticks."

Not sure if this is apposed to "Quote ticks", but this data seems critical in the SpreadSlippageModel.


public virtual decimal GetSlippageApproximation(Security asset, Order order)
{
var lastData = asset.GetLastData();
var lastTick = lastData as Tick;

// if we have tick data use the spread
if (lastTick != null)
{
if (order.Direction == OrderDirection.Buy)
{
//We're buying, assume slip to Asking Price.
return Math.Abs(order.Price - lastTick.AskPrice);
}
Update Backtest








Hey Levi! Equity data only has trade ticks, because we don't have the quote data.

FX data is only quote ticks and so can create better slippage models for FX. In FX the volumes are so high and not centralized so it doesn't make sense to have volume ticks. The spread slippage model is for FX securities,

Hopefully one day soon we'll have NBBO (national best quote) information!

In the meantime you can use volumes to approximate slippage in equities. e.g. if your trade makes up more than 10% of the volume in a given second or minute you could assume higher slippage values. Trade volume for a period is available on each TradeBar.
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.


Interesting...

So theoretically, If I were only allow an Algorithm to Buy or Sell if the requested quantity does not exceed 10% of the last data's Volume, I could essentially assume what? No slippage? Minuscule slippage? Or undetermined?

Slippage is a real concern for me because I'm dealing with very high frequency trades and very small changes in price so I just really need to figure out how to virtually neutralize slippage.

1. I'm thinking only trading with the highest volume securities (> 10m daily volume)
2. Market Range Orders (AKA Fill or kill limit order) if possible. I'm not sure if I can do this with QC & Tradier.
3. And some way to decide before Buying or Selling what to expect for slippage. I imagine if #2 were an option I wouldn't have to figure this out before hand. I could submit the order and if it goes it goes, otherwise too much slippage occurred and the order would be canceled. I won't have this luxury on the Sell though because when the signal to sell is strong I can't risk holding on to it.
1

Hey Levi! If you're planning on trading on the very high volume securities, then in my opinion slippage is best modeled by inserting a time delay between the order submission and order fill.

What kind of trade sizes do you plan on making? 1% of a second volume? 1/10% of second volume? By default we use the close of the current bar for market order fills. You could define your own IFillModel which forces a certain amount of time between submission and fill.

When running in the backtester, if you use a fill model that does not provide for immediate fills (such as partial fills or delayed fills) you'll need to specify MarketOrder(Symbol, Quantity, asynchronous: true) otherwise it will pause waiting for the market order to fill, which will really slow down your backtest!

As for the market range orders, QuantConnect doesn't support them yet, but you could simulate by using a LimitOrder and cancelling it after a certain amount of time or if price moves in the other direction.

3. I suppose you're operating with Resolution.Second ? If so try using the delayed slippage approach. This will work in backtesting and live paper trading as far as simulating, however, 'predicting' the actual slippage is very dependent on what the market is about to do. You could incorporate level 2 data which is now offered by yahoo, check this out.
1

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, That is freaking awesome. Took me a minute to figure out what I was seeing, but Yahoo's order book could be exactly what I need to screen securities for the sort of quantities I'd need to be making against the available units & their brackets. This also tells me the sort of slippage I should be expecting. Perfect!
0

@MichaelH Hello Michael, thanks for introducing yahoo order book. I wonder if there's historical data for L2 so that lean can backtest the micro structure as well? That'll be great.

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