For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

Execution price does not match opening price: quickstart:

  • the very first BUY/SELL example in (Do not only buy … but SELL) has problem that the execution price
    of a market order is NOT the opening price of the next bar
    Datafile at datapath = os.path.join(modpath, '../../datas/orcl-1995-2014.txt')
    has the following content:
    Date,Open,High,Low,Close,Adj Close,Volume

    the output from the example says this:
    2000-01-05, Close, 22.68
    2000-01-05, BUY CREATE, 22.68
    2000-01-06, BUY EXECUTED, 22.27
    2000-01-06, Close, 21.35

    so the opening price at 2000-01-06 is 26.593750
    but the execution price is 22.27
    how comes: it is not even in the trade range for this day.

    second problem: the data in the webpage example does not match the data in
    the file orcl-1995-2014.txt
    the data in the webpage gives:
    2000-01-05T00:00:00, Close, 24.05
    2000-01-05T00:00:00, BUY CREATE, 24.05
    2000-01-06T00:00:00, BUY EXECUTED, 23.61
    2000-01-06T00:00:00, Close, 22.63

    how and where is the execution price set and how to find it out
    some sort of trace functions calls?

    please help

    1. looks like Yahoo data feed uses adjusted prices by default, and csv files has real prices therefore you can see
    22.27 = 25.039 (open) x 21.347761 (adj close) / 24.00 (close)

    try to use parameter adjclose=False with the data feed, and you should see the prices from the csv file.

    1. web page was made long time ago with the adjusted prices from that period, and csv file was downloaded couple years ago, prices are changes since new dividends and split might happen.

    2. move forward on quickstart and you will learn it

  • thank you very much, it did help

Log in to reply