Prices logged in bought @ and holdings do not match


#1

When running the talib_simple example the price at which a trade is opened (bought @) does not match with the price shown in holdings. Why do these numbers not match?


#2

Hi @Ruud,
can you please give a specific example for this occurrence? are you running on backtest? maybe, the dates aren’t matching?


#3

Hi @avishai,
When I run the talib_simple example in catalyst version 0.5.3 the output shows:

INFO: talib_sample: handling bar 2016-11-01 23:59:00+00:00
[2018-03-05 16:48:09.276000] INFO: talib_sample: Bought 10 @ 734.96999879
[2018-03-05 16:48:09.276000] INFO: talib_sample: - sma_f: 632.88
[2018-03-05 16:48:09.276000] INFO: talib_sample: - sma_s: 615.22
[2018-03-05 16:48:09.276000] INFO: talib_sample: - rsi: 81.34
[2018-03-05 16:48:09.276000] INFO: talib_sample: - sma_r: 70.73
[2018-03-05 16:48:09.276000] INFO: talib_sample: - macd: 24.07
[2018-03-05 16:48:09.276000] INFO: talib_sample: - macdSignal: 17.67
[2018-03-05 16:48:09.276000] INFO: talib_sample: - macdHist: 6.41
[2018-03-05 16:48:09.276000] INFO: talib_sample: - stoch_k: 68.40
[2018-03-05 16:48:09.276000] INFO: talib_sample: - stoch_d: 65.85
[2018-03-05 16:48:09.276000] INFO: talib_sample: - sma_test: 1
[2018-03-05 16:48:09.276000] INFO: talib_sample: - macd_test: 1
[2018-03-05 16:48:09.276000] INFO: talib_sample: - stoch_over_bought: 0
[2018-03-05 16:48:09.276000] INFO: talib_sample: - stoch_over_sold: 0
[2018-03-05 16:48:09.276000] INFO: talib_sample: - rsi_over_bought: 0
[2018-03-05 16:48:09.276000] INFO: talib_sample: - rsi_over_sold: 0
[2018-03-05 16:48:09.276000] INFO: talib_sample: completed bar 2016-11-01 23:59:00+00:00, total execution errors 0
[2018-03-05 16:48:09.291000] INFO: talib_sample: handling bar 2016-11-02 23:59:00+00:00
[2018-03-05 16:48:09.307000] INFO: talib_sample: Holdings: 10 @ 749.744466898
[2018-03-05 16:48:09.307000] INFO: talib_sample: no buy or sell opportunity found

As you can see the price at which I bought shows 734.96999879. The next time step the price shown in holdings is 749.744466898. Why do these prices not match? Is it because of commission or slippage? I hope this will clarify my question.


#4

you are running a backtest on a daily frequency. on 01/11/16 the price was 734 and on 02/11/16 the price was 749.