wayfinder-paths 0.1.19__py3-none-any.whl → 0.1.20__py3-none-any.whl
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.
Potentially problematic release.
This version of wayfinder-paths might be problematic. Click here for more details.
- wayfinder_paths/__init__.py +0 -2
- wayfinder_paths/adapters/balance_adapter/README.md +59 -45
- wayfinder_paths/adapters/balance_adapter/adapter.py +0 -21
- wayfinder_paths/adapters/balance_adapter/test_adapter.py +0 -14
- wayfinder_paths/adapters/brap_adapter/README.md +61 -184
- wayfinder_paths/adapters/brap_adapter/__init__.py +0 -4
- wayfinder_paths/adapters/brap_adapter/adapter.py +0 -147
- wayfinder_paths/adapters/brap_adapter/test_adapter.py +0 -15
- wayfinder_paths/adapters/hyperlend_adapter/__init__.py +0 -4
- wayfinder_paths/adapters/hyperlend_adapter/adapter.py +0 -9
- wayfinder_paths/adapters/hyperlend_adapter/test_adapter.py +0 -17
- wayfinder_paths/adapters/hyperliquid_adapter/adapter.py +3 -312
- wayfinder_paths/adapters/hyperliquid_adapter/executor.py +1 -71
- wayfinder_paths/adapters/hyperliquid_adapter/paired_filler.py +0 -57
- wayfinder_paths/adapters/hyperliquid_adapter/test_adapter.py +0 -17
- wayfinder_paths/adapters/hyperliquid_adapter/test_adapter_live.py +2 -42
- wayfinder_paths/adapters/hyperliquid_adapter/test_executor.py +1 -9
- wayfinder_paths/adapters/hyperliquid_adapter/test_utils.py +15 -47
- wayfinder_paths/adapters/hyperliquid_adapter/utils.py +0 -7
- wayfinder_paths/adapters/ledger_adapter/README.md +54 -74
- wayfinder_paths/adapters/ledger_adapter/__init__.py +0 -4
- wayfinder_paths/adapters/ledger_adapter/adapter.py +0 -106
- wayfinder_paths/adapters/ledger_adapter/test_adapter.py +0 -12
- wayfinder_paths/adapters/moonwell_adapter/README.md +67 -106
- wayfinder_paths/adapters/moonwell_adapter/__init__.py +0 -4
- wayfinder_paths/adapters/moonwell_adapter/adapter.py +9 -121
- wayfinder_paths/adapters/moonwell_adapter/test_adapter.py +84 -83
- wayfinder_paths/adapters/pool_adapter/README.md +30 -51
- wayfinder_paths/adapters/pool_adapter/__init__.py +0 -4
- wayfinder_paths/adapters/pool_adapter/adapter.py +0 -19
- wayfinder_paths/adapters/pool_adapter/test_adapter.py +0 -8
- wayfinder_paths/adapters/token_adapter/README.md +41 -49
- wayfinder_paths/adapters/token_adapter/adapter.py +0 -32
- wayfinder_paths/adapters/token_adapter/test_adapter.py +1 -12
- wayfinder_paths/conftest.py +0 -8
- wayfinder_paths/core/__init__.py +0 -2
- wayfinder_paths/core/adapters/BaseAdapter.py +0 -22
- wayfinder_paths/core/adapters/__init__.py +0 -5
- wayfinder_paths/core/adapters/models.py +0 -5
- wayfinder_paths/core/analytics/__init__.py +0 -2
- wayfinder_paths/core/analytics/bootstrap.py +0 -16
- wayfinder_paths/core/analytics/stats.py +0 -7
- wayfinder_paths/core/analytics/test_analytics.py +5 -34
- wayfinder_paths/core/clients/BRAPClient.py +0 -35
- wayfinder_paths/core/clients/ClientManager.py +0 -51
- wayfinder_paths/core/clients/HyperlendClient.py +0 -77
- wayfinder_paths/core/clients/LedgerClient.py +2 -122
- wayfinder_paths/core/clients/PoolClient.py +0 -2
- wayfinder_paths/core/clients/TokenClient.py +0 -39
- wayfinder_paths/core/clients/WalletClient.py +0 -15
- wayfinder_paths/core/clients/WayfinderClient.py +0 -24
- wayfinder_paths/core/clients/__init__.py +0 -4
- wayfinder_paths/core/clients/protocols.py +25 -98
- wayfinder_paths/core/config.py +0 -24
- wayfinder_paths/core/constants/__init__.py +0 -7
- wayfinder_paths/core/constants/base.py +2 -9
- wayfinder_paths/core/constants/erc20_abi.py +0 -5
- wayfinder_paths/core/constants/hyperlend_abi.py +0 -7
- wayfinder_paths/core/constants/moonwell_abi.py +0 -35
- wayfinder_paths/core/engine/StrategyJob.py +0 -32
- wayfinder_paths/core/strategies/Strategy.py +0 -99
- wayfinder_paths/core/strategies/__init__.py +0 -2
- wayfinder_paths/core/utils/__init__.py +0 -1
- wayfinder_paths/core/utils/erc20_service.py +0 -1
- wayfinder_paths/core/utils/evm_helpers.py +0 -50
- wayfinder_paths/core/utils/transaction.py +0 -1
- wayfinder_paths/run_strategy.py +0 -46
- wayfinder_paths/scripts/create_strategy.py +0 -17
- wayfinder_paths/scripts/make_wallets.py +1 -4
- wayfinder_paths/strategies/basis_trading_strategy/README.md +71 -163
- wayfinder_paths/strategies/basis_trading_strategy/snapshot_mixin.py +0 -24
- wayfinder_paths/strategies/basis_trading_strategy/strategy.py +36 -400
- wayfinder_paths/strategies/basis_trading_strategy/test_strategy.py +15 -64
- wayfinder_paths/strategies/basis_trading_strategy/types.py +0 -4
- wayfinder_paths/strategies/hyperlend_stable_yield_strategy/README.md +65 -56
- wayfinder_paths/strategies/hyperlend_stable_yield_strategy/strategy.py +4 -27
- wayfinder_paths/strategies/hyperlend_stable_yield_strategy/test_strategy.py +0 -10
- wayfinder_paths/strategies/moonwell_wsteth_loop_strategy/README.md +71 -72
- wayfinder_paths/strategies/moonwell_wsteth_loop_strategy/strategy.py +23 -227
- wayfinder_paths/strategies/moonwell_wsteth_loop_strategy/test_strategy.py +120 -113
- wayfinder_paths/strategies/stablecoin_yield_strategy/README.md +64 -59
- wayfinder_paths/strategies/stablecoin_yield_strategy/strategy.py +4 -44
- wayfinder_paths/strategies/stablecoin_yield_strategy/test_strategy.py +2 -35
- wayfinder_paths/templates/adapter/README.md +107 -46
- wayfinder_paths/templates/adapter/adapter.py +0 -9
- wayfinder_paths/templates/adapter/test_adapter.py +0 -19
- wayfinder_paths/templates/strategy/README.md +113 -59
- wayfinder_paths/templates/strategy/strategy.py +0 -22
- wayfinder_paths/templates/strategy/test_strategy.py +0 -28
- wayfinder_paths/tests/test_test_coverage.py +2 -12
- wayfinder_paths/tests/test_utils.py +1 -31
- wayfinder_paths-0.1.20.dist-info/METADATA +355 -0
- wayfinder_paths-0.1.20.dist-info/RECORD +129 -0
- wayfinder_paths/core/adapters/base.py +0 -5
- wayfinder_paths-0.1.19.dist-info/METADATA +0 -592
- wayfinder_paths-0.1.19.dist-info/RECORD +0 -130
- {wayfinder_paths-0.1.19.dist-info → wayfinder_paths-0.1.20.dist-info}/LICENSE +0 -0
- {wayfinder_paths-0.1.19.dist-info → wayfinder_paths-0.1.20.dist-info}/WHEEL +0 -0
|
@@ -1,213 +1,121 @@
|
|
|
1
1
|
# Basis Trading Strategy
|
|
2
2
|
|
|
3
|
-
Delta-neutral basis trading on Hyperliquid
|
|
3
|
+
Delta-neutral basis trading on Hyperliquid for funding rate capture.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- **Module**: `wayfinder_paths.strategies.basis_trading_strategy.strategy.BasisTradingStrategy`
|
|
6
|
+
- **Platform**: Hyperliquid
|
|
7
|
+
- **Token**: USDC
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
## Overview
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
This strategy captures funding rate payments through matched positions:
|
|
10
12
|
- **Long Spot**: Buy the underlying asset (e.g., HYPE)
|
|
11
13
|
- **Short Perp**: Short the perpetual contract for the same asset
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
- The position is "delta-neutral" - profit comes from funding, not price direction
|
|
15
|
+
Price movements cancel out, and profit comes from collecting funding payments when longs pay shorts.
|
|
16
|
+
|
|
17
|
+
## How It Works
|
|
17
18
|
|
|
18
|
-
### Position Sizing
|
|
19
|
+
### Position Sizing
|
|
19
20
|
|
|
20
|
-
Given
|
|
21
|
-
- **Order Size**: `
|
|
21
|
+
Given deposit `D` USDC and leverage `L`:
|
|
22
|
+
- **Order Size**: `D * (L / (L + 1))`
|
|
22
23
|
- **Margin Reserved**: `D / (L + 1)`
|
|
23
24
|
|
|
24
25
|
Example with $100 deposit at 2x leverage:
|
|
25
|
-
- Order size: $
|
|
26
|
-
- Margin: $
|
|
27
|
-
|
|
28
|
-
## Opportunity Selection
|
|
26
|
+
- Order size: $66.67 per leg
|
|
27
|
+
- Margin: $33.33
|
|
29
28
|
|
|
30
|
-
###
|
|
29
|
+
### Opportunity Selection
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
1. **Discovery**: Scan Hyperliquid markets for spot-perp pairs
|
|
32
|
+
2. **Historical Analysis**: Fetch up to 180 days of hourly funding/price data
|
|
33
|
+
3. **Safe Leverage Calculation**: Stress test over rolling windows
|
|
34
|
+
4. **Ranking**: Sort by expected APY = mean_funding * 24 * 365 * safe_leverage
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
## Key Parameters
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
| Parameter | Default | Description |
|
|
39
|
+
|-----------|---------|-------------|
|
|
40
|
+
| `max_leverage` | 3 | Maximum leverage allowed |
|
|
41
|
+
| `lookback_days` | 180 | Days of historical data |
|
|
42
|
+
| `confidence` | 0.975 | VaR confidence level (97.5%) |
|
|
43
|
+
| `fee_eps` | 0.003 | Fee buffer (0.3%) |
|
|
44
|
+
| `bootstrap_sims` | 50 | Monte Carlo simulations |
|
|
45
|
+
| `MIN_DEPOSIT_USDC` | 50 | Minimum deposit |
|
|
43
46
|
|
|
44
|
-
|
|
47
|
+
## Adapters Used
|
|
45
48
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
- Calculate buffer requirement:
|
|
51
|
-
buffer = maintenance_margin * (1 + runup) + runup + cum_neg_funding + fees
|
|
52
|
-
```
|
|
49
|
+
- **BalanceAdapter**: Wallet balances, ERC20 transfers
|
|
50
|
+
- **LedgerAdapter**: Deposit/withdraw tracking
|
|
51
|
+
- **TokenAdapter**: Token metadata
|
|
52
|
+
- **HyperliquidAdapter**: Market data, order execution, account state
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
- If buffer requirement is 50%, max safe leverage = 2x
|
|
56
|
-
- If buffer requirement is 33%, max safe leverage = 3x
|
|
57
|
-
|
|
58
|
-
### 4. Bootstrap Simulation (Optional)
|
|
59
|
-
|
|
60
|
-
For additional statistical confidence, the strategy can run Monte Carlo simulations:
|
|
61
|
-
- Resamples historical funding/price data in blocks (default 24h blocks)
|
|
62
|
-
- Runs N simulations (configurable, e.g., 1000)
|
|
63
|
-
- Calculates VaR at specified confidence level (default 97.5%)
|
|
64
|
-
|
|
65
|
-
Configure via:
|
|
66
|
-
```json
|
|
67
|
-
{
|
|
68
|
-
"strategy_config": {
|
|
69
|
-
"bootstrap_sims": 1000,
|
|
70
|
-
"bootstrap_block_hours": 24
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
```
|
|
54
|
+
## Actions
|
|
74
55
|
|
|
75
|
-
###
|
|
56
|
+
### Analyze
|
|
76
57
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
58
|
+
```bash
|
|
59
|
+
poetry run python wayfinder_paths/run_strategy.py basis_trading_strategy \
|
|
60
|
+
--action analyze --amount 1000 --config config.json
|
|
80
61
|
```
|
|
81
62
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
### Opening a Position
|
|
85
|
-
|
|
86
|
-
1. Transfers USDC from main wallet to strategy wallet
|
|
87
|
-
2. Bridges USDC to Hyperliquid via Arbitrum
|
|
88
|
-
3. Splits between perp margin and spot
|
|
89
|
-
4. Uses `PairedFiller` to atomically execute both legs (buy spot + sell perp)
|
|
90
|
-
5. Places protective orders:
|
|
91
|
-
- **Stop-loss**: Triggers if price approaches liquidation (default 65% of distance)
|
|
92
|
-
- **Limit sell**: Closes spot if funding flips negative
|
|
93
|
-
|
|
94
|
-
### Incremental Scaling
|
|
63
|
+
Analyzes opportunities without opening positions.
|
|
95
64
|
|
|
96
|
-
|
|
97
|
-
- Detects idle capital (undeployed USDC on Hyperliquid)
|
|
98
|
-
- Calculates additional units to add to each leg
|
|
99
|
-
- Uses `PairedFiller` to atomically add to both positions
|
|
100
|
-
- Maintains delta neutrality throughout
|
|
65
|
+
### Deposit
|
|
101
66
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
2. Deploys any idle capital via scale-up
|
|
107
|
-
3. Verifies leg balance (spot amount ≈ perp amount)
|
|
108
|
-
4. Updates stop-loss/limit orders if liquidation price changed
|
|
109
|
-
|
|
110
|
-
### Closing a Position
|
|
67
|
+
```bash
|
|
68
|
+
poetry run python wayfinder_paths/run_strategy.py basis_trading_strategy \
|
|
69
|
+
--action deposit --main-token-amount 100 --config config.json
|
|
70
|
+
```
|
|
111
71
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
72
|
+
- Transfers USDC from main wallet to strategy wallet
|
|
73
|
+
- Bridges USDC to Hyperliquid via Arbitrum
|
|
74
|
+
- Splits between perp margin and spot
|
|
75
|
+
- Uses PairedFiller for atomic execution (buy spot + sell perp)
|
|
76
|
+
- Places protective orders (stop-loss, limit sell)
|
|
116
77
|
|
|
117
|
-
|
|
78
|
+
### Update
|
|
118
79
|
|
|
119
80
|
```bash
|
|
120
|
-
# Analyze opportunities for a $1000 deposit (doesn't open position)
|
|
121
81
|
poetry run python wayfinder_paths/run_strategy.py basis_trading_strategy \
|
|
122
|
-
--action
|
|
82
|
+
--action update --config config.json
|
|
83
|
+
```
|
|
123
84
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
85
|
+
- Checks if position needs rebalancing
|
|
86
|
+
- Deploys idle capital via scale-up
|
|
87
|
+
- Verifies leg balance (spot ≈ perp)
|
|
88
|
+
- Updates stop-loss/limit orders if needed
|
|
127
89
|
|
|
128
|
-
|
|
129
|
-
poetry run python wayfinder_paths/run_strategy.py basis_trading_strategy \
|
|
130
|
-
--action update --config config.json
|
|
90
|
+
### Status
|
|
131
91
|
|
|
132
|
-
|
|
92
|
+
```bash
|
|
133
93
|
poetry run python wayfinder_paths/run_strategy.py basis_trading_strategy \
|
|
134
94
|
--action status --config config.json
|
|
95
|
+
```
|
|
135
96
|
|
|
136
|
-
|
|
137
|
-
poetry run python wayfinder_paths/run_strategy.py basis_trading_strategy \
|
|
138
|
-
--action withdraw --config config.json
|
|
97
|
+
### Withdraw
|
|
139
98
|
|
|
140
|
-
|
|
99
|
+
```bash
|
|
141
100
|
poetry run python wayfinder_paths/run_strategy.py basis_trading_strategy \
|
|
142
|
-
--action
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
## Configuration
|
|
146
|
-
|
|
147
|
-
```json
|
|
148
|
-
{
|
|
149
|
-
"main_wallet": {
|
|
150
|
-
"address": "0x...",
|
|
151
|
-
"private_key": "0x..."
|
|
152
|
-
},
|
|
153
|
-
"strategy_wallet": {
|
|
154
|
-
"address": "0x...",
|
|
155
|
-
"private_key": "0x..."
|
|
156
|
-
},
|
|
157
|
-
"strategy_config": {
|
|
158
|
-
"max_leverage": 3,
|
|
159
|
-
"lookback_days": 180,
|
|
160
|
-
"bootstrap_sims": 0,
|
|
161
|
-
"bootstrap_block_hours": 24
|
|
162
|
-
}
|
|
163
|
-
}
|
|
101
|
+
--action withdraw --config config.json
|
|
164
102
|
```
|
|
165
103
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
| `max_leverage` | 3 | Maximum leverage allowed |
|
|
171
|
-
| `lookback_days` | 180 | Days of historical data for analysis |
|
|
172
|
-
| `confidence` | 0.975 | VaR confidence level (97.5%) |
|
|
173
|
-
| `fee_eps` | 0.003 | Fee buffer (0.3%) |
|
|
174
|
-
| `oi_floor` | 50 | Minimum open interest (USD) |
|
|
175
|
-
| `day_vlm_floor` | 100,000 | Minimum daily volume (USD) |
|
|
176
|
-
| `bootstrap_sims` | 50 | Monte Carlo simulations for VaR estimation |
|
|
177
|
-
| `bootstrap_block_hours` | 24 | Block size for bootstrap resampling |
|
|
178
|
-
|
|
179
|
-
### Thresholds
|
|
180
|
-
|
|
181
|
-
| Constant | Value | Description |
|
|
182
|
-
|----------|-------|-------------|
|
|
183
|
-
| `MIN_DEPOSIT_USDC` | 50 | Minimum deposit |
|
|
184
|
-
| `LIQUIDATION_REBALANCE_THRESHOLD` | 0.65 | Stop-loss at 65% of liquidation distance |
|
|
185
|
-
| `MIN_UNUSED_USD` | 5.0 | Minimum idle capital to trigger scale-up |
|
|
186
|
-
| `UNUSED_REL_EPS` | 0.05 | Relative threshold (5% of deposit) |
|
|
187
|
-
|
|
188
|
-
## Adapters Used
|
|
189
|
-
|
|
190
|
-
- **BALANCE**: Wallet balances and ERC20 transfers
|
|
191
|
-
- **LEDGER**: Transaction recording for deposit/withdraw tracking
|
|
192
|
-
- **TOKEN**: Token metadata (decimals, addresses)
|
|
193
|
-
- **HYPERLIQUID**: Market data, order execution, account state
|
|
104
|
+
- Cancels all open orders
|
|
105
|
+
- Uses PairedFiller to close both legs (sell spot + buy perp)
|
|
106
|
+
- Withdraws USDC from Hyperliquid to Arbitrum
|
|
107
|
+
- Sends funds back to main wallet
|
|
194
108
|
|
|
195
109
|
## Risk Factors
|
|
196
110
|
|
|
197
|
-
1. **Funding Rate Flips**: Rates can turn negative
|
|
198
|
-
2. **Liquidation Risk**: High leverage + adverse price movement
|
|
111
|
+
1. **Funding Rate Flips**: Rates can turn negative
|
|
112
|
+
2. **Liquidation Risk**: High leverage + adverse price movement
|
|
199
113
|
3. **Execution Slippage**: Large orders may move the market
|
|
200
114
|
4. **Withdrawal Delays**: Hyperliquid withdrawals take ~15-30 minutes
|
|
201
115
|
5. **Smart Contract Risk**: Funds are held on Hyperliquid's L1
|
|
202
116
|
|
|
203
|
-
##
|
|
117
|
+
## Testing
|
|
204
118
|
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
├── HyperliquidAdapter # Market data, account state
|
|
208
|
-
├── LocalHyperliquidExecutor # Order execution (spot + perp)
|
|
209
|
-
├── PairedFiller # Atomic paired order execution
|
|
210
|
-
├── BalanceAdapter # Arbitrum wallet balances
|
|
211
|
-
├── LedgerAdapter # Deposit/withdraw tracking
|
|
212
|
-
└── LocalEvmTxn # Arbitrum transaction signing
|
|
119
|
+
```bash
|
|
120
|
+
poetry run pytest wayfinder_paths/strategies/basis_trading_strategy/ -v
|
|
213
121
|
```
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Basis trading snapshot/backtest helpers.
|
|
3
|
-
|
|
4
|
-
Kept as a mixin so the main strategy file stays readable without changing behavior.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
1
|
from __future__ import annotations
|
|
8
2
|
|
|
9
3
|
import asyncio
|
|
@@ -38,7 +32,6 @@ class BasisSnapshotMixin:
|
|
|
38
32
|
entry_cost_usd: float,
|
|
39
33
|
exit_cost_usd: float,
|
|
40
34
|
) -> dict[str, Any]:
|
|
41
|
-
"""Build the `safe[horizon]` entry matching the expected output shape."""
|
|
42
35
|
L = max(1, int(leverage))
|
|
43
36
|
|
|
44
37
|
depth_checks = depth_checks or {}
|
|
@@ -167,8 +160,6 @@ class BasisSnapshotMixin:
|
|
|
167
160
|
bootstrap_block_hours: int | None = None,
|
|
168
161
|
bootstrap_seed: int | None = None,
|
|
169
162
|
) -> dict[str, Any] | None:
|
|
170
|
-
"""Return the top-ranked candidate with solver diagnostics for downstream use."""
|
|
171
|
-
|
|
172
163
|
bootstrap_sims = int(
|
|
173
164
|
self.DEFAULT_BOOTSTRAP_SIMS if bootstrap_sims is None else bootstrap_sims
|
|
174
165
|
)
|
|
@@ -315,14 +306,6 @@ class BasisSnapshotMixin:
|
|
|
315
306
|
bootstrap_block_hours: int | None = None,
|
|
316
307
|
bootstrap_seed: int | None = None,
|
|
317
308
|
) -> dict[str, Any]:
|
|
318
|
-
"""
|
|
319
|
-
Build an hourly, shareable snapshot of:
|
|
320
|
-
- performance table (net APY + churn stats)
|
|
321
|
-
- liquidity capacity per pair (max order/deposit supported by depth checks)
|
|
322
|
-
|
|
323
|
-
Intended for batch jobs: compute once, distribute to workers, and have workers
|
|
324
|
-
filter by user deposit size without re-hitting Hyperliquid APIs.
|
|
325
|
-
"""
|
|
326
309
|
stop_frac = float(
|
|
327
310
|
stop_frac if stop_frac is not None else self.LIQUIDATION_REBALANCE_THRESHOLD
|
|
328
311
|
)
|
|
@@ -681,7 +664,6 @@ class BasisSnapshotMixin:
|
|
|
681
664
|
snapshot: dict[str, Any],
|
|
682
665
|
deposit_usdc: float,
|
|
683
666
|
) -> list[dict[str, Any]]:
|
|
684
|
-
"""Filter a batch snapshot for a specific deposit size."""
|
|
685
667
|
if deposit_usdc <= 0:
|
|
686
668
|
return []
|
|
687
669
|
|
|
@@ -754,12 +736,6 @@ class BasisSnapshotMixin:
|
|
|
754
736
|
bootstrap_block_hours: int = 48,
|
|
755
737
|
bootstrap_seed: int | None = None,
|
|
756
738
|
) -> dict[str, Any] | None:
|
|
757
|
-
"""
|
|
758
|
-
Given a snapshot-selected opportunity, recompute a full single-coin backtest
|
|
759
|
-
+ safe sizing for the user's exact deposit size using fresh market data.
|
|
760
|
-
|
|
761
|
-
This avoids running the full cross-asset scan on every worker.
|
|
762
|
-
"""
|
|
763
739
|
if deposit_usdc <= 0:
|
|
764
740
|
return None
|
|
765
741
|
|