From 67154a991c6582d03a2abd29c21a37f77851238e Mon Sep 17 00:00:00 2001 From: Pete Barrow Date: Fri, 26 Apr 2024 15:13:11 +0100 Subject: [PATCH] chore: Allow multi stop loss orders --- perftest/perftest.go | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/perftest/perftest.go b/perftest/perftest.go index b31858a9..3dfb9d48 100644 --- a/perftest/perftest.go +++ b/perftest/perftest.go @@ -494,25 +494,27 @@ func (p *perfLoadTesting) seedStopOrders(marketIDs []string, opts Opts) error { return err } - time.Sleep(1 * time.Second) - - sos := &commandspb.StopOrdersSubmission{ - RisesAbove: &commandspb.StopOrderSetup{ - OrderSubmission: order, - Trigger: &commandspb.StopOrderSetup_Price{ - Price: fmt.Sprint(opts.StartingMidPrice + 1000), + for orderCount := int64(0); orderCount < int64(opts.StopOrders); orderCount++ { + time.Sleep(100 * time.Millisecond) + + sos := &commandspb.StopOrdersSubmission{ + RisesAbove: &commandspb.StopOrderSetup{ + OrderSubmission: order, + Trigger: &commandspb.StopOrderSetup_Price{ + Price: fmt.Sprint(opts.StartingMidPrice + (1000 + orderCount)), + }, }, - }, - FallsBelow: &commandspb.StopOrderSetup{ - OrderSubmission: order, - Trigger: &commandspb.StopOrderSetup_Price{ - Price: fmt.Sprint(opts.StartingMidPrice - 1000), + FallsBelow: &commandspb.StopOrderSetup{ + OrderSubmission: order, + Trigger: &commandspb.StopOrderSetup_Price{ + Price: fmt.Sprint(opts.StartingMidPrice - (1000 + orderCount)), + }, }, - }, - } - err = p.wallet.SendStopOrder(user, sos) - if err != nil { - return err + } + err = p.wallet.SendStopOrder(user, sos) + if err != nil { + return err + } } } }