Skip to content

Commit

Permalink
chore: Allow multi stop loss orders
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarrow committed Apr 26, 2024
1 parent 00f084a commit 67154a9
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 67154a9

Please sign in to comment.