-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LWDEV-10476 Pre-trade control: configurable max value and calculated max volume #266
base: master
Are you sure you want to change the base?
Conversation
# Conflicts: # src/main/kotlin/com/lykke/matching/engine/matching/MatchingEngine.kt # src/main/kotlin/com/lykke/matching/engine/services/AssetOrderBook.kt # src/test/kotlin/com/lykke/matching/engine/services/validator/business/LimitOrderBusinessValidatorTest.kt
@@ -11,7 +11,6 @@ | |||
private int accuracy; | |||
private Double minVolume; | |||
private Double minInvertedVolume; | |||
private Double maxVolume; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there option to configure max volume on back office ? if yes - we should create a ticket to remove it. Also, maybe we should perform dictionary table cleanup - remove unused max volume column?
@@ -27,5 +29,20 @@ class OrderValidationUtils { | |||
throw OrderValidationException(OrderStatus.Cancelled, "expired") | |||
} | |||
} | |||
|
|||
fun validateMaxVolume(order: Order, | |||
assetPair: AssetPair, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format
} | ||
} | ||
|
||
fun calculateMaxVolume(assetPair: AssetPair, orderBook: AssetOrderBook): MaxOrderVolumeInfo? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why we have to pass order book and asset pair? mid price and max value enough
} | ||
|
||
private fun performInputValidation(orderContext: LimitOrderExecutionContext): OrderValidationResult { | ||
private fun performInputValidation(orderContext: LimitOrderExecutionContext, | ||
assetPair: AssetPair?): OrderValidationResult { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why asset pair is moved to the parameter ?
@@ -47,6 +48,13 @@ open class AssetOrderBook(assetId: String) : AbstractAssetOrderBook(assetId) { | |||
fun getAskPrice() = askOrderBook.peek()?.price ?: BigDecimal.ZERO | |||
fun getBidPrice() = bidOrderBook.peek()?.price ?: BigDecimal.ZERO | |||
|
|||
fun getMidPrice(): BigDecimal? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add test for this method
assetPair: AssetPair, | ||
orderBook: AssetOrderBook) { | ||
val maxVolumeInfo = calculateMaxVolume(assetPair, orderBook) ?: return | ||
if (order.getAbsVolume() > maxVolumeInfo.maxVolume) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not >=
Not sure on limit orders - what if
|
# Conflicts: # src/main/kotlin/com/lykke/matching/engine/order/process/StopLimitOrderProcessor.kt # src/main/kotlin/com/lykke/matching/engine/services/validators/business/StopOrderBusinessValidator.kt # src/main/kotlin/com/lykke/matching/engine/services/validators/business/impl/LimitOrderBusinessValidatorImpl.kt # src/main/kotlin/com/lykke/matching/engine/services/validators/business/impl/StopOrderBusinessValidatorImpl.kt # src/main/kotlin/com/lykke/matching/engine/services/validators/common/OrderValidationUtils.kt
No description provided.