修复获取symbol缩写时,对套利合约的支持。
This commit is contained in:
parent
65b649c8da
commit
581cef3a7d
@ -891,6 +891,21 @@ class CtaEngine(object):
|
||||
|
||||
def getShortSymbol(self, symbol):
|
||||
"""取得合约的短号"""
|
||||
# 套利合约
|
||||
if symbol.find(' ') != -1:
|
||||
# 排除SP SPC SPD
|
||||
s = symbol.split(' ')
|
||||
if len(s) < 2:
|
||||
return symbol
|
||||
symbol = s[1]
|
||||
|
||||
# 只提取leg1合约
|
||||
if symbol.find('&') != -1:
|
||||
s = symbol.split('&')
|
||||
if len(s) < 2:
|
||||
return symbol
|
||||
symbol = s[0]
|
||||
|
||||
p = re.compile(r"([A-Z]+)[0-9]+", re.I)
|
||||
shortSymbol = p.match(symbol)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user