hypertrader 0.1.7__tar.gz → 0.1.9__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.
Files changed (44) hide show
  1. {hypertrader-0.1.7 → hypertrader-0.1.9}/PKG-INFO +88 -6
  2. {hypertrader-0.1.7 → hypertrader-0.1.9}/README.md +87 -5
  3. {hypertrader-0.1.7 → hypertrader-0.1.9}/hypertrader.egg-info/PKG-INFO +88 -6
  4. {hypertrader-0.1.7 → hypertrader-0.1.9}/hypertrader.egg-info/SOURCES.txt +13 -0
  5. {hypertrader-0.1.7 → hypertrader-0.1.9}/hypertrader.py +224 -22
  6. {hypertrader-0.1.7 → hypertrader-0.1.9}/modes/auto_trader.py +583 -168
  7. {hypertrader-0.1.7 → hypertrader-0.1.9}/modes/market_maker.py +6 -3
  8. {hypertrader-0.1.7 → hypertrader-0.1.9}/modes/position_management.py +43 -7
  9. {hypertrader-0.1.7 → hypertrader-0.1.9}/modes/position_watcher.py +7 -7
  10. hypertrader-0.1.9/modes/trailing_stop.py +776 -0
  11. {hypertrader-0.1.7 → hypertrader-0.1.9}/setup.py +1 -1
  12. {hypertrader-0.1.7 → hypertrader-0.1.9}/strategies/__init__.py +2 -1
  13. {hypertrader-0.1.7 → hypertrader-0.1.9}/strategies/base.py +6 -0
  14. {hypertrader-0.1.7 → hypertrader-0.1.9}/strategies/default.py +16 -16
  15. hypertrader-0.1.9/strategies/fib_reversal.py +444 -0
  16. hypertrader-0.1.9/strategies/orderflow_metrics.py +350 -0
  17. hypertrader-0.1.9/strategies/orderflow_models.py +160 -0
  18. hypertrader-0.1.9/strategies/orderflow_pullback.py +808 -0
  19. {hypertrader-0.1.7 → hypertrader-0.1.9}/strategies/registry.py +12 -0
  20. {hypertrader-0.1.7 → hypertrader-0.1.9}/strategies/reversal.py +91 -2
  21. hypertrader-0.1.9/tests/test_auto_dry_run.py +83 -0
  22. hypertrader-0.1.9/tests/test_auto_strategy_registry.py +271 -0
  23. hypertrader-0.1.9/tests/test_auto_trader_logging.py +130 -0
  24. hypertrader-0.1.9/tests/test_fib_reversal_strategy.py +319 -0
  25. hypertrader-0.1.9/tests/test_market_ids.py +72 -0
  26. hypertrader-0.1.9/tests/test_orderflow_metrics.py +180 -0
  27. hypertrader-0.1.9/tests/test_orderflow_pullback_lifecycle.py +325 -0
  28. {hypertrader-0.1.7 → hypertrader-0.1.9}/tests/test_reversal_strategy.py +125 -0
  29. hypertrader-0.1.9/tests/test_simulated_logging.py +170 -0
  30. hypertrader-0.1.9/tests/test_trailing_stop.py +415 -0
  31. {hypertrader-0.1.7 → hypertrader-0.1.9}/utils/constants.py +1 -0
  32. {hypertrader-0.1.7 → hypertrader-0.1.9}/utils/helpers.py +100 -21
  33. hypertrader-0.1.9/utils/simulated_logging.py +26 -0
  34. hypertrader-0.1.7/modes/trailing_stop.py +0 -277
  35. hypertrader-0.1.7/tests/test_auto_strategy_registry.py +0 -99
  36. {hypertrader-0.1.7 → hypertrader-0.1.9}/hypertrader.egg-info/dependency_links.txt +0 -0
  37. {hypertrader-0.1.7 → hypertrader-0.1.9}/hypertrader.egg-info/entry_points.txt +0 -0
  38. {hypertrader-0.1.7 → hypertrader-0.1.9}/hypertrader.egg-info/requires.txt +0 -0
  39. {hypertrader-0.1.7 → hypertrader-0.1.9}/hypertrader.egg-info/top_level.txt +0 -0
  40. {hypertrader-0.1.7 → hypertrader-0.1.9}/setup.cfg +0 -0
  41. {hypertrader-0.1.7 → hypertrader-0.1.9}/tests/test_async_hyperliquid.py +0 -0
  42. {hypertrader-0.1.7 → hypertrader-0.1.9}/utils/style.py +0 -0
  43. {hypertrader-0.1.7 → hypertrader-0.1.9}/utils/timer.py +0 -0
  44. {hypertrader-0.1.7 → hypertrader-0.1.9}/utils/worker.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hypertrader
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary: Async Hyperliquid trading helper built on the async SDK.
5
5
  Author: darkerego
6
6
  License: MIT
@@ -66,10 +66,10 @@ The canonical bot file in this repo is [`hypertrader.py`](/media/anon/developmen
66
66
  - Network access to Hyperliquid APIs
67
67
  - Account created with referral code [DARKEREGO](https://app.hyperliquid.xyz/join/DARKEREGO) (see account creation [*])
68
68
 
69
- Install from pip:
69
+ Install from pip: https://pypi.org/project/hypertrader
70
70
 
71
71
  <pre>
72
- pip install hypertrader[auto]
72
+ pip install hypertrader[auto] --upgrade
73
73
  </pre>
74
74
 
75
75
  Base dependencies:
@@ -281,6 +281,8 @@ Key options:
281
281
  `auto` now supports selectable strategies:
282
282
 
283
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
+ - `fib_reversal`: Fibonacci pullbacks in the original impulse direction; aliases `fib` and `fibonacci`
284
286
  - `reversal`: a closed-candle trend-exhaustion, structure-break, and retest strategy
285
287
 
286
288
  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.
@@ -300,7 +302,7 @@ python3 hypertrader.py auto [COIN] (--size SIZE | --size-pct SIZE_PCT) [options]
300
302
 
301
303
  Key options:
302
304
 
303
- - `--strategy {default,reversal}`
305
+ - `--strategy {default,fib_reversal,orderflow_pullback,reversal}` with aliases `fib`, `fibonacci`, `of_pullback`, and `orderflow`
304
306
  - `--size` or `--size-pct`
305
307
  - `--top-markets`
306
308
  - `--intervals`
@@ -339,7 +341,7 @@ Key options:
339
341
  - `--no-market-fallback`
340
342
  - `--market-slippage`
341
343
  - `--keep-existing-tpsl`
342
- - `--dry-run`
344
+ - `--dry-run`: assume 10,000 cUSDC for account balance and percentage sizing; simulate positions without placing exchange orders. Percentage sizing uses public market prices and maximum leverage from market metadata, without querying account collateral or configured leverage.
343
345
  - `--max-trades`
344
346
  - `--cooldown-after-trade`
345
347
  - `--loop-after-trade`
@@ -361,6 +363,51 @@ Key options:
361
363
 
362
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`.
363
365
 
366
+ Fibonacci pullback strategy:
367
+
368
+ ```bash
369
+ python3 hypertrader.py auto BTC --size-pct 10 --strategy fib_reversal
370
+ ```
371
+
372
+ `fib_reversal` detects an ATR-qualified impulse on the trend timeframe,
373
+ waits for a 38.2%/50%/61.8% Fibonacci retracement, then scores MACD
374
+ reversal, DMI/ADX trend strength, optional ROC, price rejection, and
375
+ higher-timeframe EMA alignment. It trades a pullback reversal in the original
376
+ impulse direction. Anchors use confirmed symmetric pivots (default width 2),
377
+ with at least 5 bars and a 2 ATR move inside the last 120 trend candles.
378
+
379
+ ```bash
380
+ python3 hypertrader.py auto \
381
+ --size-pct 10 \
382
+ --top-markets 20 \
383
+ --strategy fib_reversal \
384
+ --trend-interval 1h \
385
+ --entry-interval 15m \
386
+ --fib-entry-levels "0.382,0.5,0.618" \
387
+ --fib-min-impulse-atr 2.0 \
388
+ --fib-min-score 5 \
389
+ --fib-min-rr 1.5
390
+ ```
391
+
392
+ - Zone contact is required. Rejection, MACD histogram rotation/crossover, DMI,
393
+ rising ADX, ROC, and HTF EMA alignment contribute a weighted score (default
394
+ threshold 5/10). `--no-fib-roc` removes ROC and lowers the maximum to 9.
395
+ - `--fib-zone-atr 0.15` sets zone tolerance. Confirmation expires after
396
+ `--fib-confirm-timeout 4` entry intervals and cannot trigger farther than
397
+ `--fib-max-entry-distance-atr 0.50` from the touched level.
398
+ - Stops use the 0.786 retracement plus `--fib-stop-atr-buffer 0.25` ATR.
399
+ Closes beyond 0.786 plus `--fib-invalidation-atr 0.10` invalidate structure.
400
+ Explicitly including 0.786 moves invalidation to the impulse start; a 0.786
401
+ entry also places its stop beyond that start.
402
+ - TP1 is the impulse extreme; TP2/TP3 are 1.272/1.618 extensions with
403
+ 40%/35%/25% allocations. `--fib-min-rr 1.5` gates RR to **TP2**.
404
+ - Each impulse can emit once per session. Entry references use completed candle
405
+ closes by default; actual fills remain owned by smart entry. Trend pivots
406
+ always require closed right-side candles. Timeouts use elapsed entry intervals.
407
+ - Indicator defaults: ATR 14, MACD 12/26/9, ADX/DMI 14 with strength thresholds
408
+ 18/25, ROC 9, trend EMAs 20/50. See `auto --help` for all `--fib-*` options.
409
+ TA-Lib period parameters requiring at least 2 are validated before launch.
410
+
364
411
  Reversal strategy notes:
365
412
 
366
413
  - All confirmations use closed candles only.
@@ -399,6 +446,39 @@ python3 hypertrader.py auto --strategy reversal \
399
446
  --reversal-exit-on-sar-flip
400
447
  ```
401
448
 
449
+ Order-flow pullback strategy notes:
450
+
451
+ - Uses closed `1m`/`5m` candles for regime context and live `l2Book` plus `trades` websocket feeds for entry confirmation.
452
+ - Indicators classify context only; executed trade flow, weighted book imbalance, and microprice authorize entries.
453
+ - Entries still route through the shared modify-order post-only entry path.
454
+ - Hidden-order mode still applies: `--hide-orders` keeps TP/SL targets local instead of placing exchange-visible brackets.
455
+
456
+ Important order-flow options:
457
+
458
+ - `--of-max-active-books`: maximum promoted markets with live book/trade monitoring
459
+ - `--of-max-spread-bps` and `--of-max-spread-ratio`: live spread gates
460
+ - `--of-min-depth-ratio`: executable depth gate versus intended order notional
461
+ - `--of-warmup-seconds`: warm-up period after promotion before entries are allowed
462
+ - `--of-min-edge-cost-multiple`: expected-move versus estimated round-trip-cost gate
463
+ - `--of-pullback-min` and `--of-pullback-max`: retracement zone bounds
464
+ - `--of-book-imbalance-min`, `--of-micro-bias-min`, `--of-trade-imbalance-2s-min`, and `--of-trade-imbalance-10s-min`: mandatory confirmation thresholds
465
+ - `--of-entry-timeout-seconds` and `--of-max-chase-ticks`: entry aggressiveness controls layered onto the shared entry helper
466
+
467
+ Example order-flow scan:
468
+
469
+ ```bash
470
+ python3 hypertrader.py auto \
471
+ --strategy orderflow_pullback \
472
+ --top-markets 30 \
473
+ --size-pct 5 \
474
+ --scan-interval 1 \
475
+ --of-max-active-books 8 \
476
+ --of-max-spread-bps 3 \
477
+ --of-min-depth-ratio 10 \
478
+ --of-entry-timeout-seconds 2 \
479
+ --of-max-chase-ticks 2
480
+ ```
481
+
402
482
  Example top-market reversal scan:
403
483
 
404
484
  ```bash
@@ -486,7 +566,9 @@ The websocket cache is used as the fast path for market data such as mids, best
486
566
 
487
567
  ## Logging
488
568
 
489
- Runtime logs are written to [`logs/hypertrader.log`](/media/anon/development/anon/PycharmProjects/hypertrader/logs/hypertrader.log).
569
+ Dry-run console output, runtime messages, risk events, and simulated trades are written to `logs/simulated.log`. Simulation fills at observed market mid prices. Plans with explicit take-profit allocations, including `fib_reversal`, close the allocated portion of the original size at each reached target (40% at TP1, 35% at TP2, and 25% at TP3 for Fibonacci). Each fill logs a `simulated_take_profit_filled` event with its size and PnL. Position records track remaining size, cumulative realized PnL, and unrealized PnL on the remaining position; a stop closes only that remainder. Completed-trade PnL includes all partial exits. Plans without explicit allocations exit the full position at the stop or final target. Fees, funding, slippage, and dynamic stop adjustments are not modeled. Open positions at shutdown are logged with realized partial profits and their remaining unrealized PnL.
570
+
571
+ Runtime logs for live runs are written to [`logs/hypertrader.log`](/media/anon/development/anon/PycharmProjects/hypertrader/logs/hypertrader.log).
490
572
  Completed auto-trades are appended to [`logs/auto_trades.log`](/media/anon/development/anon/PycharmProjects/hypertrader/logs/auto_trades.log).
491
573
 
492
574
  ## Validation
@@ -35,10 +35,10 @@ The canonical bot file in this repo is [`hypertrader.py`](/media/anon/developmen
35
35
  - Network access to Hyperliquid APIs
36
36
  - Account created with referral code [DARKEREGO](https://app.hyperliquid.xyz/join/DARKEREGO) (see account creation [*])
37
37
 
38
- Install from pip:
38
+ Install from pip: https://pypi.org/project/hypertrader
39
39
 
40
40
  <pre>
41
- pip install hypertrader[auto]
41
+ pip install hypertrader[auto] --upgrade
42
42
  </pre>
43
43
 
44
44
  Base dependencies:
@@ -250,6 +250,8 @@ Key options:
250
250
  `auto` now supports selectable strategies:
251
251
 
252
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
+ - `fib_reversal`: Fibonacci pullbacks in the original impulse direction; aliases `fib` and `fibonacci`
253
255
  - `reversal`: a closed-candle trend-exhaustion, structure-break, and retest strategy
254
256
 
255
257
  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.
@@ -269,7 +271,7 @@ python3 hypertrader.py auto [COIN] (--size SIZE | --size-pct SIZE_PCT) [options]
269
271
 
270
272
  Key options:
271
273
 
272
- - `--strategy {default,reversal}`
274
+ - `--strategy {default,fib_reversal,orderflow_pullback,reversal}` with aliases `fib`, `fibonacci`, `of_pullback`, and `orderflow`
273
275
  - `--size` or `--size-pct`
274
276
  - `--top-markets`
275
277
  - `--intervals`
@@ -308,7 +310,7 @@ Key options:
308
310
  - `--no-market-fallback`
309
311
  - `--market-slippage`
310
312
  - `--keep-existing-tpsl`
311
- - `--dry-run`
313
+ - `--dry-run`: assume 10,000 cUSDC for account balance and percentage sizing; simulate positions without placing exchange orders. Percentage sizing uses public market prices and maximum leverage from market metadata, without querying account collateral or configured leverage.
312
314
  - `--max-trades`
313
315
  - `--cooldown-after-trade`
314
316
  - `--loop-after-trade`
@@ -330,6 +332,51 @@ Key options:
330
332
 
331
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`.
332
334
 
335
+ Fibonacci pullback strategy:
336
+
337
+ ```bash
338
+ python3 hypertrader.py auto BTC --size-pct 10 --strategy fib_reversal
339
+ ```
340
+
341
+ `fib_reversal` detects an ATR-qualified impulse on the trend timeframe,
342
+ waits for a 38.2%/50%/61.8% Fibonacci retracement, then scores MACD
343
+ reversal, DMI/ADX trend strength, optional ROC, price rejection, and
344
+ higher-timeframe EMA alignment. It trades a pullback reversal in the original
345
+ impulse direction. Anchors use confirmed symmetric pivots (default width 2),
346
+ with at least 5 bars and a 2 ATR move inside the last 120 trend candles.
347
+
348
+ ```bash
349
+ python3 hypertrader.py auto \
350
+ --size-pct 10 \
351
+ --top-markets 20 \
352
+ --strategy fib_reversal \
353
+ --trend-interval 1h \
354
+ --entry-interval 15m \
355
+ --fib-entry-levels "0.382,0.5,0.618" \
356
+ --fib-min-impulse-atr 2.0 \
357
+ --fib-min-score 5 \
358
+ --fib-min-rr 1.5
359
+ ```
360
+
361
+ - Zone contact is required. Rejection, MACD histogram rotation/crossover, DMI,
362
+ rising ADX, ROC, and HTF EMA alignment contribute a weighted score (default
363
+ threshold 5/10). `--no-fib-roc` removes ROC and lowers the maximum to 9.
364
+ - `--fib-zone-atr 0.15` sets zone tolerance. Confirmation expires after
365
+ `--fib-confirm-timeout 4` entry intervals and cannot trigger farther than
366
+ `--fib-max-entry-distance-atr 0.50` from the touched level.
367
+ - Stops use the 0.786 retracement plus `--fib-stop-atr-buffer 0.25` ATR.
368
+ Closes beyond 0.786 plus `--fib-invalidation-atr 0.10` invalidate structure.
369
+ Explicitly including 0.786 moves invalidation to the impulse start; a 0.786
370
+ entry also places its stop beyond that start.
371
+ - TP1 is the impulse extreme; TP2/TP3 are 1.272/1.618 extensions with
372
+ 40%/35%/25% allocations. `--fib-min-rr 1.5` gates RR to **TP2**.
373
+ - Each impulse can emit once per session. Entry references use completed candle
374
+ closes by default; actual fills remain owned by smart entry. Trend pivots
375
+ always require closed right-side candles. Timeouts use elapsed entry intervals.
376
+ - Indicator defaults: ATR 14, MACD 12/26/9, ADX/DMI 14 with strength thresholds
377
+ 18/25, ROC 9, trend EMAs 20/50. See `auto --help` for all `--fib-*` options.
378
+ TA-Lib period parameters requiring at least 2 are validated before launch.
379
+
333
380
  Reversal strategy notes:
334
381
 
335
382
  - All confirmations use closed candles only.
@@ -368,6 +415,39 @@ python3 hypertrader.py auto --strategy reversal \
368
415
  --reversal-exit-on-sar-flip
369
416
  ```
370
417
 
418
+ Order-flow pullback strategy notes:
419
+
420
+ - Uses closed `1m`/`5m` candles for regime context and live `l2Book` plus `trades` websocket feeds for entry confirmation.
421
+ - Indicators classify context only; executed trade flow, weighted book imbalance, and microprice authorize entries.
422
+ - Entries still route through the shared modify-order post-only entry path.
423
+ - Hidden-order mode still applies: `--hide-orders` keeps TP/SL targets local instead of placing exchange-visible brackets.
424
+
425
+ Important order-flow options:
426
+
427
+ - `--of-max-active-books`: maximum promoted markets with live book/trade monitoring
428
+ - `--of-max-spread-bps` and `--of-max-spread-ratio`: live spread gates
429
+ - `--of-min-depth-ratio`: executable depth gate versus intended order notional
430
+ - `--of-warmup-seconds`: warm-up period after promotion before entries are allowed
431
+ - `--of-min-edge-cost-multiple`: expected-move versus estimated round-trip-cost gate
432
+ - `--of-pullback-min` and `--of-pullback-max`: retracement zone bounds
433
+ - `--of-book-imbalance-min`, `--of-micro-bias-min`, `--of-trade-imbalance-2s-min`, and `--of-trade-imbalance-10s-min`: mandatory confirmation thresholds
434
+ - `--of-entry-timeout-seconds` and `--of-max-chase-ticks`: entry aggressiveness controls layered onto the shared entry helper
435
+
436
+ Example order-flow scan:
437
+
438
+ ```bash
439
+ python3 hypertrader.py auto \
440
+ --strategy orderflow_pullback \
441
+ --top-markets 30 \
442
+ --size-pct 5 \
443
+ --scan-interval 1 \
444
+ --of-max-active-books 8 \
445
+ --of-max-spread-bps 3 \
446
+ --of-min-depth-ratio 10 \
447
+ --of-entry-timeout-seconds 2 \
448
+ --of-max-chase-ticks 2
449
+ ```
450
+
371
451
  Example top-market reversal scan:
372
452
 
373
453
  ```bash
@@ -455,7 +535,9 @@ The websocket cache is used as the fast path for market data such as mids, best
455
535
 
456
536
  ## Logging
457
537
 
458
- Runtime logs are written to [`logs/hypertrader.log`](/media/anon/development/anon/PycharmProjects/hypertrader/logs/hypertrader.log).
538
+ Dry-run console output, runtime messages, risk events, and simulated trades are written to `logs/simulated.log`. Simulation fills at observed market mid prices. Plans with explicit take-profit allocations, including `fib_reversal`, close the allocated portion of the original size at each reached target (40% at TP1, 35% at TP2, and 25% at TP3 for Fibonacci). Each fill logs a `simulated_take_profit_filled` event with its size and PnL. Position records track remaining size, cumulative realized PnL, and unrealized PnL on the remaining position; a stop closes only that remainder. Completed-trade PnL includes all partial exits. Plans without explicit allocations exit the full position at the stop or final target. Fees, funding, slippage, and dynamic stop adjustments are not modeled. Open positions at shutdown are logged with realized partial profits and their remaining unrealized PnL.
539
+
540
+ Runtime logs for live runs are written to [`logs/hypertrader.log`](/media/anon/development/anon/PycharmProjects/hypertrader/logs/hypertrader.log).
459
541
  Completed auto-trades are appended to [`logs/auto_trades.log`](/media/anon/development/anon/PycharmProjects/hypertrader/logs/auto_trades.log).
460
542
 
461
543
  ## Validation
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hypertrader
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary: Async Hyperliquid trading helper built on the async SDK.
5
5
  Author: darkerego
6
6
  License: MIT
@@ -66,10 +66,10 @@ The canonical bot file in this repo is [`hypertrader.py`](/media/anon/developmen
66
66
  - Network access to Hyperliquid APIs
67
67
  - Account created with referral code [DARKEREGO](https://app.hyperliquid.xyz/join/DARKEREGO) (see account creation [*])
68
68
 
69
- Install from pip:
69
+ Install from pip: https://pypi.org/project/hypertrader
70
70
 
71
71
  <pre>
72
- pip install hypertrader[auto]
72
+ pip install hypertrader[auto] --upgrade
73
73
  </pre>
74
74
 
75
75
  Base dependencies:
@@ -281,6 +281,8 @@ Key options:
281
281
  `auto` now supports selectable strategies:
282
282
 
283
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
+ - `fib_reversal`: Fibonacci pullbacks in the original impulse direction; aliases `fib` and `fibonacci`
284
286
  - `reversal`: a closed-candle trend-exhaustion, structure-break, and retest strategy
285
287
 
286
288
  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.
@@ -300,7 +302,7 @@ python3 hypertrader.py auto [COIN] (--size SIZE | --size-pct SIZE_PCT) [options]
300
302
 
301
303
  Key options:
302
304
 
303
- - `--strategy {default,reversal}`
305
+ - `--strategy {default,fib_reversal,orderflow_pullback,reversal}` with aliases `fib`, `fibonacci`, `of_pullback`, and `orderflow`
304
306
  - `--size` or `--size-pct`
305
307
  - `--top-markets`
306
308
  - `--intervals`
@@ -339,7 +341,7 @@ Key options:
339
341
  - `--no-market-fallback`
340
342
  - `--market-slippage`
341
343
  - `--keep-existing-tpsl`
342
- - `--dry-run`
344
+ - `--dry-run`: assume 10,000 cUSDC for account balance and percentage sizing; simulate positions without placing exchange orders. Percentage sizing uses public market prices and maximum leverage from market metadata, without querying account collateral or configured leverage.
343
345
  - `--max-trades`
344
346
  - `--cooldown-after-trade`
345
347
  - `--loop-after-trade`
@@ -361,6 +363,51 @@ Key options:
361
363
 
362
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`.
363
365
 
366
+ Fibonacci pullback strategy:
367
+
368
+ ```bash
369
+ python3 hypertrader.py auto BTC --size-pct 10 --strategy fib_reversal
370
+ ```
371
+
372
+ `fib_reversal` detects an ATR-qualified impulse on the trend timeframe,
373
+ waits for a 38.2%/50%/61.8% Fibonacci retracement, then scores MACD
374
+ reversal, DMI/ADX trend strength, optional ROC, price rejection, and
375
+ higher-timeframe EMA alignment. It trades a pullback reversal in the original
376
+ impulse direction. Anchors use confirmed symmetric pivots (default width 2),
377
+ with at least 5 bars and a 2 ATR move inside the last 120 trend candles.
378
+
379
+ ```bash
380
+ python3 hypertrader.py auto \
381
+ --size-pct 10 \
382
+ --top-markets 20 \
383
+ --strategy fib_reversal \
384
+ --trend-interval 1h \
385
+ --entry-interval 15m \
386
+ --fib-entry-levels "0.382,0.5,0.618" \
387
+ --fib-min-impulse-atr 2.0 \
388
+ --fib-min-score 5 \
389
+ --fib-min-rr 1.5
390
+ ```
391
+
392
+ - Zone contact is required. Rejection, MACD histogram rotation/crossover, DMI,
393
+ rising ADX, ROC, and HTF EMA alignment contribute a weighted score (default
394
+ threshold 5/10). `--no-fib-roc` removes ROC and lowers the maximum to 9.
395
+ - `--fib-zone-atr 0.15` sets zone tolerance. Confirmation expires after
396
+ `--fib-confirm-timeout 4` entry intervals and cannot trigger farther than
397
+ `--fib-max-entry-distance-atr 0.50` from the touched level.
398
+ - Stops use the 0.786 retracement plus `--fib-stop-atr-buffer 0.25` ATR.
399
+ Closes beyond 0.786 plus `--fib-invalidation-atr 0.10` invalidate structure.
400
+ Explicitly including 0.786 moves invalidation to the impulse start; a 0.786
401
+ entry also places its stop beyond that start.
402
+ - TP1 is the impulse extreme; TP2/TP3 are 1.272/1.618 extensions with
403
+ 40%/35%/25% allocations. `--fib-min-rr 1.5` gates RR to **TP2**.
404
+ - Each impulse can emit once per session. Entry references use completed candle
405
+ closes by default; actual fills remain owned by smart entry. Trend pivots
406
+ always require closed right-side candles. Timeouts use elapsed entry intervals.
407
+ - Indicator defaults: ATR 14, MACD 12/26/9, ADX/DMI 14 with strength thresholds
408
+ 18/25, ROC 9, trend EMAs 20/50. See `auto --help` for all `--fib-*` options.
409
+ TA-Lib period parameters requiring at least 2 are validated before launch.
410
+
364
411
  Reversal strategy notes:
365
412
 
366
413
  - All confirmations use closed candles only.
@@ -399,6 +446,39 @@ python3 hypertrader.py auto --strategy reversal \
399
446
  --reversal-exit-on-sar-flip
400
447
  ```
401
448
 
449
+ Order-flow pullback strategy notes:
450
+
451
+ - Uses closed `1m`/`5m` candles for regime context and live `l2Book` plus `trades` websocket feeds for entry confirmation.
452
+ - Indicators classify context only; executed trade flow, weighted book imbalance, and microprice authorize entries.
453
+ - Entries still route through the shared modify-order post-only entry path.
454
+ - Hidden-order mode still applies: `--hide-orders` keeps TP/SL targets local instead of placing exchange-visible brackets.
455
+
456
+ Important order-flow options:
457
+
458
+ - `--of-max-active-books`: maximum promoted markets with live book/trade monitoring
459
+ - `--of-max-spread-bps` and `--of-max-spread-ratio`: live spread gates
460
+ - `--of-min-depth-ratio`: executable depth gate versus intended order notional
461
+ - `--of-warmup-seconds`: warm-up period after promotion before entries are allowed
462
+ - `--of-min-edge-cost-multiple`: expected-move versus estimated round-trip-cost gate
463
+ - `--of-pullback-min` and `--of-pullback-max`: retracement zone bounds
464
+ - `--of-book-imbalance-min`, `--of-micro-bias-min`, `--of-trade-imbalance-2s-min`, and `--of-trade-imbalance-10s-min`: mandatory confirmation thresholds
465
+ - `--of-entry-timeout-seconds` and `--of-max-chase-ticks`: entry aggressiveness controls layered onto the shared entry helper
466
+
467
+ Example order-flow scan:
468
+
469
+ ```bash
470
+ python3 hypertrader.py auto \
471
+ --strategy orderflow_pullback \
472
+ --top-markets 30 \
473
+ --size-pct 5 \
474
+ --scan-interval 1 \
475
+ --of-max-active-books 8 \
476
+ --of-max-spread-bps 3 \
477
+ --of-min-depth-ratio 10 \
478
+ --of-entry-timeout-seconds 2 \
479
+ --of-max-chase-ticks 2
480
+ ```
481
+
402
482
  Example top-market reversal scan:
403
483
 
404
484
  ```bash
@@ -486,7 +566,9 @@ The websocket cache is used as the fast path for market data such as mids, best
486
566
 
487
567
  ## Logging
488
568
 
489
- Runtime logs are written to [`logs/hypertrader.log`](/media/anon/development/anon/PycharmProjects/hypertrader/logs/hypertrader.log).
569
+ Dry-run console output, runtime messages, risk events, and simulated trades are written to `logs/simulated.log`. Simulation fills at observed market mid prices. Plans with explicit take-profit allocations, including `fib_reversal`, close the allocated portion of the original size at each reached target (40% at TP1, 35% at TP2, and 25% at TP3 for Fibonacci). Each fill logs a `simulated_take_profit_filled` event with its size and PnL. Position records track remaining size, cumulative realized PnL, and unrealized PnL on the remaining position; a stop closes only that remainder. Completed-trade PnL includes all partial exits. Plans without explicit allocations exit the full position at the stop or final target. Fees, funding, slippage, and dynamic stop adjustments are not modeled. Open positions at shutdown are logged with realized partial profits and their remaining unrealized PnL.
570
+
571
+ Runtime logs for live runs are written to [`logs/hypertrader.log`](/media/anon/development/anon/PycharmProjects/hypertrader/logs/hypertrader.log).
490
572
  Completed auto-trades are appended to [`logs/auto_trades.log`](/media/anon/development/anon/PycharmProjects/hypertrader/logs/auto_trades.log).
491
573
 
492
574
  ## Validation
@@ -15,13 +15,26 @@ modes/trailing_stop.py
15
15
  strategies/__init__.py
16
16
  strategies/base.py
17
17
  strategies/default.py
18
+ strategies/fib_reversal.py
19
+ strategies/orderflow_metrics.py
20
+ strategies/orderflow_models.py
21
+ strategies/orderflow_pullback.py
18
22
  strategies/registry.py
19
23
  strategies/reversal.py
20
24
  tests/test_async_hyperliquid.py
25
+ tests/test_auto_dry_run.py
21
26
  tests/test_auto_strategy_registry.py
27
+ tests/test_auto_trader_logging.py
28
+ tests/test_fib_reversal_strategy.py
29
+ tests/test_market_ids.py
30
+ tests/test_orderflow_metrics.py
31
+ tests/test_orderflow_pullback_lifecycle.py
22
32
  tests/test_reversal_strategy.py
33
+ tests/test_simulated_logging.py
34
+ tests/test_trailing_stop.py
23
35
  utils/constants.py
24
36
  utils/helpers.py
37
+ utils/simulated_logging.py
25
38
  utils/style.py
26
39
  utils/timer.py
27
40
  utils/worker.py