@@ -101,8 +101,7 @@ type Strategy struct {
101
101
102
102
// callbacks
103
103
common.StatusCallbacks
104
- positionCallbacks []func (* types.Position )
105
- profitCallbacks []func (* ProfitStats )
104
+ profitCallbacks []func (* ProfitStats )
106
105
}
107
106
108
107
func (s * Strategy ) ID () string {
@@ -237,9 +236,6 @@ func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.
237
236
238
237
// update take profit price here
239
238
s .updateTakeProfitPrice ()
240
-
241
- // emit position update
242
- s .EmitPosition (position )
243
239
})
244
240
245
241
s .OrderExecutor .ActiveMakerOrders ().OnFilled (func (o types.Order ) {
@@ -283,6 +279,11 @@ func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.
283
279
return
284
280
}
285
281
282
+ if s .takeProfitPrice .IsZero () {
283
+ s .logger .Warn ("take profit price should not be 0 when there is at least one open-position order filled, please check it" )
284
+ return
285
+ }
286
+
286
287
compRes := kline .Close .Compare (s .takeProfitPrice )
287
288
// price doesn't hit the take profit price
288
289
if compRes < 0 {
@@ -430,14 +431,6 @@ func (s *Strategy) ContinueNextRound() {
430
431
s .nextRoundPaused = false
431
432
}
432
433
433
- func (s * Strategy ) GetTakeProfitPrice () fixedpoint.Value {
434
- if s .Position .Base == 0 {
435
- return fixedpoint .Zero
436
- }
437
-
438
- return s .takeProfitPrice
439
- }
440
-
441
434
func (s * Strategy ) UpdateProfitStatsUntilSuccessful (ctx context.Context ) error {
442
435
var op = func () error {
443
436
if updated , err := s .UpdateProfitStats (ctx ); err != nil {
0 commit comments