Skip to main content

Module hydromancer_feed

Module hydromancer_feed 

Source
Expand description

Hydromancer WebSocket feed for real-time order updates, fills, and positions.

Subscribes to userOrderUpdates and userFills for tracked accounts via Hydromancer’s WebSocket API. Maintains current position state per account.

On boot and reconnect: fetches portfolioState from Hydromancer API to seed position snapshots and catch missed fills. Uses the portfolio endpoint (not raw clearinghouseState) so that spot USDC balances are included in account equity for unified accounts.

Structs§

AccountState
Full account state: equity + positions.
FillEvent
A fill event from Hydromancer WS.
HydromancerFeedService
OrderUpdate
An order update event from Hydromancer WS.
PerpPosition
A perp position snapshot for one coin.

Enums§

HydromancerEvent
Events emitted by the feed service.

Functions§

parse_portfolio_state 🔒
Parse portfolioState response which wraps data under clearinghouseState and spotClearinghouseState keys. Computes unified account value as perp_account_value + spot_usdc_balance.