Skip to content

Instantly share code, notes, and snippets.

@prystupa
Last active December 10, 2015 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prystupa/4449806 to your computer and use it in GitHub Desktop.
Save prystupa/4449806 to your computer and use it in GitHub Desktop.
OrderType with MarketOrder support
object OrderType {
def all(): PartialFunction[Order, OrderType] = {
// Unmodified code omitted
// ...
case self@MarketOrder(_, _, _) => new OrderType {
def bookDisplay: String = "MO"
def price: PriceLevel = MarketPrice
def crossesAt(price: Double): Boolean = true
def decreasedBy(qty: Double): MarketOrder = self.copy(qty = self.qty - qty)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment