Skip to content

Add liquidation risk simulation CLI for Sovryn#298

Open
Baliram77 wants to merge 1 commit intorsksmart:mainfrom
Baliram77:feature/liquidation-risk
Open

Add liquidation risk simulation CLI for Sovryn#298
Baliram77 wants to merge 1 commit intorsksmart:mainfrom
Baliram77:feature/liquidation-risk

Conversation

@Baliram77
Copy link

@Baliram77 Baliram77 commented Mar 16, 2026

This PR adds a new risk command group for liquidation stress testing:

  • rsk-cli risk simulate --shock : run Sovryn v1 liquidation simulations under price shocks
  • rsk-cli risk sandbox --ltv --threshold : compare default vs custom risk parameters
  • rsk-cli risk report --format json|table: structured stress-test output (CI/CD friendly)

Implementation details:

  • New risk engine under src/services/risk/ (types, data sources, engine, reporting).
  • Sovryn v1 positions fetched from the public subgraph, mapped into BorrowPosition and priced via CoinGecko.
  • Logging and spinners use the existing logger and spinner utilities with isExternal flag, so the feature is safe to use both in the CLI and MCP server.
  • README updated with a “Liquidation Risk (Stress Testing)” section and example usage.

Testing

  • npm run build
  • node dist/bin/index.js risk simulate --shock 40
  • node dist/bin/index.js risk sandbox --ltv 65 --threshold 80
  • rsk-cli risk simulate --shock 40 --asset rbtc (if this isin't work run this first npm link)
  • node dist/bin/index.js risk report --format json (may occasionally hit CoinGecko 429 rate limits)

…idation stress testing, including subgraph data and CoinGecko pricing
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.

1 participant