hypertrader 0.1.6__tar.gz → 0.1.8__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.8}/PKG-INFO +132 -8
- {hypertrader-0.1.6 → hypertrader-0.1.8}/README.md +131 -7
- {hypertrader-0.1.6 → hypertrader-0.1.8}/hypertrader.egg-info/PKG-INFO +132 -8
- hypertrader-0.1.8/hypertrader.egg-info/SOURCES.txt +35 -0
- {hypertrader-0.1.6 → hypertrader-0.1.8}/hypertrader.egg-info/top_level.txt +1 -0
- {hypertrader-0.1.6 → hypertrader-0.1.8}/hypertrader.py +260 -9
- {hypertrader-0.1.6 → hypertrader-0.1.8}/modes/auto_trader.py +692 -166
- {hypertrader-0.1.6 → hypertrader-0.1.8}/modes/market_maker.py +6 -3
- {hypertrader-0.1.6 → hypertrader-0.1.8}/modes/position_management.py +17 -7
- {hypertrader-0.1.6 → hypertrader-0.1.8}/modes/position_watcher.py +7 -7
- hypertrader-0.1.8/modes/trailing_stop.py +776 -0
- {hypertrader-0.1.6 → hypertrader-0.1.8}/setup.py +2 -2
- hypertrader-0.1.8/strategies/__init__.py +12 -0
- hypertrader-0.1.8/strategies/base.py +79 -0
- hypertrader-0.1.8/strategies/default.py +751 -0
- hypertrader-0.1.8/strategies/orderflow_metrics.py +350 -0
- hypertrader-0.1.8/strategies/orderflow_models.py +160 -0
- hypertrader-0.1.8/strategies/orderflow_pullback.py +808 -0
- hypertrader-0.1.8/strategies/registry.py +45 -0
- hypertrader-0.1.8/strategies/reversal.py +981 -0
- hypertrader-0.1.8/tests/test_async_hyperliquid.py +621 -0
- hypertrader-0.1.8/tests/test_auto_strategy_registry.py +243 -0
- hypertrader-0.1.8/tests/test_auto_trader_logging.py +130 -0
- hypertrader-0.1.8/tests/test_market_ids.py +72 -0
- hypertrader-0.1.8/tests/test_orderflow_metrics.py +180 -0
- hypertrader-0.1.8/tests/test_orderflow_pullback_lifecycle.py +325 -0
- hypertrader-0.1.8/tests/test_reversal_strategy.py +329 -0
- hypertrader-0.1.8/tests/test_trailing_stop.py +415 -0
- {hypertrader-0.1.6 → hypertrader-0.1.8}/utils/helpers.py +102 -53
- hypertrader-0.1.6/hypertrader.egg-info/SOURCES.txt +0 -19
- hypertrader-0.1.6/modes/trailing_stop.py +0 -277
- {hypertrader-0.1.6 → hypertrader-0.1.8}/hypertrader.egg-info/dependency_links.txt +0 -0
- {hypertrader-0.1.6 → hypertrader-0.1.8}/hypertrader.egg-info/entry_points.txt +0 -0
- {hypertrader-0.1.6 → hypertrader-0.1.8}/hypertrader.egg-info/requires.txt +0 -0
- {hypertrader-0.1.6 → hypertrader-0.1.8}/setup.cfg +0 -0
- {hypertrader-0.1.6 → hypertrader-0.1.8}/utils/constants.py +0 -0
- {hypertrader-0.1.6 → hypertrader-0.1.8}/utils/style.py +0 -0
- {hypertrader-0.1.6 → hypertrader-0.1.8}/utils/timer.py +0 -0
- {hypertrader-0.1.6 → hypertrader-0.1.8}/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.8
|
|
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,15 @@ 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
|
+
- `orderflow_pullback`: order-flow-confirmed trend pullback scalp strategy, also available as `of_pullback` and `orderflow`
|
|
285
|
+
- `reversal`: a closed-candle trend-exhaustion, structure-break, and retest strategy
|
|
286
|
+
|
|
287
|
+
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.
|
|
288
|
+
|
|
289
|
+
The default strategy scans one coin or the top perp markets using TA-Lib signals from:
|
|
251
290
|
|
|
252
291
|
- MACD
|
|
253
292
|
- Parabolic SAR
|
|
@@ -262,6 +301,8 @@ python3 hypertrader.py auto [COIN] (--size SIZE | --size-pct SIZE_PCT) [options]
|
|
|
262
301
|
|
|
263
302
|
Key options:
|
|
264
303
|
|
|
304
|
+
- `--strategy {default,reversal}`
|
|
305
|
+
- `--strategy {default,orderflow_pullback,reversal}` with aliases `of_pullback` and `orderflow`
|
|
265
306
|
- `--size` or `--size-pct`
|
|
266
307
|
- `--top-markets`
|
|
267
308
|
- `--intervals`
|
|
@@ -288,7 +329,6 @@ Key options:
|
|
|
288
329
|
- `--take-profit-levels`
|
|
289
330
|
- `--trailing-tp`
|
|
290
331
|
- `--trailing-tp-trigger-level`
|
|
291
|
-
- `--trailing-tp-remaining-levels`
|
|
292
332
|
- `--trailing-tp-profit-pct`
|
|
293
333
|
- `--entry-retries`
|
|
294
334
|
- `--entry-repost-interval`
|
|
@@ -316,13 +356,97 @@ Key options:
|
|
|
316
356
|
- `--session-max-loss`
|
|
317
357
|
- `--session-giveback-pct`
|
|
318
358
|
- `--risk-session-log`
|
|
319
|
-
- `--ws-candles`
|
|
359
|
+
- `--disable-ws-candles`
|
|
320
360
|
- `--hide-orders` or `-ho`
|
|
321
361
|
- `--testnet`
|
|
322
362
|
- `--no-websocket`
|
|
323
363
|
|
|
324
364
|
`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
365
|
|
|
366
|
+
Reversal strategy notes:
|
|
367
|
+
|
|
368
|
+
- All confirmations use closed candles only.
|
|
369
|
+
- SAR alone never opens a trade.
|
|
370
|
+
- A trade requires: prior trend, exhaustion, confirmed Williams-fractal structure break, then a confirmed retest.
|
|
371
|
+
- Default reversal intervals are `--trend-interval 1h` and `--entry-interval 15m`.
|
|
372
|
+
- Reversal entries build explicit entry, stop, and multi-target plans before handing execution to the shared auto engine.
|
|
373
|
+
- Hidden-order mode still applies: `--hide-orders` keeps reversal TP/SL targets local until trigger conditions are met.
|
|
374
|
+
|
|
375
|
+
Important reversal-specific options:
|
|
376
|
+
|
|
377
|
+
- `--trend-interval`: higher timeframe used for prior-trend classification
|
|
378
|
+
- `--entry-interval`: lower timeframe used for structure-break and retest confirmation
|
|
379
|
+
- `--reversal-min-adx`: minimum higher-timeframe ADX required before a reversal setup is considered
|
|
380
|
+
- `--reversal-exhaustion-score`: minimum exhaustion confirmations required before structure-break tracking starts
|
|
381
|
+
- `--reversal-retest-timeout`: number of entry candles allowed for the retest to confirm before the setup expires
|
|
382
|
+
- `--reversal-stop-atr-buffer`: ATR buffer added beyond the invalidation point when computing the stop
|
|
383
|
+
- `--reversal-max-stop-atr`: caps the stop width in ATR terms
|
|
384
|
+
- `--reversal-min-rr`: minimum reward-to-risk ratio required for a valid execution plan
|
|
385
|
+
- `--reversal-tp1-r`, `--reversal-tp2-r`, `--reversal-tp3-r`: target distances in multiples of initial risk
|
|
386
|
+
- `--reversal-tp1-pct`, `--reversal-tp2-pct`, `--reversal-runner-pct`: allocation percentages for the three reversal exits; they must sum to `100`
|
|
387
|
+
- `--reversal-exit-on-sar-flip` / `--no-reversal-exit-on-sar-flip`: enable or disable SAR-flip managed exits after entry
|
|
388
|
+
- `--reversal-min-ema50-slope`: minimum absolute higher-timeframe EMA slope required to qualify the prior trend
|
|
389
|
+
|
|
390
|
+
Example single-coin reversal scan:
|
|
391
|
+
|
|
392
|
+
```bash
|
|
393
|
+
python3 hypertrader.py auto --strategy reversal \
|
|
394
|
+
BTC \
|
|
395
|
+
--size-pct 5 \
|
|
396
|
+
--trend-interval 1h \
|
|
397
|
+
--entry-interval 15m \
|
|
398
|
+
--reversal-min-adx 18 \
|
|
399
|
+
--reversal-exhaustion-score 2 \
|
|
400
|
+
--reversal-min-rr 1.8 \
|
|
401
|
+
--reversal-exit-on-sar-flip
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
Order-flow pullback strategy notes:
|
|
405
|
+
|
|
406
|
+
- Uses closed `1m`/`5m` candles for regime context and live `l2Book` plus `trades` websocket feeds for entry confirmation.
|
|
407
|
+
- Indicators classify context only; executed trade flow, weighted book imbalance, and microprice authorize entries.
|
|
408
|
+
- Entries still route through the shared modify-order post-only entry path.
|
|
409
|
+
- Hidden-order mode still applies: `--hide-orders` keeps TP/SL targets local instead of placing exchange-visible brackets.
|
|
410
|
+
|
|
411
|
+
Important order-flow options:
|
|
412
|
+
|
|
413
|
+
- `--of-max-active-books`: maximum promoted markets with live book/trade monitoring
|
|
414
|
+
- `--of-max-spread-bps` and `--of-max-spread-ratio`: live spread gates
|
|
415
|
+
- `--of-min-depth-ratio`: executable depth gate versus intended order notional
|
|
416
|
+
- `--of-warmup-seconds`: warm-up period after promotion before entries are allowed
|
|
417
|
+
- `--of-min-edge-cost-multiple`: expected-move versus estimated round-trip-cost gate
|
|
418
|
+
- `--of-pullback-min` and `--of-pullback-max`: retracement zone bounds
|
|
419
|
+
- `--of-book-imbalance-min`, `--of-micro-bias-min`, `--of-trade-imbalance-2s-min`, and `--of-trade-imbalance-10s-min`: mandatory confirmation thresholds
|
|
420
|
+
- `--of-entry-timeout-seconds` and `--of-max-chase-ticks`: entry aggressiveness controls layered onto the shared entry helper
|
|
421
|
+
|
|
422
|
+
Example order-flow scan:
|
|
423
|
+
|
|
424
|
+
```bash
|
|
425
|
+
python3 hypertrader.py auto \
|
|
426
|
+
--strategy orderflow_pullback \
|
|
427
|
+
--top-markets 30 \
|
|
428
|
+
--size-pct 5 \
|
|
429
|
+
--scan-interval 1 \
|
|
430
|
+
--of-max-active-books 8 \
|
|
431
|
+
--of-max-spread-bps 3 \
|
|
432
|
+
--of-min-depth-ratio 10 \
|
|
433
|
+
--of-entry-timeout-seconds 2 \
|
|
434
|
+
--of-max-chase-ticks 2
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
Example top-market reversal scan:
|
|
438
|
+
|
|
439
|
+
```bash
|
|
440
|
+
python3 hypertrader.py auto --strategy reversal \
|
|
441
|
+
--top-markets 30 \
|
|
442
|
+
--size-pct 5 \
|
|
443
|
+
--trend-interval 1h \
|
|
444
|
+
--entry-interval 15m \
|
|
445
|
+
--scan-interval 30 \
|
|
446
|
+
--loop-after-trade \
|
|
447
|
+
--max-coin-trades-per-session 3
|
|
448
|
+
```
|
|
449
|
+
|
|
326
450
|
Additional `auto` parameter notes:
|
|
327
451
|
|
|
328
452
|
- `--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,15 @@ 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
|
+
- `orderflow_pullback`: order-flow-confirmed trend pullback scalp strategy, also available as `of_pullback` and `orderflow`
|
|
254
|
+
- `reversal`: a closed-candle trend-exhaustion, structure-break, and retest strategy
|
|
255
|
+
|
|
256
|
+
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.
|
|
257
|
+
|
|
258
|
+
The default strategy scans one coin or the top perp markets using TA-Lib signals from:
|
|
220
259
|
|
|
221
260
|
- MACD
|
|
222
261
|
- Parabolic SAR
|
|
@@ -231,6 +270,8 @@ python3 hypertrader.py auto [COIN] (--size SIZE | --size-pct SIZE_PCT) [options]
|
|
|
231
270
|
|
|
232
271
|
Key options:
|
|
233
272
|
|
|
273
|
+
- `--strategy {default,reversal}`
|
|
274
|
+
- `--strategy {default,orderflow_pullback,reversal}` with aliases `of_pullback` and `orderflow`
|
|
234
275
|
- `--size` or `--size-pct`
|
|
235
276
|
- `--top-markets`
|
|
236
277
|
- `--intervals`
|
|
@@ -257,7 +298,6 @@ Key options:
|
|
|
257
298
|
- `--take-profit-levels`
|
|
258
299
|
- `--trailing-tp`
|
|
259
300
|
- `--trailing-tp-trigger-level`
|
|
260
|
-
- `--trailing-tp-remaining-levels`
|
|
261
301
|
- `--trailing-tp-profit-pct`
|
|
262
302
|
- `--entry-retries`
|
|
263
303
|
- `--entry-repost-interval`
|
|
@@ -285,13 +325,97 @@ Key options:
|
|
|
285
325
|
- `--session-max-loss`
|
|
286
326
|
- `--session-giveback-pct`
|
|
287
327
|
- `--risk-session-log`
|
|
288
|
-
- `--ws-candles`
|
|
328
|
+
- `--disable-ws-candles`
|
|
289
329
|
- `--hide-orders` or `-ho`
|
|
290
330
|
- `--testnet`
|
|
291
331
|
- `--no-websocket`
|
|
292
332
|
|
|
293
333
|
`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
334
|
|
|
335
|
+
Reversal strategy notes:
|
|
336
|
+
|
|
337
|
+
- All confirmations use closed candles only.
|
|
338
|
+
- SAR alone never opens a trade.
|
|
339
|
+
- A trade requires: prior trend, exhaustion, confirmed Williams-fractal structure break, then a confirmed retest.
|
|
340
|
+
- Default reversal intervals are `--trend-interval 1h` and `--entry-interval 15m`.
|
|
341
|
+
- Reversal entries build explicit entry, stop, and multi-target plans before handing execution to the shared auto engine.
|
|
342
|
+
- Hidden-order mode still applies: `--hide-orders` keeps reversal TP/SL targets local until trigger conditions are met.
|
|
343
|
+
|
|
344
|
+
Important reversal-specific options:
|
|
345
|
+
|
|
346
|
+
- `--trend-interval`: higher timeframe used for prior-trend classification
|
|
347
|
+
- `--entry-interval`: lower timeframe used for structure-break and retest confirmation
|
|
348
|
+
- `--reversal-min-adx`: minimum higher-timeframe ADX required before a reversal setup is considered
|
|
349
|
+
- `--reversal-exhaustion-score`: minimum exhaustion confirmations required before structure-break tracking starts
|
|
350
|
+
- `--reversal-retest-timeout`: number of entry candles allowed for the retest to confirm before the setup expires
|
|
351
|
+
- `--reversal-stop-atr-buffer`: ATR buffer added beyond the invalidation point when computing the stop
|
|
352
|
+
- `--reversal-max-stop-atr`: caps the stop width in ATR terms
|
|
353
|
+
- `--reversal-min-rr`: minimum reward-to-risk ratio required for a valid execution plan
|
|
354
|
+
- `--reversal-tp1-r`, `--reversal-tp2-r`, `--reversal-tp3-r`: target distances in multiples of initial risk
|
|
355
|
+
- `--reversal-tp1-pct`, `--reversal-tp2-pct`, `--reversal-runner-pct`: allocation percentages for the three reversal exits; they must sum to `100`
|
|
356
|
+
- `--reversal-exit-on-sar-flip` / `--no-reversal-exit-on-sar-flip`: enable or disable SAR-flip managed exits after entry
|
|
357
|
+
- `--reversal-min-ema50-slope`: minimum absolute higher-timeframe EMA slope required to qualify the prior trend
|
|
358
|
+
|
|
359
|
+
Example single-coin reversal scan:
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
python3 hypertrader.py auto --strategy reversal \
|
|
363
|
+
BTC \
|
|
364
|
+
--size-pct 5 \
|
|
365
|
+
--trend-interval 1h \
|
|
366
|
+
--entry-interval 15m \
|
|
367
|
+
--reversal-min-adx 18 \
|
|
368
|
+
--reversal-exhaustion-score 2 \
|
|
369
|
+
--reversal-min-rr 1.8 \
|
|
370
|
+
--reversal-exit-on-sar-flip
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
Order-flow pullback strategy notes:
|
|
374
|
+
|
|
375
|
+
- Uses closed `1m`/`5m` candles for regime context and live `l2Book` plus `trades` websocket feeds for entry confirmation.
|
|
376
|
+
- Indicators classify context only; executed trade flow, weighted book imbalance, and microprice authorize entries.
|
|
377
|
+
- Entries still route through the shared modify-order post-only entry path.
|
|
378
|
+
- Hidden-order mode still applies: `--hide-orders` keeps TP/SL targets local instead of placing exchange-visible brackets.
|
|
379
|
+
|
|
380
|
+
Important order-flow options:
|
|
381
|
+
|
|
382
|
+
- `--of-max-active-books`: maximum promoted markets with live book/trade monitoring
|
|
383
|
+
- `--of-max-spread-bps` and `--of-max-spread-ratio`: live spread gates
|
|
384
|
+
- `--of-min-depth-ratio`: executable depth gate versus intended order notional
|
|
385
|
+
- `--of-warmup-seconds`: warm-up period after promotion before entries are allowed
|
|
386
|
+
- `--of-min-edge-cost-multiple`: expected-move versus estimated round-trip-cost gate
|
|
387
|
+
- `--of-pullback-min` and `--of-pullback-max`: retracement zone bounds
|
|
388
|
+
- `--of-book-imbalance-min`, `--of-micro-bias-min`, `--of-trade-imbalance-2s-min`, and `--of-trade-imbalance-10s-min`: mandatory confirmation thresholds
|
|
389
|
+
- `--of-entry-timeout-seconds` and `--of-max-chase-ticks`: entry aggressiveness controls layered onto the shared entry helper
|
|
390
|
+
|
|
391
|
+
Example order-flow scan:
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
python3 hypertrader.py auto \
|
|
395
|
+
--strategy orderflow_pullback \
|
|
396
|
+
--top-markets 30 \
|
|
397
|
+
--size-pct 5 \
|
|
398
|
+
--scan-interval 1 \
|
|
399
|
+
--of-max-active-books 8 \
|
|
400
|
+
--of-max-spread-bps 3 \
|
|
401
|
+
--of-min-depth-ratio 10 \
|
|
402
|
+
--of-entry-timeout-seconds 2 \
|
|
403
|
+
--of-max-chase-ticks 2
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
Example top-market reversal scan:
|
|
407
|
+
|
|
408
|
+
```bash
|
|
409
|
+
python3 hypertrader.py auto --strategy reversal \
|
|
410
|
+
--top-markets 30 \
|
|
411
|
+
--size-pct 5 \
|
|
412
|
+
--trend-interval 1h \
|
|
413
|
+
--entry-interval 15m \
|
|
414
|
+
--scan-interval 30 \
|
|
415
|
+
--loop-after-trade \
|
|
416
|
+
--max-coin-trades-per-session 3
|
|
417
|
+
```
|
|
418
|
+
|
|
295
419
|
Additional `auto` parameter notes:
|
|
296
420
|
|
|
297
421
|
- `--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.8
|
|
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,15 @@ 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
|
+
- `orderflow_pullback`: order-flow-confirmed trend pullback scalp strategy, also available as `of_pullback` and `orderflow`
|
|
285
|
+
- `reversal`: a closed-candle trend-exhaustion, structure-break, and retest strategy
|
|
286
|
+
|
|
287
|
+
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.
|
|
288
|
+
|
|
289
|
+
The default strategy scans one coin or the top perp markets using TA-Lib signals from:
|
|
251
290
|
|
|
252
291
|
- MACD
|
|
253
292
|
- Parabolic SAR
|
|
@@ -262,6 +301,8 @@ python3 hypertrader.py auto [COIN] (--size SIZE | --size-pct SIZE_PCT) [options]
|
|
|
262
301
|
|
|
263
302
|
Key options:
|
|
264
303
|
|
|
304
|
+
- `--strategy {default,reversal}`
|
|
305
|
+
- `--strategy {default,orderflow_pullback,reversal}` with aliases `of_pullback` and `orderflow`
|
|
265
306
|
- `--size` or `--size-pct`
|
|
266
307
|
- `--top-markets`
|
|
267
308
|
- `--intervals`
|
|
@@ -288,7 +329,6 @@ Key options:
|
|
|
288
329
|
- `--take-profit-levels`
|
|
289
330
|
- `--trailing-tp`
|
|
290
331
|
- `--trailing-tp-trigger-level`
|
|
291
|
-
- `--trailing-tp-remaining-levels`
|
|
292
332
|
- `--trailing-tp-profit-pct`
|
|
293
333
|
- `--entry-retries`
|
|
294
334
|
- `--entry-repost-interval`
|
|
@@ -316,13 +356,97 @@ Key options:
|
|
|
316
356
|
- `--session-max-loss`
|
|
317
357
|
- `--session-giveback-pct`
|
|
318
358
|
- `--risk-session-log`
|
|
319
|
-
- `--ws-candles`
|
|
359
|
+
- `--disable-ws-candles`
|
|
320
360
|
- `--hide-orders` or `-ho`
|
|
321
361
|
- `--testnet`
|
|
322
362
|
- `--no-websocket`
|
|
323
363
|
|
|
324
364
|
`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
365
|
|
|
366
|
+
Reversal strategy notes:
|
|
367
|
+
|
|
368
|
+
- All confirmations use closed candles only.
|
|
369
|
+
- SAR alone never opens a trade.
|
|
370
|
+
- A trade requires: prior trend, exhaustion, confirmed Williams-fractal structure break, then a confirmed retest.
|
|
371
|
+
- Default reversal intervals are `--trend-interval 1h` and `--entry-interval 15m`.
|
|
372
|
+
- Reversal entries build explicit entry, stop, and multi-target plans before handing execution to the shared auto engine.
|
|
373
|
+
- Hidden-order mode still applies: `--hide-orders` keeps reversal TP/SL targets local until trigger conditions are met.
|
|
374
|
+
|
|
375
|
+
Important reversal-specific options:
|
|
376
|
+
|
|
377
|
+
- `--trend-interval`: higher timeframe used for prior-trend classification
|
|
378
|
+
- `--entry-interval`: lower timeframe used for structure-break and retest confirmation
|
|
379
|
+
- `--reversal-min-adx`: minimum higher-timeframe ADX required before a reversal setup is considered
|
|
380
|
+
- `--reversal-exhaustion-score`: minimum exhaustion confirmations required before structure-break tracking starts
|
|
381
|
+
- `--reversal-retest-timeout`: number of entry candles allowed for the retest to confirm before the setup expires
|
|
382
|
+
- `--reversal-stop-atr-buffer`: ATR buffer added beyond the invalidation point when computing the stop
|
|
383
|
+
- `--reversal-max-stop-atr`: caps the stop width in ATR terms
|
|
384
|
+
- `--reversal-min-rr`: minimum reward-to-risk ratio required for a valid execution plan
|
|
385
|
+
- `--reversal-tp1-r`, `--reversal-tp2-r`, `--reversal-tp3-r`: target distances in multiples of initial risk
|
|
386
|
+
- `--reversal-tp1-pct`, `--reversal-tp2-pct`, `--reversal-runner-pct`: allocation percentages for the three reversal exits; they must sum to `100`
|
|
387
|
+
- `--reversal-exit-on-sar-flip` / `--no-reversal-exit-on-sar-flip`: enable or disable SAR-flip managed exits after entry
|
|
388
|
+
- `--reversal-min-ema50-slope`: minimum absolute higher-timeframe EMA slope required to qualify the prior trend
|
|
389
|
+
|
|
390
|
+
Example single-coin reversal scan:
|
|
391
|
+
|
|
392
|
+
```bash
|
|
393
|
+
python3 hypertrader.py auto --strategy reversal \
|
|
394
|
+
BTC \
|
|
395
|
+
--size-pct 5 \
|
|
396
|
+
--trend-interval 1h \
|
|
397
|
+
--entry-interval 15m \
|
|
398
|
+
--reversal-min-adx 18 \
|
|
399
|
+
--reversal-exhaustion-score 2 \
|
|
400
|
+
--reversal-min-rr 1.8 \
|
|
401
|
+
--reversal-exit-on-sar-flip
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
Order-flow pullback strategy notes:
|
|
405
|
+
|
|
406
|
+
- Uses closed `1m`/`5m` candles for regime context and live `l2Book` plus `trades` websocket feeds for entry confirmation.
|
|
407
|
+
- Indicators classify context only; executed trade flow, weighted book imbalance, and microprice authorize entries.
|
|
408
|
+
- Entries still route through the shared modify-order post-only entry path.
|
|
409
|
+
- Hidden-order mode still applies: `--hide-orders` keeps TP/SL targets local instead of placing exchange-visible brackets.
|
|
410
|
+
|
|
411
|
+
Important order-flow options:
|
|
412
|
+
|
|
413
|
+
- `--of-max-active-books`: maximum promoted markets with live book/trade monitoring
|
|
414
|
+
- `--of-max-spread-bps` and `--of-max-spread-ratio`: live spread gates
|
|
415
|
+
- `--of-min-depth-ratio`: executable depth gate versus intended order notional
|
|
416
|
+
- `--of-warmup-seconds`: warm-up period after promotion before entries are allowed
|
|
417
|
+
- `--of-min-edge-cost-multiple`: expected-move versus estimated round-trip-cost gate
|
|
418
|
+
- `--of-pullback-min` and `--of-pullback-max`: retracement zone bounds
|
|
419
|
+
- `--of-book-imbalance-min`, `--of-micro-bias-min`, `--of-trade-imbalance-2s-min`, and `--of-trade-imbalance-10s-min`: mandatory confirmation thresholds
|
|
420
|
+
- `--of-entry-timeout-seconds` and `--of-max-chase-ticks`: entry aggressiveness controls layered onto the shared entry helper
|
|
421
|
+
|
|
422
|
+
Example order-flow scan:
|
|
423
|
+
|
|
424
|
+
```bash
|
|
425
|
+
python3 hypertrader.py auto \
|
|
426
|
+
--strategy orderflow_pullback \
|
|
427
|
+
--top-markets 30 \
|
|
428
|
+
--size-pct 5 \
|
|
429
|
+
--scan-interval 1 \
|
|
430
|
+
--of-max-active-books 8 \
|
|
431
|
+
--of-max-spread-bps 3 \
|
|
432
|
+
--of-min-depth-ratio 10 \
|
|
433
|
+
--of-entry-timeout-seconds 2 \
|
|
434
|
+
--of-max-chase-ticks 2
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
Example top-market reversal scan:
|
|
438
|
+
|
|
439
|
+
```bash
|
|
440
|
+
python3 hypertrader.py auto --strategy reversal \
|
|
441
|
+
--top-markets 30 \
|
|
442
|
+
--size-pct 5 \
|
|
443
|
+
--trend-interval 1h \
|
|
444
|
+
--entry-interval 15m \
|
|
445
|
+
--scan-interval 30 \
|
|
446
|
+
--loop-after-trade \
|
|
447
|
+
--max-coin-trades-per-session 3
|
|
448
|
+
```
|
|
449
|
+
|
|
326
450
|
Additional `auto` parameter notes:
|
|
327
451
|
|
|
328
452
|
- `--max-concurrent-scans`: limits how many markets are scanned in parallel in each auto loop.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
hypertrader.py
|
|
3
|
+
setup.py
|
|
4
|
+
hypertrader.egg-info/PKG-INFO
|
|
5
|
+
hypertrader.egg-info/SOURCES.txt
|
|
6
|
+
hypertrader.egg-info/dependency_links.txt
|
|
7
|
+
hypertrader.egg-info/entry_points.txt
|
|
8
|
+
hypertrader.egg-info/requires.txt
|
|
9
|
+
hypertrader.egg-info/top_level.txt
|
|
10
|
+
modes/auto_trader.py
|
|
11
|
+
modes/market_maker.py
|
|
12
|
+
modes/position_management.py
|
|
13
|
+
modes/position_watcher.py
|
|
14
|
+
modes/trailing_stop.py
|
|
15
|
+
strategies/__init__.py
|
|
16
|
+
strategies/base.py
|
|
17
|
+
strategies/default.py
|
|
18
|
+
strategies/orderflow_metrics.py
|
|
19
|
+
strategies/orderflow_models.py
|
|
20
|
+
strategies/orderflow_pullback.py
|
|
21
|
+
strategies/registry.py
|
|
22
|
+
strategies/reversal.py
|
|
23
|
+
tests/test_async_hyperliquid.py
|
|
24
|
+
tests/test_auto_strategy_registry.py
|
|
25
|
+
tests/test_auto_trader_logging.py
|
|
26
|
+
tests/test_market_ids.py
|
|
27
|
+
tests/test_orderflow_metrics.py
|
|
28
|
+
tests/test_orderflow_pullback_lifecycle.py
|
|
29
|
+
tests/test_reversal_strategy.py
|
|
30
|
+
tests/test_trailing_stop.py
|
|
31
|
+
utils/constants.py
|
|
32
|
+
utils/helpers.py
|
|
33
|
+
utils/style.py
|
|
34
|
+
utils/timer.py
|
|
35
|
+
utils/worker.py
|