Hi,
I'm confused by the definition of last_sale_price. With the backtester, it appears to be equivalent to the close price (except for the first bar, when it is zero). Under live trading, would it be the same?
Also, what are the use cases for last_sale_price (or is it equivalent to the close price)?
Grant
last_sale_price
Float: Price at last sale of this security.
def initialize(context):
context.submitted = False
def handle_data(context, data):
print get_datetime()
if context.submitted == False:
order(sid(24), 50)
print 'order submitted'
context.submitted = True
print 'close price:'
print data[sid(24)].close_price
print 'last sale price:'
print context.portfolio.positions[sid(24)].last_sale_price
2014-03-05PRINT2014-03-05 14:31:00+00:00
2014-03-05PRINTorder submitted
2014-03-05PRINTclose price:
2014-03-05PRINT531.9
2014-03-05PRINTlast sale price:
2014-03-05PRINT0.0
2014-03-05PRINT2014-03-05 14:32:00+00:00
2014-03-05PRINTclose price:
2014-03-05PRINT531.265
2014-03-05PRINTlast sale price:
2014-03-05PRINT531.265