This is a 2800 short sell on AAPL at the indicated date and time based on 1 minute bars. I ran this example several times and stepped through code to confirm the result error. Why doesn't 'order_info' indicate a fill price? What's going on with 'portfolio.pnl' calculation?
Thanks,
Mark
c.order_info
Order: -2800 shares of AAPL (Limit $NaN.N Stop $NaN.N, Open)
amount: -2800
commission: NoneType created: 2014-01-06 14:33:00 dt: 2014-01-06 14:33:00 filled: 0
id: 0e0e0cbd79974e109294305d0369ea9f
limit: NoneType limit_reached: False
reason: NoneType sid: AAPL (24) status: Open (0)
stop: NoneType
(same bar as order)
Open[0]
76.780107
High[0]
76.93011
Low[0]
76.57296
Close[0]
76.6458186
c.portfolio.pnl
-38.0133027553
(next 1min bar after order - it appears that order was filled at prior close based on 'pnl' calculation below)
Open[0]
76.6572474
High[0]
76.6929624
Low[0]
76.2200958
Close[0]
76.2200958
c.portfolio.pnl
-7.01832843106
(This negative $7 pnl doesn't make sense. The 'pnl' it appears to calculate the 2800 share short sell order against the 76.657 open bar price assuming the order was 'filled' at the previous 76.645 bar close. I would assume a 'new' order would fill at the next 1 min bar open price. The context.order_info shown above doesn't indicate a fill price, and subsequent context.order_info information does not update the order fill info)
(2nd next 1 min bar after order)
Open[0]
76.3215264
High[0]
76.4686722
Low[0]
76.2429534
Close[0]
76.2429534
c.portfolio.pnl
-446.021462755 (Where did this negative value come from? All bar values are lower!)