hypertrader 0.1.6__tar.gz → 0.1.7__tar.gz
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.
- {hypertrader-0.1.6 → hypertrader-0.1.7}/PKG-INFO +97 -8
- {hypertrader-0.1.6 → hypertrader-0.1.7}/README.md +96 -7
- {hypertrader-0.1.6 → hypertrader-0.1.7}/hypertrader.egg-info/PKG-INFO +97 -8
- {hypertrader-0.1.6 → hypertrader-0.1.7}/hypertrader.egg-info/SOURCES.txt +8 -0
- {hypertrader-0.1.6 → hypertrader-0.1.7}/hypertrader.egg-info/top_level.txt +1 -0
- {hypertrader-0.1.6 → hypertrader-0.1.7}/hypertrader.py +130 -0
- {hypertrader-0.1.6 → hypertrader-0.1.7}/modes/auto_trader.py +415 -131
- {hypertrader-0.1.6 → hypertrader-0.1.7}/modes/position_management.py +1 -1
- {hypertrader-0.1.6 → hypertrader-0.1.7}/setup.py +2 -2
- hypertrader-0.1.7/strategies/__init__.py +11 -0
- hypertrader-0.1.7/strategies/base.py +73 -0
- hypertrader-0.1.7/strategies/default.py +751 -0
- hypertrader-0.1.7/strategies/registry.py +37 -0
- hypertrader-0.1.7/strategies/reversal.py +892 -0
- hypertrader-0.1.7/tests/test_async_hyperliquid.py +621 -0
- hypertrader-0.1.7/tests/test_auto_strategy_registry.py +99 -0
- hypertrader-0.1.7/tests/test_reversal_strategy.py +204 -0
- {hypertrader-0.1.6 → hypertrader-0.1.7}/utils/helpers.py +2 -32
- {hypertrader-0.1.6 → hypertrader-0.1.7}/hypertrader.egg-info/dependency_links.txt +0 -0
- {hypertrader-0.1.6 → hypertrader-0.1.7}/hypertrader.egg-info/entry_points.txt +0 -0
- {hypertrader-0.1.6 → hypertrader-0.1.7}/hypertrader.egg-info/requires.txt +0 -0
- {hypertrader-0.1.6 → hypertrader-0.1.7}/modes/market_maker.py +0 -0
- {hypertrader-0.1.6 → hypertrader-0.1.7}/modes/position_watcher.py +0 -0
- {hypertrader-0.1.6 → hypertrader-0.1.7}/modes/trailing_stop.py +0 -0
- {hypertrader-0.1.6 → hypertrader-0.1.7}/setup.cfg +0 -0
- {hypertrader-0.1.6 → hypertrader-0.1.7}/utils/constants.py +0 -0
- {hypertrader-0.1.6 → hypertrader-0.1.7}/utils/style.py +0 -0
- {hypertrader-0.1.6 → hypertrader-0.1.7}/utils/timer.py +0 -0
- {hypertrader-0.1.6 → hypertrader-0.1.7}/utils/worker.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hypertrader
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.7
|
|
4
4
|
Summary: Async Hyperliquid trading helper built on the async SDK.
|
|
5
5
|
Author: darkerego
|
|
6
6
|
License: MIT
|
|
@@ -31,7 +31,14 @@ Dynamic: summary
|
|
|
31
31
|
|
|
32
32
|
# Hypertrader
|
|
33
33
|
|
|
34
|
-
Async Hyperliquid trading helper built around
|
|
34
|
+
Async Hyperliquid trading helper built around my async SDK: [hyperliquid-python-sdk-async](https://github.com/darkerego/hyperliquid-python-sdk-async).
|
|
35
|
+
|
|
36
|
+
## Warning
|
|
37
|
+
|
|
38
|
+
This is alpha software currently in development. Trade carefully, and if you encounter
|
|
39
|
+
any problems, please open an issue so that I can fic them.
|
|
40
|
+
|
|
41
|
+
## About
|
|
35
42
|
|
|
36
43
|
The canonical bot file in this repo is [`hypertrader.py`](/media/anon/development/anon/PycharmProjects/hypertrader/hypertrader.py). It provides five modes:
|
|
37
44
|
|
|
@@ -89,6 +96,9 @@ https://ta-lib.org/install/#linux
|
|
|
89
96
|
|
|
90
97
|
## Configuration
|
|
91
98
|
|
|
99
|
+
|
|
100
|
+
##### [*] Account creation:
|
|
101
|
+
|
|
92
102
|
1) Create a hyperliquid account with referral code `DARKEREGO` with this URL:
|
|
93
103
|
|
|
94
104
|
[https://app.hyperliquid.xyz/join/DARKEREGO](https://app.hyperliquid.xyz/join/DARKEREGO)
|
|
@@ -102,10 +112,12 @@ https://ta-lib.org/install/#linux
|
|
|
102
112
|
```text
|
|
103
113
|
HYPERLIQUID_SECRET_KEY=...
|
|
104
114
|
HYPERLIQUID_ACCOUNT_ADDRESS=...
|
|
115
|
+
HYPERLIQUID_TESTNET_SECRET_KEY # optional, for testnet
|
|
105
116
|
```
|
|
106
117
|
|
|
107
118
|
- `HYPERLIQUID_SECRET_KEY`: private key for the trading wallet or API wallet (the API key you just created)
|
|
108
119
|
- `HYPERLIQUID_ACCOUNT_ADDRESS`: main account address used for the account state
|
|
120
|
+
- `HYPERLIQUID_TESTNET_SECRET_KEY`: optional testnet API key
|
|
109
121
|
|
|
110
122
|
Do not commit real credentials.
|
|
111
123
|
|
|
@@ -135,7 +147,13 @@ Enter, let TP level 1 fill, then cancel the rest of the ladder and trail the rem
|
|
|
135
147
|
python3 hypertrader.py enter BTC long --size 0.1 --take-profit-pct 0.01 --trailing-tp
|
|
136
148
|
```
|
|
137
149
|
|
|
138
|
-
Watch
|
|
150
|
+
Watch all perpetual markets for new and currently opened positions and attach management.
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
python3 hypertrader.py watch BTC --take-profit-pct 0.01 --manage-existing
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Watch an existing position on a specific market and attach management:
|
|
139
157
|
|
|
140
158
|
```bash
|
|
141
159
|
python3 hypertrader.py watch BTC --take-profit-pct 0.01 --manage-existing
|
|
@@ -147,13 +165,26 @@ Watch a position and switch from the TP ladder to a trailing TP after TP level 1
|
|
|
147
165
|
python3 hypertrader.py watch BTC --take-profit-pct 0.01 --manage-existing --trailing-tp
|
|
148
166
|
```
|
|
149
167
|
|
|
150
|
-
Run local trailing management:
|
|
168
|
+
Run local trailing management for all perpetual markets:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
python3 hypertrader.py trailing --trail-pct 0.01
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
Run local trailing management for a specific market:
|
|
151
176
|
|
|
152
177
|
```bash
|
|
153
178
|
python3 hypertrader.py trailing BTC --trail-pct 0.01
|
|
154
179
|
```
|
|
155
180
|
|
|
156
|
-
Dry-run auto mode across
|
|
181
|
+
Dry-run auto mode across the top 15 markets by volume concurrently, open positions with 10% of accounts' collateral:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
python3 hypertrader.py auto --intervals "1m 3m 5m" --top-markets 15 --size-pct 10 --dry-run
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Dry-run auto mode across short intervals on a specific market only with a static position size:
|
|
157
188
|
|
|
158
189
|
```bash
|
|
159
190
|
python3 hypertrader.py auto SOL --intervals "1m 3m 5m" --size 10 --dry-run
|
|
@@ -247,7 +278,14 @@ Key options:
|
|
|
247
278
|
|
|
248
279
|
### `auto`
|
|
249
280
|
|
|
250
|
-
|
|
281
|
+
`auto` now supports selectable strategies:
|
|
282
|
+
|
|
283
|
+
- `default`: the existing MACD/SAR/ADX/Bollinger auto trader and the implicit default when `--strategy` is omitted
|
|
284
|
+
- `reversal`: a closed-candle trend-exhaustion, structure-break, and retest strategy
|
|
285
|
+
|
|
286
|
+
The strategy selection changes the signal engine only. Shared sizing, risk controls, modify-order entry, market-fallback cleanup, hidden-order behavior, and bracket management still run through the same common auto execution path.
|
|
287
|
+
|
|
288
|
+
The default strategy scans one coin or the top perp markets using TA-Lib signals from:
|
|
251
289
|
|
|
252
290
|
- MACD
|
|
253
291
|
- Parabolic SAR
|
|
@@ -262,6 +300,7 @@ python3 hypertrader.py auto [COIN] (--size SIZE | --size-pct SIZE_PCT) [options]
|
|
|
262
300
|
|
|
263
301
|
Key options:
|
|
264
302
|
|
|
303
|
+
- `--strategy {default,reversal}`
|
|
265
304
|
- `--size` or `--size-pct`
|
|
266
305
|
- `--top-markets`
|
|
267
306
|
- `--intervals`
|
|
@@ -288,7 +327,6 @@ Key options:
|
|
|
288
327
|
- `--take-profit-levels`
|
|
289
328
|
- `--trailing-tp`
|
|
290
329
|
- `--trailing-tp-trigger-level`
|
|
291
|
-
- `--trailing-tp-remaining-levels`
|
|
292
330
|
- `--trailing-tp-profit-pct`
|
|
293
331
|
- `--entry-retries`
|
|
294
332
|
- `--entry-repost-interval`
|
|
@@ -316,13 +354,64 @@ Key options:
|
|
|
316
354
|
- `--session-max-loss`
|
|
317
355
|
- `--session-giveback-pct`
|
|
318
356
|
- `--risk-session-log`
|
|
319
|
-
- `--ws-candles`
|
|
357
|
+
- `--disable-ws-candles`
|
|
320
358
|
- `--hide-orders` or `-ho`
|
|
321
359
|
- `--testnet`
|
|
322
360
|
- `--no-websocket`
|
|
323
361
|
|
|
324
362
|
`auto` derives TP from Bollinger Bands unless `--take-profit-pct` overrides it. If TP is set and SL is omitted, SL defaults to half TP. Executions route through the same bracket-entry path used by `enter`.
|
|
325
363
|
|
|
364
|
+
Reversal strategy notes:
|
|
365
|
+
|
|
366
|
+
- All confirmations use closed candles only.
|
|
367
|
+
- SAR alone never opens a trade.
|
|
368
|
+
- A trade requires: prior trend, exhaustion, confirmed Williams-fractal structure break, then a confirmed retest.
|
|
369
|
+
- Default reversal intervals are `--trend-interval 1h` and `--entry-interval 15m`.
|
|
370
|
+
- Reversal entries build explicit entry, stop, and multi-target plans before handing execution to the shared auto engine.
|
|
371
|
+
- Hidden-order mode still applies: `--hide-orders` keeps reversal TP/SL targets local until trigger conditions are met.
|
|
372
|
+
|
|
373
|
+
Important reversal-specific options:
|
|
374
|
+
|
|
375
|
+
- `--trend-interval`: higher timeframe used for prior-trend classification
|
|
376
|
+
- `--entry-interval`: lower timeframe used for structure-break and retest confirmation
|
|
377
|
+
- `--reversal-min-adx`: minimum higher-timeframe ADX required before a reversal setup is considered
|
|
378
|
+
- `--reversal-exhaustion-score`: minimum exhaustion confirmations required before structure-break tracking starts
|
|
379
|
+
- `--reversal-retest-timeout`: number of entry candles allowed for the retest to confirm before the setup expires
|
|
380
|
+
- `--reversal-stop-atr-buffer`: ATR buffer added beyond the invalidation point when computing the stop
|
|
381
|
+
- `--reversal-max-stop-atr`: caps the stop width in ATR terms
|
|
382
|
+
- `--reversal-min-rr`: minimum reward-to-risk ratio required for a valid execution plan
|
|
383
|
+
- `--reversal-tp1-r`, `--reversal-tp2-r`, `--reversal-tp3-r`: target distances in multiples of initial risk
|
|
384
|
+
- `--reversal-tp1-pct`, `--reversal-tp2-pct`, `--reversal-runner-pct`: allocation percentages for the three reversal exits; they must sum to `100`
|
|
385
|
+
- `--reversal-exit-on-sar-flip` / `--no-reversal-exit-on-sar-flip`: enable or disable SAR-flip managed exits after entry
|
|
386
|
+
- `--reversal-min-ema50-slope`: minimum absolute higher-timeframe EMA slope required to qualify the prior trend
|
|
387
|
+
|
|
388
|
+
Example single-coin reversal scan:
|
|
389
|
+
|
|
390
|
+
```bash
|
|
391
|
+
python3 hypertrader.py auto --strategy reversal \
|
|
392
|
+
BTC \
|
|
393
|
+
--size-pct 5 \
|
|
394
|
+
--trend-interval 1h \
|
|
395
|
+
--entry-interval 15m \
|
|
396
|
+
--reversal-min-adx 18 \
|
|
397
|
+
--reversal-exhaustion-score 2 \
|
|
398
|
+
--reversal-min-rr 1.8 \
|
|
399
|
+
--reversal-exit-on-sar-flip
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
Example top-market reversal scan:
|
|
403
|
+
|
|
404
|
+
```bash
|
|
405
|
+
python3 hypertrader.py auto --strategy reversal \
|
|
406
|
+
--top-markets 30 \
|
|
407
|
+
--size-pct 5 \
|
|
408
|
+
--trend-interval 1h \
|
|
409
|
+
--entry-interval 15m \
|
|
410
|
+
--scan-interval 30 \
|
|
411
|
+
--loop-after-trade \
|
|
412
|
+
--max-coin-trades-per-session 3
|
|
413
|
+
```
|
|
414
|
+
|
|
326
415
|
Additional `auto` parameter notes:
|
|
327
416
|
|
|
328
417
|
- `--max-concurrent-scans`: limits how many markets are scanned in parallel in each auto loop.
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# Hypertrader
|
|
2
2
|
|
|
3
|
-
Async Hyperliquid trading helper built around
|
|
3
|
+
Async Hyperliquid trading helper built around my async SDK: [hyperliquid-python-sdk-async](https://github.com/darkerego/hyperliquid-python-sdk-async).
|
|
4
|
+
|
|
5
|
+
## Warning
|
|
6
|
+
|
|
7
|
+
This is alpha software currently in development. Trade carefully, and if you encounter
|
|
8
|
+
any problems, please open an issue so that I can fic them.
|
|
9
|
+
|
|
10
|
+
## About
|
|
4
11
|
|
|
5
12
|
The canonical bot file in this repo is [`hypertrader.py`](/media/anon/development/anon/PycharmProjects/hypertrader/hypertrader.py). It provides five modes:
|
|
6
13
|
|
|
@@ -58,6 +65,9 @@ https://ta-lib.org/install/#linux
|
|
|
58
65
|
|
|
59
66
|
## Configuration
|
|
60
67
|
|
|
68
|
+
|
|
69
|
+
##### [*] Account creation:
|
|
70
|
+
|
|
61
71
|
1) Create a hyperliquid account with referral code `DARKEREGO` with this URL:
|
|
62
72
|
|
|
63
73
|
[https://app.hyperliquid.xyz/join/DARKEREGO](https://app.hyperliquid.xyz/join/DARKEREGO)
|
|
@@ -71,10 +81,12 @@ https://ta-lib.org/install/#linux
|
|
|
71
81
|
```text
|
|
72
82
|
HYPERLIQUID_SECRET_KEY=...
|
|
73
83
|
HYPERLIQUID_ACCOUNT_ADDRESS=...
|
|
84
|
+
HYPERLIQUID_TESTNET_SECRET_KEY # optional, for testnet
|
|
74
85
|
```
|
|
75
86
|
|
|
76
87
|
- `HYPERLIQUID_SECRET_KEY`: private key for the trading wallet or API wallet (the API key you just created)
|
|
77
88
|
- `HYPERLIQUID_ACCOUNT_ADDRESS`: main account address used for the account state
|
|
89
|
+
- `HYPERLIQUID_TESTNET_SECRET_KEY`: optional testnet API key
|
|
78
90
|
|
|
79
91
|
Do not commit real credentials.
|
|
80
92
|
|
|
@@ -104,7 +116,13 @@ Enter, let TP level 1 fill, then cancel the rest of the ladder and trail the rem
|
|
|
104
116
|
python3 hypertrader.py enter BTC long --size 0.1 --take-profit-pct 0.01 --trailing-tp
|
|
105
117
|
```
|
|
106
118
|
|
|
107
|
-
Watch
|
|
119
|
+
Watch all perpetual markets for new and currently opened positions and attach management.
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
python3 hypertrader.py watch BTC --take-profit-pct 0.01 --manage-existing
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Watch an existing position on a specific market and attach management:
|
|
108
126
|
|
|
109
127
|
```bash
|
|
110
128
|
python3 hypertrader.py watch BTC --take-profit-pct 0.01 --manage-existing
|
|
@@ -116,13 +134,26 @@ Watch a position and switch from the TP ladder to a trailing TP after TP level 1
|
|
|
116
134
|
python3 hypertrader.py watch BTC --take-profit-pct 0.01 --manage-existing --trailing-tp
|
|
117
135
|
```
|
|
118
136
|
|
|
119
|
-
Run local trailing management:
|
|
137
|
+
Run local trailing management for all perpetual markets:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
python3 hypertrader.py trailing --trail-pct 0.01
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
Run local trailing management for a specific market:
|
|
120
145
|
|
|
121
146
|
```bash
|
|
122
147
|
python3 hypertrader.py trailing BTC --trail-pct 0.01
|
|
123
148
|
```
|
|
124
149
|
|
|
125
|
-
Dry-run auto mode across
|
|
150
|
+
Dry-run auto mode across the top 15 markets by volume concurrently, open positions with 10% of accounts' collateral:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
python3 hypertrader.py auto --intervals "1m 3m 5m" --top-markets 15 --size-pct 10 --dry-run
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Dry-run auto mode across short intervals on a specific market only with a static position size:
|
|
126
157
|
|
|
127
158
|
```bash
|
|
128
159
|
python3 hypertrader.py auto SOL --intervals "1m 3m 5m" --size 10 --dry-run
|
|
@@ -216,7 +247,14 @@ Key options:
|
|
|
216
247
|
|
|
217
248
|
### `auto`
|
|
218
249
|
|
|
219
|
-
|
|
250
|
+
`auto` now supports selectable strategies:
|
|
251
|
+
|
|
252
|
+
- `default`: the existing MACD/SAR/ADX/Bollinger auto trader and the implicit default when `--strategy` is omitted
|
|
253
|
+
- `reversal`: a closed-candle trend-exhaustion, structure-break, and retest strategy
|
|
254
|
+
|
|
255
|
+
The strategy selection changes the signal engine only. Shared sizing, risk controls, modify-order entry, market-fallback cleanup, hidden-order behavior, and bracket management still run through the same common auto execution path.
|
|
256
|
+
|
|
257
|
+
The default strategy scans one coin or the top perp markets using TA-Lib signals from:
|
|
220
258
|
|
|
221
259
|
- MACD
|
|
222
260
|
- Parabolic SAR
|
|
@@ -231,6 +269,7 @@ python3 hypertrader.py auto [COIN] (--size SIZE | --size-pct SIZE_PCT) [options]
|
|
|
231
269
|
|
|
232
270
|
Key options:
|
|
233
271
|
|
|
272
|
+
- `--strategy {default,reversal}`
|
|
234
273
|
- `--size` or `--size-pct`
|
|
235
274
|
- `--top-markets`
|
|
236
275
|
- `--intervals`
|
|
@@ -257,7 +296,6 @@ Key options:
|
|
|
257
296
|
- `--take-profit-levels`
|
|
258
297
|
- `--trailing-tp`
|
|
259
298
|
- `--trailing-tp-trigger-level`
|
|
260
|
-
- `--trailing-tp-remaining-levels`
|
|
261
299
|
- `--trailing-tp-profit-pct`
|
|
262
300
|
- `--entry-retries`
|
|
263
301
|
- `--entry-repost-interval`
|
|
@@ -285,13 +323,64 @@ Key options:
|
|
|
285
323
|
- `--session-max-loss`
|
|
286
324
|
- `--session-giveback-pct`
|
|
287
325
|
- `--risk-session-log`
|
|
288
|
-
- `--ws-candles`
|
|
326
|
+
- `--disable-ws-candles`
|
|
289
327
|
- `--hide-orders` or `-ho`
|
|
290
328
|
- `--testnet`
|
|
291
329
|
- `--no-websocket`
|
|
292
330
|
|
|
293
331
|
`auto` derives TP from Bollinger Bands unless `--take-profit-pct` overrides it. If TP is set and SL is omitted, SL defaults to half TP. Executions route through the same bracket-entry path used by `enter`.
|
|
294
332
|
|
|
333
|
+
Reversal strategy notes:
|
|
334
|
+
|
|
335
|
+
- All confirmations use closed candles only.
|
|
336
|
+
- SAR alone never opens a trade.
|
|
337
|
+
- A trade requires: prior trend, exhaustion, confirmed Williams-fractal structure break, then a confirmed retest.
|
|
338
|
+
- Default reversal intervals are `--trend-interval 1h` and `--entry-interval 15m`.
|
|
339
|
+
- Reversal entries build explicit entry, stop, and multi-target plans before handing execution to the shared auto engine.
|
|
340
|
+
- Hidden-order mode still applies: `--hide-orders` keeps reversal TP/SL targets local until trigger conditions are met.
|
|
341
|
+
|
|
342
|
+
Important reversal-specific options:
|
|
343
|
+
|
|
344
|
+
- `--trend-interval`: higher timeframe used for prior-trend classification
|
|
345
|
+
- `--entry-interval`: lower timeframe used for structure-break and retest confirmation
|
|
346
|
+
- `--reversal-min-adx`: minimum higher-timeframe ADX required before a reversal setup is considered
|
|
347
|
+
- `--reversal-exhaustion-score`: minimum exhaustion confirmations required before structure-break tracking starts
|
|
348
|
+
- `--reversal-retest-timeout`: number of entry candles allowed for the retest to confirm before the setup expires
|
|
349
|
+
- `--reversal-stop-atr-buffer`: ATR buffer added beyond the invalidation point when computing the stop
|
|
350
|
+
- `--reversal-max-stop-atr`: caps the stop width in ATR terms
|
|
351
|
+
- `--reversal-min-rr`: minimum reward-to-risk ratio required for a valid execution plan
|
|
352
|
+
- `--reversal-tp1-r`, `--reversal-tp2-r`, `--reversal-tp3-r`: target distances in multiples of initial risk
|
|
353
|
+
- `--reversal-tp1-pct`, `--reversal-tp2-pct`, `--reversal-runner-pct`: allocation percentages for the three reversal exits; they must sum to `100`
|
|
354
|
+
- `--reversal-exit-on-sar-flip` / `--no-reversal-exit-on-sar-flip`: enable or disable SAR-flip managed exits after entry
|
|
355
|
+
- `--reversal-min-ema50-slope`: minimum absolute higher-timeframe EMA slope required to qualify the prior trend
|
|
356
|
+
|
|
357
|
+
Example single-coin reversal scan:
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
python3 hypertrader.py auto --strategy reversal \
|
|
361
|
+
BTC \
|
|
362
|
+
--size-pct 5 \
|
|
363
|
+
--trend-interval 1h \
|
|
364
|
+
--entry-interval 15m \
|
|
365
|
+
--reversal-min-adx 18 \
|
|
366
|
+
--reversal-exhaustion-score 2 \
|
|
367
|
+
--reversal-min-rr 1.8 \
|
|
368
|
+
--reversal-exit-on-sar-flip
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
Example top-market reversal scan:
|
|
372
|
+
|
|
373
|
+
```bash
|
|
374
|
+
python3 hypertrader.py auto --strategy reversal \
|
|
375
|
+
--top-markets 30 \
|
|
376
|
+
--size-pct 5 \
|
|
377
|
+
--trend-interval 1h \
|
|
378
|
+
--entry-interval 15m \
|
|
379
|
+
--scan-interval 30 \
|
|
380
|
+
--loop-after-trade \
|
|
381
|
+
--max-coin-trades-per-session 3
|
|
382
|
+
```
|
|
383
|
+
|
|
295
384
|
Additional `auto` parameter notes:
|
|
296
385
|
|
|
297
386
|
- `--max-concurrent-scans`: limits how many markets are scanned in parallel in each auto loop.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hypertrader
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.7
|
|
4
4
|
Summary: Async Hyperliquid trading helper built on the async SDK.
|
|
5
5
|
Author: darkerego
|
|
6
6
|
License: MIT
|
|
@@ -31,7 +31,14 @@ Dynamic: summary
|
|
|
31
31
|
|
|
32
32
|
# Hypertrader
|
|
33
33
|
|
|
34
|
-
Async Hyperliquid trading helper built around
|
|
34
|
+
Async Hyperliquid trading helper built around my async SDK: [hyperliquid-python-sdk-async](https://github.com/darkerego/hyperliquid-python-sdk-async).
|
|
35
|
+
|
|
36
|
+
## Warning
|
|
37
|
+
|
|
38
|
+
This is alpha software currently in development. Trade carefully, and if you encounter
|
|
39
|
+
any problems, please open an issue so that I can fic them.
|
|
40
|
+
|
|
41
|
+
## About
|
|
35
42
|
|
|
36
43
|
The canonical bot file in this repo is [`hypertrader.py`](/media/anon/development/anon/PycharmProjects/hypertrader/hypertrader.py). It provides five modes:
|
|
37
44
|
|
|
@@ -89,6 +96,9 @@ https://ta-lib.org/install/#linux
|
|
|
89
96
|
|
|
90
97
|
## Configuration
|
|
91
98
|
|
|
99
|
+
|
|
100
|
+
##### [*] Account creation:
|
|
101
|
+
|
|
92
102
|
1) Create a hyperliquid account with referral code `DARKEREGO` with this URL:
|
|
93
103
|
|
|
94
104
|
[https://app.hyperliquid.xyz/join/DARKEREGO](https://app.hyperliquid.xyz/join/DARKEREGO)
|
|
@@ -102,10 +112,12 @@ https://ta-lib.org/install/#linux
|
|
|
102
112
|
```text
|
|
103
113
|
HYPERLIQUID_SECRET_KEY=...
|
|
104
114
|
HYPERLIQUID_ACCOUNT_ADDRESS=...
|
|
115
|
+
HYPERLIQUID_TESTNET_SECRET_KEY # optional, for testnet
|
|
105
116
|
```
|
|
106
117
|
|
|
107
118
|
- `HYPERLIQUID_SECRET_KEY`: private key for the trading wallet or API wallet (the API key you just created)
|
|
108
119
|
- `HYPERLIQUID_ACCOUNT_ADDRESS`: main account address used for the account state
|
|
120
|
+
- `HYPERLIQUID_TESTNET_SECRET_KEY`: optional testnet API key
|
|
109
121
|
|
|
110
122
|
Do not commit real credentials.
|
|
111
123
|
|
|
@@ -135,7 +147,13 @@ Enter, let TP level 1 fill, then cancel the rest of the ladder and trail the rem
|
|
|
135
147
|
python3 hypertrader.py enter BTC long --size 0.1 --take-profit-pct 0.01 --trailing-tp
|
|
136
148
|
```
|
|
137
149
|
|
|
138
|
-
Watch
|
|
150
|
+
Watch all perpetual markets for new and currently opened positions and attach management.
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
python3 hypertrader.py watch BTC --take-profit-pct 0.01 --manage-existing
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Watch an existing position on a specific market and attach management:
|
|
139
157
|
|
|
140
158
|
```bash
|
|
141
159
|
python3 hypertrader.py watch BTC --take-profit-pct 0.01 --manage-existing
|
|
@@ -147,13 +165,26 @@ Watch a position and switch from the TP ladder to a trailing TP after TP level 1
|
|
|
147
165
|
python3 hypertrader.py watch BTC --take-profit-pct 0.01 --manage-existing --trailing-tp
|
|
148
166
|
```
|
|
149
167
|
|
|
150
|
-
Run local trailing management:
|
|
168
|
+
Run local trailing management for all perpetual markets:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
python3 hypertrader.py trailing --trail-pct 0.01
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
Run local trailing management for a specific market:
|
|
151
176
|
|
|
152
177
|
```bash
|
|
153
178
|
python3 hypertrader.py trailing BTC --trail-pct 0.01
|
|
154
179
|
```
|
|
155
180
|
|
|
156
|
-
Dry-run auto mode across
|
|
181
|
+
Dry-run auto mode across the top 15 markets by volume concurrently, open positions with 10% of accounts' collateral:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
python3 hypertrader.py auto --intervals "1m 3m 5m" --top-markets 15 --size-pct 10 --dry-run
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Dry-run auto mode across short intervals on a specific market only with a static position size:
|
|
157
188
|
|
|
158
189
|
```bash
|
|
159
190
|
python3 hypertrader.py auto SOL --intervals "1m 3m 5m" --size 10 --dry-run
|
|
@@ -247,7 +278,14 @@ Key options:
|
|
|
247
278
|
|
|
248
279
|
### `auto`
|
|
249
280
|
|
|
250
|
-
|
|
281
|
+
`auto` now supports selectable strategies:
|
|
282
|
+
|
|
283
|
+
- `default`: the existing MACD/SAR/ADX/Bollinger auto trader and the implicit default when `--strategy` is omitted
|
|
284
|
+
- `reversal`: a closed-candle trend-exhaustion, structure-break, and retest strategy
|
|
285
|
+
|
|
286
|
+
The strategy selection changes the signal engine only. Shared sizing, risk controls, modify-order entry, market-fallback cleanup, hidden-order behavior, and bracket management still run through the same common auto execution path.
|
|
287
|
+
|
|
288
|
+
The default strategy scans one coin or the top perp markets using TA-Lib signals from:
|
|
251
289
|
|
|
252
290
|
- MACD
|
|
253
291
|
- Parabolic SAR
|
|
@@ -262,6 +300,7 @@ python3 hypertrader.py auto [COIN] (--size SIZE | --size-pct SIZE_PCT) [options]
|
|
|
262
300
|
|
|
263
301
|
Key options:
|
|
264
302
|
|
|
303
|
+
- `--strategy {default,reversal}`
|
|
265
304
|
- `--size` or `--size-pct`
|
|
266
305
|
- `--top-markets`
|
|
267
306
|
- `--intervals`
|
|
@@ -288,7 +327,6 @@ Key options:
|
|
|
288
327
|
- `--take-profit-levels`
|
|
289
328
|
- `--trailing-tp`
|
|
290
329
|
- `--trailing-tp-trigger-level`
|
|
291
|
-
- `--trailing-tp-remaining-levels`
|
|
292
330
|
- `--trailing-tp-profit-pct`
|
|
293
331
|
- `--entry-retries`
|
|
294
332
|
- `--entry-repost-interval`
|
|
@@ -316,13 +354,64 @@ Key options:
|
|
|
316
354
|
- `--session-max-loss`
|
|
317
355
|
- `--session-giveback-pct`
|
|
318
356
|
- `--risk-session-log`
|
|
319
|
-
- `--ws-candles`
|
|
357
|
+
- `--disable-ws-candles`
|
|
320
358
|
- `--hide-orders` or `-ho`
|
|
321
359
|
- `--testnet`
|
|
322
360
|
- `--no-websocket`
|
|
323
361
|
|
|
324
362
|
`auto` derives TP from Bollinger Bands unless `--take-profit-pct` overrides it. If TP is set and SL is omitted, SL defaults to half TP. Executions route through the same bracket-entry path used by `enter`.
|
|
325
363
|
|
|
364
|
+
Reversal strategy notes:
|
|
365
|
+
|
|
366
|
+
- All confirmations use closed candles only.
|
|
367
|
+
- SAR alone never opens a trade.
|
|
368
|
+
- A trade requires: prior trend, exhaustion, confirmed Williams-fractal structure break, then a confirmed retest.
|
|
369
|
+
- Default reversal intervals are `--trend-interval 1h` and `--entry-interval 15m`.
|
|
370
|
+
- Reversal entries build explicit entry, stop, and multi-target plans before handing execution to the shared auto engine.
|
|
371
|
+
- Hidden-order mode still applies: `--hide-orders` keeps reversal TP/SL targets local until trigger conditions are met.
|
|
372
|
+
|
|
373
|
+
Important reversal-specific options:
|
|
374
|
+
|
|
375
|
+
- `--trend-interval`: higher timeframe used for prior-trend classification
|
|
376
|
+
- `--entry-interval`: lower timeframe used for structure-break and retest confirmation
|
|
377
|
+
- `--reversal-min-adx`: minimum higher-timeframe ADX required before a reversal setup is considered
|
|
378
|
+
- `--reversal-exhaustion-score`: minimum exhaustion confirmations required before structure-break tracking starts
|
|
379
|
+
- `--reversal-retest-timeout`: number of entry candles allowed for the retest to confirm before the setup expires
|
|
380
|
+
- `--reversal-stop-atr-buffer`: ATR buffer added beyond the invalidation point when computing the stop
|
|
381
|
+
- `--reversal-max-stop-atr`: caps the stop width in ATR terms
|
|
382
|
+
- `--reversal-min-rr`: minimum reward-to-risk ratio required for a valid execution plan
|
|
383
|
+
- `--reversal-tp1-r`, `--reversal-tp2-r`, `--reversal-tp3-r`: target distances in multiples of initial risk
|
|
384
|
+
- `--reversal-tp1-pct`, `--reversal-tp2-pct`, `--reversal-runner-pct`: allocation percentages for the three reversal exits; they must sum to `100`
|
|
385
|
+
- `--reversal-exit-on-sar-flip` / `--no-reversal-exit-on-sar-flip`: enable or disable SAR-flip managed exits after entry
|
|
386
|
+
- `--reversal-min-ema50-slope`: minimum absolute higher-timeframe EMA slope required to qualify the prior trend
|
|
387
|
+
|
|
388
|
+
Example single-coin reversal scan:
|
|
389
|
+
|
|
390
|
+
```bash
|
|
391
|
+
python3 hypertrader.py auto --strategy reversal \
|
|
392
|
+
BTC \
|
|
393
|
+
--size-pct 5 \
|
|
394
|
+
--trend-interval 1h \
|
|
395
|
+
--entry-interval 15m \
|
|
396
|
+
--reversal-min-adx 18 \
|
|
397
|
+
--reversal-exhaustion-score 2 \
|
|
398
|
+
--reversal-min-rr 1.8 \
|
|
399
|
+
--reversal-exit-on-sar-flip
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
Example top-market reversal scan:
|
|
403
|
+
|
|
404
|
+
```bash
|
|
405
|
+
python3 hypertrader.py auto --strategy reversal \
|
|
406
|
+
--top-markets 30 \
|
|
407
|
+
--size-pct 5 \
|
|
408
|
+
--trend-interval 1h \
|
|
409
|
+
--entry-interval 15m \
|
|
410
|
+
--scan-interval 30 \
|
|
411
|
+
--loop-after-trade \
|
|
412
|
+
--max-coin-trades-per-session 3
|
|
413
|
+
```
|
|
414
|
+
|
|
326
415
|
Additional `auto` parameter notes:
|
|
327
416
|
|
|
328
417
|
- `--max-concurrent-scans`: limits how many markets are scanned in parallel in each auto loop.
|
|
@@ -12,6 +12,14 @@ modes/market_maker.py
|
|
|
12
12
|
modes/position_management.py
|
|
13
13
|
modes/position_watcher.py
|
|
14
14
|
modes/trailing_stop.py
|
|
15
|
+
strategies/__init__.py
|
|
16
|
+
strategies/base.py
|
|
17
|
+
strategies/default.py
|
|
18
|
+
strategies/registry.py
|
|
19
|
+
strategies/reversal.py
|
|
20
|
+
tests/test_async_hyperliquid.py
|
|
21
|
+
tests/test_auto_strategy_registry.py
|
|
22
|
+
tests/test_reversal_strategy.py
|
|
15
23
|
utils/constants.py
|
|
16
24
|
utils/helpers.py
|
|
17
25
|
utils/style.py
|