Skip to content
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

fix(LT-5061): let special liquidation fail #460

Merged
merged 11 commits into from
Mar 22, 2024

Conversation

tarurar
Copy link
Member

@tarurar tarurar commented Oct 30, 2023

We'll let special liquidation fail if there were no price provided upon RFQ. The price request retry will happen on a later steps after checking liquidity.

@tarurar tarurar force-pushed the LT-5061-order-does-not-execute-upon-contribution branch from c88b119 to 5a402af Compare March 15, 2024 08:55
configuration: _marginTradingSettings.SpecialLiquidation);

var nextState = GetNextState(nextAction);
if (!await TrySaveState(executionInfo, nextState))

Choose a reason for hiding this comment

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

What happens here if the operation is paused? The event is handled and then manual action from a support is required?

Copy link
Member Author

Choose a reason for hiding this comment

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

The state will not be affected and saga freezes in the current state. Then manual action is required from support side to "unpause" it.

sender.SendCommand(new CancelSpecialLiquidationCommand
{
OperationId = liquidationId,
Reason = "Liquidity is enough to close positions within regular flow"

Choose a reason for hiding this comment

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

Name of the method does not indicate that the cancellation is related to liquidity. I suggest to rename the method or add reason as a parameter

Copy link
Member Author

Choose a reason for hiding this comment

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

Noted

/// <typeparam name="TEvent"></typeparam>
/// <returns></returns>
/// <exception cref="KeyNotFoundException">When no handler found</exception>
public static ISagaEventHandler<TEvent> First<TEvent>(

Choose a reason for hiding this comment

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

If there's only one instance of ISagaEventHandler in handlers, I suggest to rename the method to "Get"
"First" is a bit confusing because it implies that there might be multiple handlers, and we want to receive a random / first registered one.

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed we want to get the first one.
I explicitly wanted to get the first to make it clear later if we ever have multiple handlers. Otherwise, if we use "Get" it is not clear what happens in case of multiple handlers.

Copy link

Code Coverage

Package Line Rate Branch Rate Complexity Health
MarginTrading.Backend 3% 7% 596
MarginTrading.Backend.Core 66% 58% 1510
MarginTrading.SqlRepositories 0% 0% 469
MarginTrading.AzureRepositories 4% 36% 197
MarginTrading.Contract 0% 100% 38
MarginTrading.Backend.Contracts 34% 25% 582
MarginTrading.Backend.Core.Mappers 0% 0% 4
MarginTrading.Common 16% 16% 406
MarginTrading.Backend.Services 44% 38% 3287
Summary 37% (5865 / 16043) 34% (1477 / 4311) 7089

@tarurar tarurar merged commit c251b06 into master Mar 22, 2024
1 check passed
@tarurar tarurar deleted the LT-5061-order-does-not-execute-upon-contribution branch March 22, 2024 08:30
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