Skip to content

Implement Mark Price Consumption in Position Service#17

Draft
google-labs-jules[bot] wants to merge 1 commit intomasterfrom
feature/position-mark-price-consumption-4458839992511751053
Draft

Implement Mark Price Consumption in Position Service#17
google-labs-jules[bot] wants to merge 1 commit intomasterfrom
feature/position-mark-price-consumption-4458839992511751053

Conversation

@google-labs-jules
Copy link
Contributor

Implemented the consumption of MarkPriceUpdated events in the Position Service. This involves listening to the market.mark-price topic, updating the local mark price cache, and recalculating PnL, margin ratio, and liquidation price for all active positions on that instrument. Updated positions are persisted and a PositionUpdated event is emitted. The design document was also updated to clarify responsibilities.


PR created automatically by Jules for task 4458839992511751053 started by @vincentf13

- Clarified Mark Price responsibility in design doc (Risk triggers liquidation, Position updates PnL).
- Created `MarkPriceUpdatedEventListener` to consume `market.mark-price` events.
- Updated `PositionDomainService` to handle Mark Price updates:
    - Update `MarkPriceCache`.
    - Recalculate `unrealizedPnl`, `marginRatio`, and `liquidationPrice` for active positions.
    - Persist updated positions (using optimistic locking).
    - Emit `PositionUpdated` event (via `createMarkPriceEvent`).
- Updated `PositionEvent` to support Mark Price updates with full position state.
- Added `MarkPriceCache` for local caching.
- Updated `exchange-position` dependencies.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

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.

0 participants