value in entry_price

Hi,

Does the value in

account[md.symbol].position.entry_price

is the average price of the position ?

i.e., bought 1000 shares @ $20, and another 1000 @ $19,
would entry_price be 19.50 ?

Thanks,
Itay

Comments

  • Looks like it is the average - see below in bold - 3 100 shares of GOOG with different execution price

    .............................
    on_fill
    09:31:00.002000

    FillEvent(instruction_id='4db55427-99cb-50d4-a5f3-8a4a45fd7071', script_id=u'd019c26a-74a8-484e-bee0-8ec61311ded8', user_key='4db55427-99cb-50d4-a5f3-8a4a45fd7071', order_id='0000000000000001', state='F', price=798.0, shares=100, timestamp=1485873060001700, symbol=u'GOOG', account_id=0, clordid=None, collect=None, intent='increase', order_algorithm='market', expected_direction='increase', actual_direction='increase', script_class_name='CQd019c26a74a8484ebee08ec61311ded8', line_number=66, kind=8)
    798.0

    .............................
    on_fill
    09:35:00.002000

    FillEvent(instruction_id='4db55427-99cb-50d4-a5f3-8a4a45fd7071', script_id=u'd019c26a-74a8-484e-bee0-8ec61311ded8', user_key='4db55427-99cb-50d4-a5f3-8a4a45fd7071', order_id='0000000000000002', state='F', price=800.25, shares=100, timestamp=1485873300001700, symbol=u'GOOG', account_id=0, clordid=None, collect=None, intent='increase', order_algorithm='market', expected_direction='increase', actual_direction='increase', script_class_name='CQd019c26a74a8484ebee08ec61311ded8', line_number=66, kind=8)
    799.125

    .............................
    on_fill
    09:40:00.002000

    FillEvent(instruction_id='4db55427-99cb-50d4-a5f3-8a4a45fd7071', script_id=u'd019c26a-74a8-484e-bee0-8ec61311ded8', user_key='4db55427-99cb-50d4-a5f3-8a4a45fd7071', order_id='0000000000000003', state='F', price=797.1500244140625, shares=100, timestamp=1485873600001700, symbol=u'GOOG', account_id=0, clordid=None, collect=None, intent='increase', order_algorithm='market', expected_direction='increase', actual_direction='increase', script_class_name='CQd019c26a74a8484ebee08ec61311ded8', line_number=66, kind=8)
    798.466674805

  • shayneshayne Posts: 70

    yes. The inventory is managed on a First In First Out (FIFO) methodology from the actual entry (execution) prices.

    Applies to
    - account.entry_pl
    - account.realized_entry_pl
    - account.unrealized_entry_pl
    - account[symbol].realized_pl.entry_pl
    - account[symbol].runealized_pl.entry_pl

    Not to be confused with mtm:
    - account.mtm_pl
    - account.realized_mtm_pl
    - account.unrealized_mtm_pl
    - account[symbol].realized_pl.mtm_pl
    - account[symbol].runealized_pl.mtm_pl

    mtm - Holds the profit/loss from the marked-to-market price of the position. When a position is entered the same day as the simulation, this metric will be identical to the unrealized entry profit/loss. When a position is carried over from one day to another, mtm_price is marked to the market (the adjusted previous close), as a clearing firm would. Also uses a FIFO inventory management methodology.

Sign In or Register to comment.