@pgnio/helios-mcp 0.0.0-stage → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -2
- package/dist/chunk-EIAUO3XE.mjs +2955 -0
- package/dist/chunk-NCF7ASJB.mjs +2986 -0
- package/dist/chunk-NWGWXYTS.mjs +2964 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +2968 -0
- package/dist/cli.mjs +24 -0
- package/dist/index.d.mts +2138 -0
- package/dist/index.d.ts +2138 -0
- package/dist/index.js +3043 -0
- package/dist/index.mjs +52 -0
- package/docs/ai-agent-indicators/00_index.txt +210 -0
- package/docs/ai-agent-indicators/activity_ratio.txt +166 -0
- package/docs/ai-agent-indicators/activity_zscore.txt +166 -0
- package/docs/ai-agent-indicators/bayesian_overbought.txt +134 -0
- package/docs/ai-agent-indicators/directional_efficiency.txt +134 -0
- package/docs/ai-agent-indicators/hfi.txt +172 -0
- package/docs/ai-agent-indicators/hfi_weights.txt +124 -0
- package/docs/ai-agent-indicators/hmi.txt +305 -0
- package/docs/ai-agent-indicators/hmi_velocity.txt +155 -0
- package/docs/ai-agent-indicators/hurst_exponent.txt +136 -0
- package/docs/ai-agent-indicators/macd_divergence.txt +133 -0
- package/docs/ai-agent-indicators/macd_histogram.txt +145 -0
- package/docs/ai-agent-indicators/macd_signal.txt +119 -0
- package/docs/ai-agent-indicators/market_structure.txt +201 -0
- package/docs/ai-agent-indicators/poc.txt +131 -0
- package/docs/ai-agent-indicators/poc_distance.txt +129 -0
- package/docs/ai-agent-indicators/regime.txt +225 -0
- package/docs/ai-agent-indicators/rsi_divergence.txt +145 -0
- package/docs/ai-agent-indicators/squeeze_duration.txt +115 -0
- package/docs/ai-agent-indicators/squeeze_energy.txt +128 -0
- package/docs/ai-agent-indicators/support_resistance.txt +169 -0
- package/docs/ai-agent-indicators/tf_alignment.txt +165 -0
- package/docs/ai-agent-indicators/trend_interpretation.txt +98 -0
- package/docs/ai-agent-indicators/trend_strength.txt +134 -0
- package/docs/ai-agent-indicators/value_area_position.txt +142 -0
- package/docs/ai-agent-indicators/volatility_clustering.txt +160 -0
- package/docs/ai-agent-indicators/volatility_squeeze.txt +169 -0
- package/docs/ai-agent-indicators/volume_change_point.txt +151 -0
- package/docs/ai-agent-indicators/vwap.txt +133 -0
- package/docs/ai-agent-indicators/vwap_zscore.txt +154 -0
- package/docs/ai-agent-indicators/weighted_rsi.txt +148 -0
- package/docs/ai-agent-mcp/00_index.txt +110 -0
- package/docs/ai-agent-mcp/01_auth/00_overview.txt +51 -0
- package/docs/ai-agent-mcp/01_auth/01_tools.txt +94 -0
- package/docs/ai-agent-mcp/01_auth/02_data_contracts.txt +38 -0
- package/docs/ai-agent-mcp/01_auth/03_decision_rules.txt +25 -0
- package/docs/ai-agent-mcp/01_auth/04_failures_and_recovery.txt +46 -0
- package/docs/ai-agent-mcp/02_account/00_overview.txt +29 -0
- package/docs/ai-agent-mcp/02_account/01_tools.txt +67 -0
- package/docs/ai-agent-mcp/02_account/02_data_contracts.txt +34 -0
- package/docs/ai-agent-mcp/02_account/03_decision_rules.txt +17 -0
- package/docs/ai-agent-mcp/02_account/04_failures_and_recovery.txt +17 -0
- package/docs/ai-agent-mcp/03_market/00_overview.txt +27 -0
- package/docs/ai-agent-mcp/03_market/01_tools.txt +102 -0
- package/docs/ai-agent-mcp/03_market/02_data_contracts.txt +39 -0
- package/docs/ai-agent-mcp/03_market/03_decision_rules.txt +22 -0
- package/docs/ai-agent-mcp/03_market/04_failures_and_recovery.txt +18 -0
- package/docs/ai-agent-mcp/04_trading/00_overview.txt +25 -0
- package/docs/ai-agent-mcp/04_trading/01_tools.txt +123 -0
- package/docs/ai-agent-mcp/04_trading/02_data_contracts.txt +42 -0
- package/docs/ai-agent-mcp/04_trading/03_decision_rules.txt +30 -0
- package/docs/ai-agent-mcp/04_trading/04_failures_and_recovery.txt +25 -0
- package/docs/ai-agent-mcp/05_ledger/00_overview.txt +31 -0
- package/docs/ai-agent-mcp/05_ledger/01_tools.txt +80 -0
- package/docs/ai-agent-mcp/05_ledger/02_data_contracts.txt +46 -0
- package/docs/ai-agent-mcp/05_ledger/03_decision_rules.txt +44 -0
- package/docs/ai-agent-mcp/05_ledger/04_failures_and_recovery.txt +24 -0
- package/package.json +66 -3
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
MARKET DATA CONTRACTS
|
|
3
|
+
================================================================================
|
|
4
|
+
SNAPSHOT GLOBAL RULES
|
|
5
|
+
- percent fields are already percentages
|
|
6
|
+
- null means unavailable
|
|
7
|
+
- values are compact and schema-driven
|
|
8
|
+
|
|
9
|
+
SNAPSHOT TOP LEVEL
|
|
10
|
+
schema
|
|
11
|
+
view
|
|
12
|
+
scope
|
|
13
|
+
symbolCount
|
|
14
|
+
generatedAt
|
|
15
|
+
returnedSymbols
|
|
16
|
+
semantics
|
|
17
|
+
market
|
|
18
|
+
table
|
|
19
|
+
legend
|
|
20
|
+
|
|
21
|
+
SEMANTICS
|
|
22
|
+
nullMeans: unavailable
|
|
23
|
+
percentScale: already_percent
|
|
24
|
+
percentFields: string[]
|
|
25
|
+
changeMapPercentKeys: string[]
|
|
26
|
+
|
|
27
|
+
TABLE BLOCK
|
|
28
|
+
fieldIds: compact column ids
|
|
29
|
+
rows: row arrays aligned to fieldIds
|
|
30
|
+
|
|
31
|
+
DETAIL BLOCK
|
|
32
|
+
row: keyed symbol fields
|
|
33
|
+
symbolCtx: per-symbol trading context and metadata
|
|
34
|
+
changeMap: keyed timeframe changes
|
|
35
|
+
metrics: raw metric object or null
|
|
36
|
+
|
|
37
|
+
REFERENCE
|
|
38
|
+
Indicator formulas and interpretation are documented separately in:
|
|
39
|
+
ai-agent-indicators/
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
MARKET DECISION RULES
|
|
3
|
+
================================================================================
|
|
4
|
+
USE get_snapshot FIRST
|
|
5
|
+
- compare symbols
|
|
6
|
+
- rank opportunities
|
|
7
|
+
- detect market regime/breadth
|
|
8
|
+
|
|
9
|
+
USE get_symbol_detail SECOND
|
|
10
|
+
- inspect one candidate more deeply
|
|
11
|
+
- read symbol trading context
|
|
12
|
+
- inspect detailed metrics and change map
|
|
13
|
+
|
|
14
|
+
SCOPE RULES
|
|
15
|
+
default scope is usually selected symbols
|
|
16
|
+
all symbols is heavier and should be used intentionally
|
|
17
|
+
explicit symbols is best for targeted follow-up
|
|
18
|
+
|
|
19
|
+
INTERPRETATION RULES
|
|
20
|
+
- do not multiply percent values by 100
|
|
21
|
+
- do not impute null to zero
|
|
22
|
+
- read generatedAt before acting on fast-changing states
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
MARKET FAILURES AND RECOVERY
|
|
3
|
+
================================================================================
|
|
4
|
+
MISSING SESSION
|
|
5
|
+
market:read login prompt returned
|
|
6
|
+
|
|
7
|
+
BACKEND 401
|
|
8
|
+
stale session
|
|
9
|
+
MCP clears session and returns fresh market:read login guidance
|
|
10
|
+
|
|
11
|
+
TRUNCATION RISK
|
|
12
|
+
all-symbol snapshots may be too large for human chat display
|
|
13
|
+
this is a display/transport issue, not necessarily a backend parse issue
|
|
14
|
+
agent should prefer structured consumption, not raw inline dumping
|
|
15
|
+
|
|
16
|
+
MALFORMED INTERPRETATION
|
|
17
|
+
most common error is percent scaling
|
|
18
|
+
use semantics.percentScale = already_percent
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
LAYER: TRADING
|
|
3
|
+
================================================================================
|
|
4
|
+
PURPOSE
|
|
5
|
+
Submit live trading intents and manage active orders under delegated scopes.
|
|
6
|
+
|
|
7
|
+
MODEL
|
|
8
|
+
Trading is intent-first, not exchange-native-first.
|
|
9
|
+
MCP wraps Helios execution APIs rather than exposing raw Hyperliquid order
|
|
10
|
+
placement as the primary interface.
|
|
11
|
+
|
|
12
|
+
PRIMARY TOOLS
|
|
13
|
+
helios_trading_open
|
|
14
|
+
helios_trading_dca
|
|
15
|
+
helios_trading_reverse
|
|
16
|
+
helios_trading_close
|
|
17
|
+
helios_positions_set_tp_sl
|
|
18
|
+
helios_positions_delete_tp_sl
|
|
19
|
+
helios_orders_get_open
|
|
20
|
+
helios_orders_cancel
|
|
21
|
+
|
|
22
|
+
IMPORTANT
|
|
23
|
+
Once a user has approved delegated scopes like orders:write or orders:cancel,
|
|
24
|
+
MCP trading tools can act directly. There is no second per-trade approval
|
|
25
|
+
layer in the current implementation.
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
TRADING TOOLS
|
|
3
|
+
================================================================================
|
|
4
|
+
TOOL: helios_trading_open
|
|
5
|
+
WHAT IT DOES
|
|
6
|
+
Opens a fresh position using the OPEN intent path.
|
|
7
|
+
SCOPE
|
|
8
|
+
orders:write
|
|
9
|
+
INPUT
|
|
10
|
+
provider?
|
|
11
|
+
symbol
|
|
12
|
+
direction
|
|
13
|
+
size
|
|
14
|
+
execution
|
|
15
|
+
maxSlippageBps?
|
|
16
|
+
leverageOverride?
|
|
17
|
+
marginModeOverride?
|
|
18
|
+
reduceOnly?
|
|
19
|
+
protection?
|
|
20
|
+
FINALITY
|
|
21
|
+
Creates new market risk.
|
|
22
|
+
|
|
23
|
+
TOOL: helios_trading_dca
|
|
24
|
+
WHAT IT DOES
|
|
25
|
+
Adds to an existing position using the DCA intent path.
|
|
26
|
+
SCOPE
|
|
27
|
+
orders:write
|
|
28
|
+
INPUT
|
|
29
|
+
provider?
|
|
30
|
+
symbol
|
|
31
|
+
direction
|
|
32
|
+
size
|
|
33
|
+
execution
|
|
34
|
+
maxSlippageBps?
|
|
35
|
+
leverageOverride?
|
|
36
|
+
marginModeOverride?
|
|
37
|
+
reduceOnly?
|
|
38
|
+
protection?
|
|
39
|
+
FINALITY
|
|
40
|
+
Increases existing exposure.
|
|
41
|
+
|
|
42
|
+
TOOL: helios_trading_reverse
|
|
43
|
+
WHAT IT DOES
|
|
44
|
+
Closes an existing position and flips direction using the REVERSE intent path.
|
|
45
|
+
SCOPE
|
|
46
|
+
orders:write
|
|
47
|
+
INPUT
|
|
48
|
+
provider?
|
|
49
|
+
symbol
|
|
50
|
+
direction
|
|
51
|
+
size
|
|
52
|
+
execution
|
|
53
|
+
maxSlippageBps?
|
|
54
|
+
leverageOverride?
|
|
55
|
+
marginModeOverride?
|
|
56
|
+
reduceOnly?
|
|
57
|
+
protection?
|
|
58
|
+
FINALITY
|
|
59
|
+
Closes current directional exposure and opens opposite-direction exposure.
|
|
60
|
+
|
|
61
|
+
TOOL: helios_trading_close
|
|
62
|
+
WHAT IT DOES
|
|
63
|
+
Closes the full open position for a symbol.
|
|
64
|
+
SCOPE
|
|
65
|
+
orders:write
|
|
66
|
+
INPUT
|
|
67
|
+
provider?
|
|
68
|
+
symbol
|
|
69
|
+
maxSlippageBps?
|
|
70
|
+
FINALITY
|
|
71
|
+
Removes open risk in that symbol.
|
|
72
|
+
|
|
73
|
+
TOOL: helios_positions_set_tp_sl
|
|
74
|
+
WHAT IT DOES
|
|
75
|
+
Creates or replaces take-profit and stop-loss protection for an open position.
|
|
76
|
+
SCOPE
|
|
77
|
+
orders:write
|
|
78
|
+
INPUT
|
|
79
|
+
provider?
|
|
80
|
+
symbol
|
|
81
|
+
applyTo
|
|
82
|
+
quantity?
|
|
83
|
+
parentClientOrderId
|
|
84
|
+
takeProfit?
|
|
85
|
+
stopLoss?
|
|
86
|
+
FINALITY
|
|
87
|
+
Changes protection only. It does not open or close the underlying position.
|
|
88
|
+
|
|
89
|
+
TOOL: helios_positions_delete_tp_sl
|
|
90
|
+
WHAT IT DOES
|
|
91
|
+
Deletes one existing TP/SL order by order id.
|
|
92
|
+
SCOPE
|
|
93
|
+
orders:cancel
|
|
94
|
+
INPUT
|
|
95
|
+
provider?
|
|
96
|
+
symbol
|
|
97
|
+
orderId
|
|
98
|
+
FINALITY
|
|
99
|
+
Removes a protective order only.
|
|
100
|
+
|
|
101
|
+
TOOL: helios_orders_get_open
|
|
102
|
+
WHAT IT DOES
|
|
103
|
+
Lists the account's currently open working orders.
|
|
104
|
+
SCOPE
|
|
105
|
+
account:read
|
|
106
|
+
FINALITY
|
|
107
|
+
Read-only open-order inspection.
|
|
108
|
+
|
|
109
|
+
TOOL: helios_orders_cancel
|
|
110
|
+
WHAT IT DOES
|
|
111
|
+
Cancels one working order by symbol and oid.
|
|
112
|
+
SCOPE
|
|
113
|
+
orders:cancel
|
|
114
|
+
INPUT
|
|
115
|
+
symbol
|
|
116
|
+
oid
|
|
117
|
+
FINALITY
|
|
118
|
+
Removes a working order from the book.
|
|
119
|
+
|
|
120
|
+
NOTE
|
|
121
|
+
For helios_trading_* and helios_positions_* mutation tools, provider can be
|
|
122
|
+
omitted after calling helios_provider_set_active once for the current MCP
|
|
123
|
+
session.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
TRADING DATA CONTRACTS
|
|
3
|
+
================================================================================
|
|
4
|
+
INTENT INPUT
|
|
5
|
+
symbol: string
|
|
6
|
+
direction: LONG | SHORT
|
|
7
|
+
size:
|
|
8
|
+
mode: MARGIN_USD | BASE_QUANTITY
|
|
9
|
+
value: number > 0
|
|
10
|
+
execution:
|
|
11
|
+
style: MARKET | LIMIT_TAKER | LIMIT_MAKER | LIMIT_GTC
|
|
12
|
+
timeInForce?: GTC | IOC | FOK | GTX
|
|
13
|
+
limitPrice?: number
|
|
14
|
+
maxSlippageBps?: integer
|
|
15
|
+
leverageOverride?: number
|
|
16
|
+
marginModeOverride?: ISOLATED | CROSS
|
|
17
|
+
reduceOnly?: boolean
|
|
18
|
+
protection?:
|
|
19
|
+
takeProfit? / stopLoss?
|
|
20
|
+
kind: LIMIT | MARKET
|
|
21
|
+
triggerPrice: number
|
|
22
|
+
limitPrice?: number
|
|
23
|
+
|
|
24
|
+
OPEN ORDER SHAPE
|
|
25
|
+
coin
|
|
26
|
+
side: B | A
|
|
27
|
+
limitPx
|
|
28
|
+
sz
|
|
29
|
+
origSz
|
|
30
|
+
oid
|
|
31
|
+
timestamp
|
|
32
|
+
orderType
|
|
33
|
+
tif
|
|
34
|
+
reduceOnly
|
|
35
|
+
isTrigger
|
|
36
|
+
triggerPx
|
|
37
|
+
cloid
|
|
38
|
+
assetId?
|
|
39
|
+
|
|
40
|
+
IMPORTANT
|
|
41
|
+
The current CLOSE intent still requires direction because the underlying
|
|
42
|
+
backend contract requires direction.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
TRADING OPERATIONAL NOTES
|
|
3
|
+
================================================================================
|
|
4
|
+
INTENT TOOLS
|
|
5
|
+
helios_trading_open
|
|
6
|
+
helios_trading_dca
|
|
7
|
+
helios_trading_reverse
|
|
8
|
+
helios_trading_close
|
|
9
|
+
|
|
10
|
+
These tools submit Helios trading intents rather than raw exchange-native order
|
|
11
|
+
syntax.
|
|
12
|
+
|
|
13
|
+
ORDER IDENTIFIERS
|
|
14
|
+
helios_orders_cancel requires a live oid.
|
|
15
|
+
helios_orders_get_open is the read endpoint that returns those identifiers.
|
|
16
|
+
|
|
17
|
+
PROTECTION
|
|
18
|
+
helios_positions_set_tp_sl changes protection on an existing position.
|
|
19
|
+
helios_positions_delete_tp_sl removes one existing protection order by id.
|
|
20
|
+
|
|
21
|
+
DO NOT ASSUME
|
|
22
|
+
- submit result contains exchange fill confirmation
|
|
23
|
+
- submitted means fully executed
|
|
24
|
+
- orders:write implies cancel permission
|
|
25
|
+
|
|
26
|
+
RELATED READ ENDPOINTS
|
|
27
|
+
account.get_wallet_state
|
|
28
|
+
positions.get_open
|
|
29
|
+
ledger.get_summary
|
|
30
|
+
market.get_snapshot
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
TRADING FAILURES AND RECOVERY
|
|
3
|
+
================================================================================
|
|
4
|
+
MISSING SESSION
|
|
5
|
+
exact-scope login prompt returned:
|
|
6
|
+
orders:write for intent / set_tp_sl
|
|
7
|
+
orders:cancel for cancel / delete_tp_sl
|
|
8
|
+
|
|
9
|
+
BACKEND 401
|
|
10
|
+
stale session
|
|
11
|
+
MCP clears local session
|
|
12
|
+
fresh login guidance returned
|
|
13
|
+
|
|
14
|
+
VALIDATION FAILURE
|
|
15
|
+
malformed symbol, size, protection, or execution fields
|
|
16
|
+
fix input before retrying
|
|
17
|
+
|
|
18
|
+
AUTHORIZATION FAILURE
|
|
19
|
+
missing delegated scope
|
|
20
|
+
user must approve a new login with the required scope
|
|
21
|
+
|
|
22
|
+
EXECUTION FAILURE
|
|
23
|
+
backend may reject due to market state, symbol resolution, leverage, margin,
|
|
24
|
+
or exchange-specific conditions
|
|
25
|
+
submitted != guaranteed fill
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
LAYER: LEDGER
|
|
3
|
+
================================================================================
|
|
4
|
+
PURPOSE
|
|
5
|
+
Give the agent current position state plus recent trading history and compact
|
|
6
|
+
performance metrics for real-time decisions.
|
|
7
|
+
|
|
8
|
+
THIS LAYER COVERS
|
|
9
|
+
helios_positions_get_open
|
|
10
|
+
helios_ledger_get_fills
|
|
11
|
+
helios_ledger_get_summary
|
|
12
|
+
|
|
13
|
+
DISTINCTIONS
|
|
14
|
+
wallet state
|
|
15
|
+
current account-level balances and margin
|
|
16
|
+
|
|
17
|
+
open positions
|
|
18
|
+
current directional exposures with unrealized PnL
|
|
19
|
+
|
|
20
|
+
open orders
|
|
21
|
+
working orders not yet fully resolved
|
|
22
|
+
|
|
23
|
+
fills
|
|
24
|
+
recent execution history
|
|
25
|
+
|
|
26
|
+
summary
|
|
27
|
+
derived realized-PnL and fee metrics over recent history
|
|
28
|
+
|
|
29
|
+
DEFAULT HISTORY
|
|
30
|
+
window: 7d
|
|
31
|
+
limit: 100
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
LEDGER TOOLS
|
|
3
|
+
================================================================================
|
|
4
|
+
TOOL: helios_positions_get_open
|
|
5
|
+
WHAT IT DOES
|
|
6
|
+
Returns the current open positions with unrealized PnL, size, leverage, and
|
|
7
|
+
mark-price context.
|
|
8
|
+
WHEN TO USE IT
|
|
9
|
+
Use near the start of every cycle before evaluating fresh entries.
|
|
10
|
+
SCOPE
|
|
11
|
+
account:read
|
|
12
|
+
OUTPUT
|
|
13
|
+
provider: hyperliquid
|
|
14
|
+
fetchedAt
|
|
15
|
+
totalUnrealizedPnl
|
|
16
|
+
positions[]
|
|
17
|
+
FINALITY
|
|
18
|
+
Read-only live position state. This is not fill history and not realized PnL.
|
|
19
|
+
DECISION IT ENABLES
|
|
20
|
+
- whether risk is already on
|
|
21
|
+
- which symbols require management first
|
|
22
|
+
- whether adding new trades would overextend the account
|
|
23
|
+
|
|
24
|
+
TOOL: helios_ledger_get_fills
|
|
25
|
+
WHAT IT DOES
|
|
26
|
+
Returns recent fills and trade history in a bounded time window.
|
|
27
|
+
WHEN TO USE IT
|
|
28
|
+
Use when evaluating recent execution quality, recent behavior, or whether the
|
|
29
|
+
account is overtrading one symbol or regime.
|
|
30
|
+
SCOPE
|
|
31
|
+
account:read
|
|
32
|
+
INPUT
|
|
33
|
+
window?: 24h | 7d | 30d
|
|
34
|
+
limit?: 1..200
|
|
35
|
+
before?: timestamp_ms
|
|
36
|
+
OUTPUT
|
|
37
|
+
window
|
|
38
|
+
limit
|
|
39
|
+
before?
|
|
40
|
+
hasMore
|
|
41
|
+
nextBefore?
|
|
42
|
+
fetchedAt
|
|
43
|
+
fills[]
|
|
44
|
+
FINALITY
|
|
45
|
+
Bounded historical trade events only. It is not a live position endpoint.
|
|
46
|
+
DECISION IT ENABLES
|
|
47
|
+
- inspect recent execution cadence
|
|
48
|
+
- detect repeated losses or churn
|
|
49
|
+
- reconstruct recent trade intent and behavior
|
|
50
|
+
|
|
51
|
+
TOOL: helios_ledger_get_summary
|
|
52
|
+
WHAT IT DOES
|
|
53
|
+
Returns compact realized performance metrics aggregated over recent fills.
|
|
54
|
+
WHEN TO USE IT
|
|
55
|
+
Use once per cycle to understand recent PnL, fee drag, and win/loss quality
|
|
56
|
+
before deciding whether risk should be expanded or reduced.
|
|
57
|
+
SCOPE
|
|
58
|
+
account:read
|
|
59
|
+
INPUT
|
|
60
|
+
window?: 24h | 7d | 30d
|
|
61
|
+
OUTPUT
|
|
62
|
+
window
|
|
63
|
+
generatedAt
|
|
64
|
+
realizedPnl
|
|
65
|
+
totalFees
|
|
66
|
+
fillCount
|
|
67
|
+
closeCount
|
|
68
|
+
winCount
|
|
69
|
+
lossCount
|
|
70
|
+
averageWin
|
|
71
|
+
averageLoss
|
|
72
|
+
periods.24h
|
|
73
|
+
periods.7d
|
|
74
|
+
FINALITY
|
|
75
|
+
Aggregated realized-performance context. It does not replace fills when exact
|
|
76
|
+
trade reconstruction is needed.
|
|
77
|
+
DECISION IT ENABLES
|
|
78
|
+
- whether recent performance supports normal risk-taking
|
|
79
|
+
- whether fee drag is too high
|
|
80
|
+
- whether the current regime is hurting execution quality
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
LEDGER DATA CONTRACTS
|
|
3
|
+
================================================================================
|
|
4
|
+
OPEN POSITION
|
|
5
|
+
symbol
|
|
6
|
+
side: LONG | SHORT
|
|
7
|
+
size: number
|
|
8
|
+
entryPrice: number
|
|
9
|
+
markPrice: number
|
|
10
|
+
unrealizedPnl: number
|
|
11
|
+
margin: number
|
|
12
|
+
leverage: number
|
|
13
|
+
liquidationPrice?: number
|
|
14
|
+
|
|
15
|
+
LEDGER FILL
|
|
16
|
+
coin
|
|
17
|
+
px: number
|
|
18
|
+
sz: number
|
|
19
|
+
side: B | A
|
|
20
|
+
time: timestamp_ms
|
|
21
|
+
dir: string
|
|
22
|
+
closedPnl: number
|
|
23
|
+
fee: number
|
|
24
|
+
crossed: boolean
|
|
25
|
+
oid: number
|
|
26
|
+
tid: number
|
|
27
|
+
|
|
28
|
+
LEDGER SUMMARY
|
|
29
|
+
realizedPnl
|
|
30
|
+
totalFees
|
|
31
|
+
fillCount
|
|
32
|
+
closeCount
|
|
33
|
+
winCount
|
|
34
|
+
lossCount
|
|
35
|
+
averageWin
|
|
36
|
+
averageLoss
|
|
37
|
+
periods:
|
|
38
|
+
24h
|
|
39
|
+
7d
|
|
40
|
+
|
|
41
|
+
PAGINATION
|
|
42
|
+
before
|
|
43
|
+
timestamp_ms upper bound, exclusive
|
|
44
|
+
|
|
45
|
+
nextBefore
|
|
46
|
+
use this value to fetch older fills
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
LEDGER DECISION RULES
|
|
3
|
+
================================================================================
|
|
4
|
+
USE positions.get_open FOR
|
|
5
|
+
- current directional exposure
|
|
6
|
+
- unrealized PnL
|
|
7
|
+
- leverage and liquidation context
|
|
8
|
+
|
|
9
|
+
USE ledger.get_fills FOR
|
|
10
|
+
- recent execution context
|
|
11
|
+
- fill-by-fill review
|
|
12
|
+
- what actually traded recently
|
|
13
|
+
|
|
14
|
+
USE ledger.get_summary FOR
|
|
15
|
+
- fast realized performance read
|
|
16
|
+
- recent fees
|
|
17
|
+
- win/loss tendency
|
|
18
|
+
|
|
19
|
+
SUMMARY MATH RULES
|
|
20
|
+
closing fills
|
|
21
|
+
dir contains "close" OR closedPnl != 0
|
|
22
|
+
|
|
23
|
+
totalFees
|
|
24
|
+
absolute fee sum
|
|
25
|
+
|
|
26
|
+
winCount
|
|
27
|
+
closing fills with closedPnl > 0
|
|
28
|
+
|
|
29
|
+
lossCount
|
|
30
|
+
closing fills with closedPnl < 0
|
|
31
|
+
|
|
32
|
+
zero-PnL closes
|
|
33
|
+
count as closes
|
|
34
|
+
do not count as wins or losses
|
|
35
|
+
|
|
36
|
+
BEST PAIRINGS
|
|
37
|
+
wallet_state + positions.get_open
|
|
38
|
+
current account risk state
|
|
39
|
+
|
|
40
|
+
market.get_snapshot + ledger.get_summary
|
|
41
|
+
recent performance + current opportunity set
|
|
42
|
+
|
|
43
|
+
orders.get_open + positions.get_open
|
|
44
|
+
distinguish resting intent from active exposure
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
LEDGER FAILURES AND RECOVERY
|
|
3
|
+
================================================================================
|
|
4
|
+
MISSING SESSION
|
|
5
|
+
account:read login prompt returned
|
|
6
|
+
|
|
7
|
+
BACKEND 401
|
|
8
|
+
stale session
|
|
9
|
+
MCP clears session and returns fresh account:read login guidance
|
|
10
|
+
|
|
11
|
+
EMPTY HISTORY
|
|
12
|
+
empty fills array can be a valid state
|
|
13
|
+
do not treat as backend failure
|
|
14
|
+
|
|
15
|
+
HASMORE FALSE
|
|
16
|
+
means the bounded query exhausted the available results inside the current
|
|
17
|
+
window / before boundary
|
|
18
|
+
|
|
19
|
+
COMMON MISTAKES
|
|
20
|
+
- do not confuse realizedPnl with unrealizedPnl
|
|
21
|
+
- do not infer position state from fills alone
|
|
22
|
+
- do not infer open orders from fills
|
|
23
|
+
- do not assume fee sign should be preserved in summary totals; summary uses
|
|
24
|
+
absolute fee totals
|
package/package.json
CHANGED
|
@@ -1,6 +1,69 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pgnio/helios-mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "Helios MCP server: connect an AI agent to your Helios account to read markets and your portfolio and to trade on Hyperliquid. Most apps can use the hosted URL https://helios.pgn.io/mcp instead.",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"homepage": "https://helios.pgn.io/?connect=ai",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"module": "dist/index.mjs",
|
|
10
|
+
"bin": {
|
|
11
|
+
"helios-mcp": "./dist/cli.js",
|
|
12
|
+
"helios-agent-mcp": "./dist/cli.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"docs"
|
|
17
|
+
],
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"import": "./dist/index.mjs",
|
|
24
|
+
"require": "./dist/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./package.json": "./package.json"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"helios",
|
|
30
|
+
"mcp",
|
|
31
|
+
"agent",
|
|
32
|
+
"cli",
|
|
33
|
+
"trading"
|
|
34
|
+
],
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@modelcontextprotocol/sdk": "1.29.0",
|
|
37
|
+
"zod": "4.1.12"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@trivago/prettier-plugin-sort-imports": "6.0.0",
|
|
41
|
+
"@types/node": "24.10.1",
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "8.46.4",
|
|
43
|
+
"@typescript-eslint/parser": "8.46.4",
|
|
44
|
+
"@vitest/coverage-v8": "4.0.9",
|
|
45
|
+
"eslint": "9.39.1",
|
|
46
|
+
"eslint-config-prettier": "10.1.8",
|
|
47
|
+
"eslint-plugin-prettier": "5.5.4",
|
|
48
|
+
"prettier": "3.6.2",
|
|
49
|
+
"tsup": "8.5.1",
|
|
50
|
+
"typescript": "5.9.3",
|
|
51
|
+
"typescript-eslint": "8.46.4",
|
|
52
|
+
"vitest": "4.0.9",
|
|
53
|
+
"@supercodebros/helios-agent": "0.1.0"
|
|
54
|
+
},
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": ">=20.19.0"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "tsup",
|
|
60
|
+
"dev": "tsup --watch",
|
|
61
|
+
"lint": "eslint src/**/*.ts",
|
|
62
|
+
"lint:fix": "eslint src/**/*.ts --fix",
|
|
63
|
+
"test": "vitest run",
|
|
64
|
+
"test:watch": "vitest",
|
|
65
|
+
"typecheck": "tsc --noEmit --project tsconfig.json",
|
|
66
|
+
"format": "prettier . --write",
|
|
67
|
+
"format:check": "prettier . --check"
|
|
68
|
+
}
|
|
6
69
|
}
|