@@ -200,7 +200,7 @@ impl OrderParams {
200200 if is_oracle_offset_oracle {
201201 msg ! (
202202 "Updating oracle limit auction start price to {}" ,
203- new_auction_start_price
203+ auction_start_price_offset
204204 ) ;
205205 self . auction_start_price = Some ( auction_start_price_offset) ;
206206 } else {
@@ -216,7 +216,7 @@ impl OrderParams {
216216 if is_oracle_offset_oracle {
217217 msg ! (
218218 "Updating oracle limit auction start price to {}" ,
219- new_auction_start_price
219+ auction_start_price_offset
220220 ) ;
221221 self . auction_start_price = Some ( auction_start_price_offset) ;
222222 } else {
@@ -243,6 +243,28 @@ impl OrderParams {
243243 }
244244 }
245245
246+ let worst_price = if is_oracle_offset_oracle {
247+ oracle_price_offset as i64
248+ } else {
249+ self . price as i64
250+ } ;
251+
252+ if self . direction == PositionDirection :: Long {
253+ if let Some ( auction_start_price) = self . auction_start_price {
254+ self . auction_start_price = Some ( auction_start_price. min ( worst_price) ) ;
255+ }
256+ if let Some ( auction_end_price) = self . auction_end_price {
257+ self . auction_end_price = Some ( auction_end_price. min ( worst_price) ) ;
258+ }
259+ } else {
260+ if let Some ( auction_start_price) = self . auction_start_price {
261+ self . auction_start_price = Some ( auction_start_price. max ( worst_price) ) ;
262+ }
263+ if let Some ( auction_end_price) = self . auction_end_price {
264+ self . auction_end_price = Some ( auction_end_price. max ( worst_price) ) ;
265+ }
266+ }
267+
246268 let auction_duration_before = self . auction_duration ;
247269 let new_auction_duration = get_auction_duration (
248270 self . auction_end_price
0 commit comments