BUG: can_trade was true for assets after their auto close date

This commit is contained in:
dmichalowicz
2017-01-20 09:54:30 -05:00
parent 8cbad56d79
commit 6e707f97a7
4 changed files with 77 additions and 25 deletions
+4 -4
View File
@@ -1348,10 +1348,10 @@ class TradingAlgorithm(object):
if asset.auto_close_date:
day = normalize_date(self.get_datetime())
if asset.end_date < day < asset.auto_close_date:
# we are between the asset's end date and auto close date,
# so warn the user that they can't place an order for this
# asset, and return None.
if day > min(asset.end_date, asset.auto_close_date):
# If we are after the asset's end date or auto close date, warn
# the user that they can't place an order for this asset, and
# return None.
log.warn("Cannot place order for {0}, as it has de-listed. "
"Any existing positions for this asset will be "
"liquidated on "