Skip to content

Commit 39ea68c

Browse files
committed
Updating to accept trailing SL
1 parent cf9ff2d commit 39ea68c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

pytrade/strategy.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ def buy(
146146
time_in_force: TimeInForce = TimeInForce.GOOD_TILL_CANCELLED,
147147
tp=None,
148148
sl=None,
149+
trailing_sl=None
149150
) -> None:
150151
order = Order(
151152
instrument,
@@ -155,6 +156,7 @@ def buy(
155156
time_in_force=time_in_force,
156157
take_profit_on_fill=tp,
157158
stop_loss_on_fill=sl,
159+
trailing_stop_loss_on_fill=trailing_sl
158160
)
159161
self.logger.info(f"Placing order {order}")
160162
self.broker.order(order)
@@ -168,5 +170,6 @@ def sell(
168170
time_in_force: TimeInForce = TimeInForce.GOOD_TILL_CANCELLED,
169171
tp=None,
170172
sl=None,
173+
trailing_sl=None
171174
) -> None:
172-
self.buy(instrument, -size, stop, limit, time_in_force, tp, sl)
175+
self.buy(instrument, -size, stop, limit, time_in_force, tp, sl, trailing_sl)

0 commit comments

Comments
 (0)