[Mod]cancel only allowd when cta template trading == true
This commit is contained in:
parent
1a569dcf7f
commit
9f9e721983
@ -309,9 +309,12 @@ class ApexApi:
|
|||||||
APEX.Fix_GetLastErrMsg(out, size)
|
APEX.Fix_GetLastErrMsg(out, size)
|
||||||
return out.value
|
return out.value
|
||||||
|
|
||||||
def reg_reply_call_func(sess: int, self):
|
def reg_reply_call_func(self, sess: int = 0):
|
||||||
"""注册全局回调函数"""
|
"""注册回调函数"""
|
||||||
n = APEX.Fix_RegReplyCallFunc(c_void_p(None), self.reply_call_func)
|
if not sess:
|
||||||
|
n = APEX.Fix_RegReplyCallFunc(c_void_p(None), self.reply_call_func)
|
||||||
|
else:
|
||||||
|
n = APEX.Fix_RegReplyCallFunc(sess, self.reply_call_func)
|
||||||
return bool(n)
|
return bool(n)
|
||||||
|
|
||||||
def on_reply(self, conn: int, sess: int, recv: int):
|
def on_reply(self, conn: int, sess: int, recv: int):
|
||||||
|
@ -183,19 +183,22 @@ class CtaTemplate(ABC):
|
|||||||
"""
|
"""
|
||||||
Cancel an existing order.
|
Cancel an existing order.
|
||||||
"""
|
"""
|
||||||
self.cta_engine.cancel_order(self, vt_orderid)
|
if self.trading:
|
||||||
|
self.cta_engine.cancel_order(self, vt_orderid)
|
||||||
|
|
||||||
def cancel_all(self):
|
def cancel_all(self):
|
||||||
"""
|
"""
|
||||||
Cancel all orders sent by strategy.
|
Cancel all orders sent by strategy.
|
||||||
"""
|
"""
|
||||||
self.cta_engine.cancel_all(self)
|
if self.trading:
|
||||||
|
self.cta_engine.cancel_all(self)
|
||||||
|
|
||||||
def write_log(self, msg: str):
|
def write_log(self, msg: str):
|
||||||
"""
|
"""
|
||||||
Write a log message.
|
Write a log message.
|
||||||
"""
|
"""
|
||||||
self.cta_engine.write_log(msg, self)
|
if self.inited:
|
||||||
|
self.cta_engine.write_log(msg, self)
|
||||||
|
|
||||||
def get_engine_type(self):
|
def get_engine_type(self):
|
||||||
"""
|
"""
|
||||||
|
@ -51,6 +51,7 @@ class Product(Enum):
|
|||||||
BOND = "债券"
|
BOND = "债券"
|
||||||
WARRANT = "权证"
|
WARRANT = "权证"
|
||||||
SPREAD = "价差"
|
SPREAD = "价差"
|
||||||
|
FUND = "基金"
|
||||||
|
|
||||||
|
|
||||||
class OrderType(Enum):
|
class OrderType(Enum):
|
||||||
|
Loading…
Reference in New Issue
Block a user