Skip to main content

hypercall_types/
topics.rs

1// Event topic definitions and message type mappings
2
3// Order-related topics
4pub const TOPIC_ORDER_ACTIONS: &str = "order-actions"; // OrderActionMessage - orders being placed/cancelled
5pub const TOPIC_ORDER_UPDATES: &str = "order-updates"; // OrderUpdateMessage - order status changes
6pub const TOPIC_ORDER_INFOS: &str = "order-infos"; // OrderInfoMessage - static order info when order ID is assigned
7
8// Market-related topics
9pub const TOPIC_MARKET_ACTIONS: &str = "market-actions"; // MarketActionMessage - market creation/deletion requests
10pub const TOPIC_MARKET_UPDATES: &str = "market-updates"; // MarketUpdateMessage - market status changes
11
12// Trading events
13pub const TOPIC_FILLS: &str = "fills"; // Fill messages - completed trades
14pub const TOPIC_ORDERBOOK_UPDATES: &str = "orderbook-updates"; // OrderbookUpdate - orderbook state changes (deprecated, use l2-updates)
15pub const TOPIC_L2_UPDATES: &str = "l2-updates"; // L2Message - level 2 orderbook updates
16pub const TOPIC_TRADES: &str = "trades"; // TradeMessage - executed trades
17
18// Transaction submission
19pub const TOPIC_TRANSACTION_REQUESTS: &str = "transaction-requests"; // TransactionRequest - transactions to submit
20pub const TOPIC_TRANSACTION_UPDATES: &str = "transaction-updates"; // TransactionUpdate - transaction status updates
21
22// Risk management
23pub const TOPIC_MMP_TRIGGERS: &str = "mmp-triggers"; // MmpTriggeredMessage - market maker protection triggers
24
25// Position events
26pub const TOPIC_POSITION_EXPIRED: &str = "position-expired"; // PositionExpiredMessage - position expiration notifications
27
28// Account/tier updates
29pub const TOPIC_TIER_UPDATES: &str = "tier-updates"; // TierUpdateMessage - margin mode changes for cross-process sync
30
31// Hypercore position updates
32pub const TOPIC_HYPERCORE_POSITION_UPDATES: &str = "hypercore-position-updates"; // HypercorePositionUpdate - perp position updates from Hyperliquid
33
34// Liquidation events
35pub const TOPIC_LIQUIDATION_STATE: &str = "liquidation-state"; // LiquidationStateMessage - liquidation state transitions
36
37// RFQ events
38pub const TOPIC_RFQ_FILLS: &str = "rfq-fills"; // RfqFillMessage - RFQ trade executions
39
40// All topics that the persistence service should subscribe to
41pub const ALL_TOPICS: &[&str] = &[
42    TOPIC_ORDER_ACTIONS,
43    TOPIC_ORDER_UPDATES,
44    TOPIC_ORDER_INFOS,
45    TOPIC_MARKET_ACTIONS,
46    TOPIC_MARKET_UPDATES,
47    TOPIC_FILLS,
48    TOPIC_ORDERBOOK_UPDATES,
49    TOPIC_L2_UPDATES,
50    TOPIC_TRADES,
51    TOPIC_TRANSACTION_REQUESTS,
52    TOPIC_TRANSACTION_UPDATES,
53    TOPIC_MMP_TRIGGERS,
54    TOPIC_POSITION_EXPIRED,
55    TOPIC_TIER_UPDATES,
56    TOPIC_HYPERCORE_POSITION_UPDATES,
57    TOPIC_LIQUIDATION_STATE,
58    TOPIC_RFQ_FILLS,
59];