Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Where from Q get prices for live paper trading?

Today I got some executions in my live paper trading.

2015-03-16 12:30:00
XLV
Market
1228
Fill:1228 shares at $73.34 on 2015-03-16 12:31:00

Nether Yahoo, BATS exchange, Google do not have $73.34 price at that or near time.

XLV (Google 1m)

16 Mar 2015 15:29 73.23 73.24 73.23 73.24
16 Mar 2015 15:30 73.25 73.25 73.24 73.24
16 Mar 2015 15:31 73.27 73.27 73.26 73.26
16 Mar 2015 15:32 73.28 73.28 73.27 73.27
16 Mar 2015 15:33 73.26 73.27 73.25 73.27

2015-03-16 12:30:00
TBF
Market
-2436
Fill:-25 shares at $24.44 on 2015-03-16 12:31:00
Fill:-512 shares at $24.41 on 2015-03-16 12:33:00
Fill:-25 shares at $24.40 on 2015-03-16 12:34:00
Fill:-25 shares at $24.40 on 2015-03-16 12:36:00
Fill:-130 shares at $24.41 on 2015-03-16 12:39:00
Fill:-632 shares at $24.41 on 2015-03-16 12:41:00
Fill:-430 shares at $24.40 on 2015-03-16 12:42:00
Fill:-175 shares at $24.40 on 2015-03-16 12:43:00
Fill:-125 shares at $24.40 on 2015-03-16 12:44:00
Fill:-350 shares at $24.39 on 2015-03-16 12:46:00
Fill:-7 shares at $24.56 on 2015-03-16 12:47:00

Nether Yahoo, BATS exchange, Google do not have $24.40 price at that or near time.

TBF (Google 1m)

16 Mar 2015 15:24 24.61 24.61 24.61 24.61
16 Mar 2015 15:33 24.59 24.59 24.59 24.59
16 Mar 2015 15:43 24.58 24.58 24.58 24.58
16 Mar 2015 15:44 24.58 24.58 24.58 24.58
16 Mar 2015 15:48 24.58 24.58 24.58 24.58
16 Mar 2015 15:49 24.57 24.57 24.57 24.57
16 Mar 2015 15:57 24.56 24.56 24.56 24.56
16 Mar 2015 16:00 24.53 24.53 24.53 24.53

Where did you get it from or how you configer them?

17 responses

In backtest transactions was more realistic

12:31 PM
XLV
BUY
1
$73.30 $73.30

12:33 PM
TBF
SELL
-89
$24.55 ($2,185.39)

But still not match nether Yahoo, BATS exchange or Google data.

Per https://www.quantopian.com/faq#data,

For paper trading and real-money trading, we get a realtime feed of trades from Nanex's NxCore product. Those trades are bundled into one-minute bars and fed to the trading algorithms. Paper trading data is provided on a 15-minute delay. Real-money trading is processed without delay.

Grant,

How you can explain such a spread
between Nanex's NxCore and BATS exchange,

24.41 on 2015-03-16 12:33:00
16 Mar 2015 15:33 24.59

24.41/24.59-1=-0.73%

between live data and historical data from Nanex's NxCore?

24.41 /24.55-1=-0.57%

There is definitely arbitrage opportunity but as you see in both cases not in customer favor.

Orders are filled using a (punitive) slippage model, which you can turn off if you like. It is covered in the API docs.

Simon,

Slippage model to my mind should be used only in back testing and nothing to do with live trading.
There is still a spread -0.57% of the same algo running in backtest and live paper trading.
Contest rules not allow to alter slippage model.

In Quantopian paper trading, which uses a 15 minute delayed price feed, your algorithm sets the slippage and commission conditions.

When you're live trading with the broker, using either your paper or real money account, you get the slippage and commissions that they set.

Disclaimer

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 Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian 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.

Back testing and (I assume) paper trading uses a single price value, but buying a stock at market rate on live trading, you'd get the ask price. The difference between bid and ask is not modelled in Q currently.

Does your google/BAT feeds give you bid, ask, or the mid-price?

Alisa,James,

You probably do not understand my last question
The same algo.
The same data.
The same bar execution.
In backtest fill price was 24.55
In paper trading fill price was 24.41.
Why?
To my mind Quantopian slippage model is deadly wrong when it applied to pretty liquid ETF.

Hello Vladimir,

It is my understanding that Quantopian backtest data and Quantopian paper trading data come from different sources. The paper trading bars are from Nanex Nxcore, but to my knowledge, the source for the backtest data has not been revealed. Perhaps this is why the fills are slightly off?

Grant

James,
Bats exchange provide Bid, Ask and Last prices.
Bid/Ask spread for TBF usually 0.01-0.03 and 10 times less then Quantopian slippage model charged.

Grant ,

It is not slightly.
Today my another similar algo loaded balanced positions at the end of the day in quiet market and it is now -2.1% off. just because slippage model charge.
Fill:-175 shares at $24.17 on 2015-03-17 12:55:00
Fill:-250 shares at $24.16 on 2015-03-17 12:54:00
Fill:-1894 shares at $24.15 on 2015-03-17 12:53:00
Fill:-275 shares at $24.17 on 2015-03-17 12:52:00

Last 10 trades on BATS
TBF

15:59:45 24.3300 88
15:59:45 24.3300 182
15:59:45 24.3350 219
15:59:45 24.3350 691
15:59:45 24.3350 625
15:59:37 24.3300 218
15:59:20 24.3400 90
15:59:20 24.3400 90
15:59:20 24.3400 90
15:59:20 24.3400 90

The difference 0.16-0.17 that is about 0.75%

Yes, unfortunately the slippage model is punitive, even more so for ETFs. I've brought this up before: https://www.quantopian.com/posts/anyone-got-a-vwap-execution-sub-algorithm-to-work-around-quantopian-slippage-model

For your own personal algos, you can just nuke the slippage model, but for contest entries, unfortunately, you're boned.

Thinly traded securities, like many ETFs, are very hard to model well.

The maximum impact in the default slippage model is 0.625% (you can see the exact math in the [documentation example][1]). The default commission model is $.03 per share, which is 0.12% on the $24.34 price in your example. Combining the two, it sounds a lot like the 0.75% that you're seeing. To be absolutely certain we just need to check the volume on the minute your order filled.

The question is, how different is that fill price from what you would have seen if you actually placed the real-money order? If you'd sold 2500 shares on the market today, that would be an appreciable fraction of today's volume, and it would have had some impact on the price. But how much of an impact? I don't know the answer, and our slippage model is the approximation of that price that we're using.

I'm very interested in how we can improve the slippage model, particularly if we are working off as-traded data. I know that the bid/ask book gives more insight, but it has large additional costs. I'm looking for ways to improve the model with the data that we already have.

Disclaimer

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 Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian 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.

Hi Dan,

I apriciate your response to the problem.

I will try to explain my concern that Quatopian theoretical slippage model and its default parameters
are naively punitive if applicable to ETF.
TBF is not as liquid as SPY or TLT but it is not thinly and order on 2500 shares is just 0.73% of todays volume
and less then 0.25% of average dayly volume of 750000 shares and is not appreciable as you mention.
From other side TLT and TBF by definition mimic Multimillion US bond market were $100000 not appreciable at all.
Range (H-L) on 1 minute bar at the time of execution was 0.01- 0.03 but I got maximum impact (ten times more).

If I would do slippage model on bar data for short position I will use min(O,C1) for low volatility instruments otherwise min(O,C1)-AverageTrueRange(nbars)*(max(2,Volume Factor)).
If you would ask me what to do with existing slippage model, my answer will be: lower default parameters to minimum or better turn it off at least for contest because I am not the first who got sensitive punitive damage in first half hour of paper trading.

https://www.quantopian.com/posts/anyone-got-a-vwap-execution-sub-algorithm-to-work-around-quantopian-slippage-model

BTW after writing I run full becktest of the same algo and got fill price for TBF 24.32 slippage 0.02.

Hi Dan,

You might pose the question to Michael Kearns, who presented at QuantCon (http://www.cis.upenn.edu/~mkearns/). His discussion about avoiding slippage across dark pools seemed analogous, basically needing to back out models for how each pool would handle a given volume needing to be executed in a given time.

Any idea how IB paper trading handles slippage?

Grant

The holy grail is to build the model from actual execution/fill information, which Quantopian will be in a unique position to gather, once enough people are live trading everything (and assuming we all consented to Quantopian analysing our executions). That would be a very valuable data set.

I suppose Interactive Brokers would have the motherlode of such data.