Skip to content

Commit

Permalink
finos#1025 using MAX_FILL_TIME_MS when generating random next event time
Browse files Browse the repository at this point in the history
  • Loading branch information
naleeha committed Dec 5, 2023
1 parent 5bf65d0 commit b898042
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class InMemOmsApi(implicit val clock: Clock) extends OmsApi {
val totalFilledQty = orderstate.filledQty + fillQty
val nextState = if( orderstate.qty == totalFilledQty) States.FILLED else States.ACKED
listeners.foreach(_.onFill(Fill(orderstate.orderId, fillQty, orderstate.price, orderstate.clientOrderId, totalFilledQty, orderstate.qty)))
orderstate.copy(state = nextState, filledQty = totalFilledQty, nextEventTime = clock.now() + random.between(1000, 5000))
orderstate.copy(state = nextState, filledQty = totalFilledQty, nextEventTime = clock.now() + random.between(1000, MaxTimes.MAX_FILL_TIME_MS))
case 'X' =>
listeners.foreach(_.onCancelAck(CancelAck(orderstate.orderId, orderstate.clientOrderId)))
orderstate
Expand All @@ -86,8 +86,8 @@ class InMemOmsApi(implicit val clock: Clock) extends OmsApi {
}

override def getOrderId(clientOrderId: String): Option[Int] = {
orders.find(order => order.clientOrderId == clientOrderId) match {
case Some(o) => Some(o.orderId)
orders.find(os => os.clientOrderId == clientOrderId) match {
case Some(os) => Some(os.orderId)
case None => None
}
}
Expand Down

0 comments on commit b898042

Please sign in to comment.