Back to Community
Date of last order execution to get price from that date

Hi,

I am trying to get the date of the last order execution to determine the price from that date.

I am thinking I can do something like the below.

days_between = day_diff(last_order_date, current_date)

last_order_price = data.history(context.security, 'price', days_between, '1d')[-days_between]

1 response

I suppose if we can retrieve the details of a past order, there might be a price in the available data.