Skip to content

Conversation

@jeuryink
Copy link
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings January 12, 2026 21:09
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the margin manager by adding average entry price and estimated liquidation price calculations for cross margin positions, along with version bump to 0.3.0.

Changes:

  • Added avg_entry_price and est_liq_price fields to CrossPositionMetrics
  • Refactored indexer event retrieval into a reusable helper method
  • Implemented liquidation price calculations with safeguards for long and short positions

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pyproject.toml Version bump from 0.2.8 to 0.3.0
nado_protocol/utils/margin_manager.py Added avg entry price and liquidation price calculations with display support

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Calculate estimated liquidation price.
Formula:
- If long: oracle_price - (maint_health / amount / long_weight)
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

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

The formula documentation uses inconsistent operator precedence notation. The division operations should be explicitly grouped with parentheses to match the implementation: oracle_price - ((maint_health / amount) / long_weight)

Copilot uses AI. Check for mistakes.
@jeuryink jeuryink merged commit e3c9d64 into main Jan 12, 2026
7 checks passed
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