Add Jupiter alarm

This commit is contained in:
2026-06-15 21:52:53 +02:00
parent 125255cdf7
commit d784cd2fd5
12 changed files with 908 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
# Jupiter Perps Price Alarm
A small Java 17 program that listens to Jupiter Perps' on-chain aggregated oracle account through Solana WebSocket `accountSubscribe`.
It does **not** poll once per second. Every account update observed by the connected RPC node is decoded immediately. The program reconnects automatically, performs an initial/reconnect state fetch, and can connect to multiple independent RPC endpoints for redundancy.
## Build and test
```bash
gradle classes
gradle run --args='--self-test'
```
## Monitor a SOL short liquidation threshold
```bash
gradle run --args='--asset=SOL --target=175.00 --direction=above'
```
For a long position, liquidation is normally below the current price:
```bash
gradle run --args='--asset=SOL --target=120.00 --direction=below'
```
## Use two RPC WebSocket streams
A single WebSocket/RPC provider is not a durable event log. For better resilience, provide two independent endpoints:
```bash
export SOLANA_WS_URLS='wss://first-provider.example,wss://second-provider.example'
gradle run --args='--asset=SOL --target=175 --direction=above'
```
The same URL is converted from `wss://` to `https://` for initial and reconnect state retrieval. This works with the usual Solana RPC endpoint format, including API-key query parameters.
## Pushover emergency alarm
```bash
export PUSHOVER_APP_TOKEN='...'
export PUSHOVER_USER_KEY='...'
gradle run --args='--asset=SOL --target=175 --direction=above'
```
The program sends `priority=2`, `retry=30`, `expire=10800`, and `sound=persistent`.
## Important limitations
- `processed` is intentionally used for minimum delay, but a processed update may belong to a fork that is later abandoned.
- Solana PubSub is not guaranteed delivery. Two independent RPC streams reduce, but do not eliminate, the risk of missing an update.
- The alarm reports the Jupiter Perps oracle price. It does not prove that your position was liquidated. For that, also subscribe to your Jupiter position account or relevant program transactions.
- This is an alerting aid, not a substitute for placing an on-platform stop-loss or reducing leverage.