Skip to content

Commit

Permalink
Merge e19f64f into ec1d250
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhou-JiaJun committed Dec 16, 2022
2 parents ec1d250 + e19f64f commit 193dfaf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Expand Up @@ -3,7 +3,7 @@ on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
Expand Down
5 changes: 3 additions & 2 deletions rqalpha/model/instrument.py
Expand Up @@ -422,7 +422,7 @@ def days_from_listed(self):
return ipo_days if ipo_days >= 0 else -1

def days_to_expire(self):
if self.type != 'Future' or self.order_book_id[-2:] == '88' or self.order_book_id[-2:] == '99':
if self.type != 'Future' or self.order_book_id[-2:] in ["88", "99", "89", "A2", "A3"]:
return -1

date = Environment.get_instance().trading_dt.date()
Expand Down Expand Up @@ -450,12 +450,13 @@ def calc_cash_occupation(self, price, quantity, direction):
else:
raise NotImplementedError

FUTURE_CONTINUOUS_CONTRACT = re.compile("^[A-Z]+(88|888|99|889)$")
FUTURE_CONTINUOUS_CONTRACT = re.compile("^[A-Z]+(88|88A[2-3]|888|99|889)$")

@classmethod
def is_future_continuous_contract(cls, order_book_id):
return re.match(cls.FUTURE_CONTINUOUS_CONTRACT, order_book_id)


class SectorCodeItem(object):
def __init__(self, cn, en, name):
self.__cn = cn
Expand Down

0 comments on commit 193dfaf

Please sign in to comment.