Last active
December 10, 2015 14:48
-
-
Save prystupa/4449806 to your computer and use it in GitHub Desktop.
OrderType with MarketOrder support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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