Skip to content

Comments

LWDEV-10476 Pre-trade control: configurable max value and calculated max volume#266

Open
barsukovskii wants to merge 7 commits intomasterfrom
LWDEV-10476
Open

LWDEV-10476 Pre-trade control: configurable max value and calculated max volume#266
barsukovskii wants to merge 7 commits intomasterfrom
LWDEV-10476

Conversation

@barsukovskii
Copy link
Contributor

No description provided.

# 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
private int accuracy;
private Double minVolume;
private Double minInvertedVolume;
private Double maxVolume;
Copy link
Contributor

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?

}

fun validateMaxVolume(order: Order,
assetPair: AssetPair,
Copy link
Contributor

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? {
Copy link
Contributor

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 {
Copy link
Contributor

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 ?

fun getAskPrice() = askOrderBook.peek()?.price ?: BigDecimal.ZERO
fun getBidPrice() = bidOrderBook.peek()?.price ?: BigDecimal.ZERO

fun getMidPrice(): BigDecimal? {
Copy link
Contributor

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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not >=

@olpapchenko
Copy link
Contributor

Not sure on limit orders - what if

  1. Input limit order (A) passes validation - set to order book
  2. Mid Price is changing
  3. Limit order(A) is in the order book and has invalid - too big volume according to the current mid price

# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants