Skip to content

Commit

Permalink
Merge pull request #352 from vegaprotocol/351-multiple-stop-loss-orders
Browse files Browse the repository at this point in the history
Allow multi stop loss orders
  • Loading branch information
ze97286 authored Apr 26, 2024
2 parents 00f084a + 67154a9 commit 6adebb0
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions perftest/perftest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
}
Expand Down

0 comments on commit 6adebb0

Please sign in to comment.