From 48ef4cf1ef0181381695026631aefbce104b0dcf Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Tue, 14 May 2019 18:21:55 +0800 Subject: [PATCH] [Mod] lock parameter in trading functions --- vnpy/app/cta_strategy/template.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/vnpy/app/cta_strategy/template.py b/vnpy/app/cta_strategy/template.py index 0fde32c0..7dda141b 100644 --- a/vnpy/app/cta_strategy/template.py +++ b/vnpy/app/cta_strategy/template.py @@ -144,29 +144,29 @@ class CtaTemplate(ABC): """ pass - def buy(self, price: float, volume: float, stop: bool = False): + def buy(self, price: float, volume: float, stop: bool = False, lock: bool = False): """ Send buy order to open a long position. """ - return self.send_order(Direction.LONG, Offset.OPEN, price, volume, stop) + return self.send_order(Direction.LONG, Offset.OPEN, price, volume, stop, lock) - def sell(self, price: float, volume: float, stop: bool = False): + def sell(self, price: float, volume: float, stop: bool = False, lock: bool = False): """ Send sell order to close a long position. """ - return self.send_order(Direction.SHORT, Offset.CLOSE, price, volume, stop) + return self.send_order(Direction.SHORT, Offset.CLOSE, price, volume, stop, lock) - def short(self, price: float, volume: float, stop: bool = False): + def short(self, price: float, volume: float, stop: bool = False, lock: bool = False): """ Send short order to open as short position. """ - return self.send_order(Direction.SHORT, Offset.OPEN, price, volume, stop) + return self.send_order(Direction.SHORT, Offset.OPEN, price, volume, stop, lock) - def cover(self, price: float, volume: float, stop: bool = False): + def cover(self, price: float, volume: float, stop: bool = False, lock: bool = False): """ Send cover order to close a short position. """ - return self.send_order(Direction.LONG, Offset.CLOSE, price, volume, stop) + return self.send_order(Direction.LONG, Offset.CLOSE, price, volume, stop, lock) def send_order( self,