I realized that some equities are removed from the market, for example:
>>> symbols('MFE')
Equity(26434, symbol=u'MFE', asset_name=u'MCAFEE INC.', exchange=u'NEW YORK STOCK EXCHANGE', start_date=u'Mon, 04 Jan 1993 00:00:00 GMT', end_date=u'Mon, 28 Feb 2011 00:00:00 GMT', first_traded=None)
Is there a way to know that the equity will be ended in the near future, so I can close all positions in that equity before it is ended? In the backtest, the end_date for MFE is always 28 Feb 2011, but how to know this in real time trading?
I tried to check that the symbol's end_date is today, but right at this moment the end_date is 11 Sep 2015 for AAPL and now it is 12 Sep 2015 in UTC timezone, so it does not seem to work. Is it because the servers are in the US so a few hours behind UTC? This is how I calculated "today":
today = datetime.datetime.utcnow().date()
The attached code prints:
2015-09-08 handle_data:8 INFO end_date: 2015-09-11 00:00:00+00:00, today: 2015-09-12
Thanks for any reply.