wayfinder-paths 0.1.6__py3-none-any.whl → 0.1.8__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/adapters/balance_adapter/README.md +0 -10
- wayfinder_paths/adapters/balance_adapter/adapter.py +0 -20
- wayfinder_paths/adapters/balance_adapter/test_adapter.py +0 -30
- wayfinder_paths/adapters/brap_adapter/adapter.py +3 -2
- wayfinder_paths/adapters/brap_adapter/test_adapter.py +9 -13
- wayfinder_paths/adapters/hyperlend_adapter/test_adapter.py +14 -7
- wayfinder_paths/adapters/hyperliquid_adapter/__init__.py +18 -0
- wayfinder_paths/adapters/hyperliquid_adapter/adapter.py +1093 -0
- wayfinder_paths/adapters/hyperliquid_adapter/executor.py +549 -0
- wayfinder_paths/adapters/hyperliquid_adapter/manifest.yaml +8 -0
- wayfinder_paths/adapters/hyperliquid_adapter/paired_filler.py +1050 -0
- wayfinder_paths/adapters/hyperliquid_adapter/test_adapter.py +126 -0
- wayfinder_paths/adapters/hyperliquid_adapter/test_adapter_live.py +219 -0
- wayfinder_paths/adapters/hyperliquid_adapter/test_utils.py +220 -0
- wayfinder_paths/adapters/hyperliquid_adapter/utils.py +134 -0
- wayfinder_paths/adapters/ledger_adapter/test_adapter.py +7 -6
- wayfinder_paths/adapters/pool_adapter/README.md +3 -28
- wayfinder_paths/adapters/pool_adapter/adapter.py +0 -72
- wayfinder_paths/adapters/pool_adapter/examples.json +0 -43
- wayfinder_paths/adapters/pool_adapter/test_adapter.py +4 -54
- wayfinder_paths/adapters/token_adapter/test_adapter.py +4 -14
- wayfinder_paths/core/adapters/models.py +9 -4
- wayfinder_paths/core/analytics/__init__.py +11 -0
- wayfinder_paths/core/analytics/bootstrap.py +57 -0
- wayfinder_paths/core/analytics/stats.py +48 -0
- wayfinder_paths/core/analytics/test_analytics.py +170 -0
- wayfinder_paths/core/clients/BRAPClient.py +1 -0
- wayfinder_paths/core/clients/LedgerClient.py +2 -7
- wayfinder_paths/core/clients/PoolClient.py +0 -16
- wayfinder_paths/core/clients/WalletClient.py +0 -27
- wayfinder_paths/core/clients/protocols.py +104 -18
- wayfinder_paths/scripts/make_wallets.py +9 -0
- wayfinder_paths/scripts/run_strategy.py +124 -0
- wayfinder_paths/strategies/basis_trading_strategy/README.md +213 -0
- wayfinder_paths/strategies/basis_trading_strategy/__init__.py +3 -0
- wayfinder_paths/strategies/basis_trading_strategy/constants.py +1 -0
- wayfinder_paths/strategies/basis_trading_strategy/examples.json +16 -0
- wayfinder_paths/strategies/basis_trading_strategy/manifest.yaml +23 -0
- wayfinder_paths/strategies/basis_trading_strategy/snapshot_mixin.py +1011 -0
- wayfinder_paths/strategies/basis_trading_strategy/strategy.py +4522 -0
- wayfinder_paths/strategies/basis_trading_strategy/test_strategy.py +727 -0
- wayfinder_paths/strategies/basis_trading_strategy/types.py +39 -0
- wayfinder_paths/strategies/hyperlend_stable_yield_strategy/examples.json +1 -9
- wayfinder_paths/strategies/hyperlend_stable_yield_strategy/test_strategy.py +36 -5
- wayfinder_paths/strategies/stablecoin_yield_strategy/strategy.py +367 -278
- wayfinder_paths/strategies/stablecoin_yield_strategy/test_strategy.py +204 -7
- {wayfinder_paths-0.1.6.dist-info → wayfinder_paths-0.1.8.dist-info}/METADATA +32 -3
- {wayfinder_paths-0.1.6.dist-info → wayfinder_paths-0.1.8.dist-info}/RECORD +50 -27
- {wayfinder_paths-0.1.6.dist-info → wayfinder_paths-0.1.8.dist-info}/LICENSE +0 -0
- {wayfinder_paths-0.1.6.dist-info → wayfinder_paths-0.1.8.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass
|
|
8
|
+
class BasisCandidate:
|
|
9
|
+
"""Represents a potential basis trading opportunity."""
|
|
10
|
+
|
|
11
|
+
coin: str
|
|
12
|
+
spot_pair: str
|
|
13
|
+
spot_asset_id: int
|
|
14
|
+
perp_asset_id: int
|
|
15
|
+
mark_price: float
|
|
16
|
+
target_leverage: int
|
|
17
|
+
ctx: dict[str, Any]
|
|
18
|
+
spot_book: dict[str, Any]
|
|
19
|
+
open_interest_base: float
|
|
20
|
+
open_interest_usd: float
|
|
21
|
+
day_notional_usd: float
|
|
22
|
+
order_usd: float
|
|
23
|
+
depth_checks: dict[str, dict[str, Any]]
|
|
24
|
+
margin_table_id: int | None = None
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@dataclass
|
|
28
|
+
class BasisPosition:
|
|
29
|
+
"""Tracks an active basis position."""
|
|
30
|
+
|
|
31
|
+
coin: str
|
|
32
|
+
spot_asset_id: int
|
|
33
|
+
perp_asset_id: int
|
|
34
|
+
spot_amount: float
|
|
35
|
+
perp_amount: float
|
|
36
|
+
entry_price: float
|
|
37
|
+
leverage: int
|
|
38
|
+
entry_timestamp: int
|
|
39
|
+
funding_collected: float = 0.0
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"smoke": {
|
|
3
|
-
"deposit": {
|
|
3
|
+
"deposit": {},
|
|
4
4
|
"update": {},
|
|
5
5
|
"status": {},
|
|
6
6
|
"withdraw": {}
|
|
7
|
-
},
|
|
8
|
-
"min_deposit_fail": {
|
|
9
|
-
"deposit": {"main_token_amount": 0.5, "gas_token_amount": 0.0},
|
|
10
|
-
"expect": {"success": false}
|
|
11
|
-
},
|
|
12
|
-
"gas_exceeds_maximum": {
|
|
13
|
-
"deposit": {"main_token_amount": 100.0, "gas_token_amount": 0.2},
|
|
14
|
-
"expect": {"success": false}
|
|
15
7
|
}
|
|
16
8
|
}
|
|
@@ -62,9 +62,6 @@ def strategy():
|
|
|
62
62
|
return (True, 1000000000)
|
|
63
63
|
|
|
64
64
|
s.balance_adapter.get_balance = AsyncMock(side_effect=get_balance_side_effect)
|
|
65
|
-
s.balance_adapter.get_all_balances = AsyncMock(
|
|
66
|
-
return_value=(True, {"balances": []})
|
|
67
|
-
)
|
|
68
65
|
|
|
69
66
|
if hasattr(s, "token_adapter") and s.token_adapter:
|
|
70
67
|
default_usdt0 = {
|
|
@@ -175,6 +172,36 @@ def strategy():
|
|
|
175
172
|
s.hyperlend_adapter.get_assets_view = AsyncMock(
|
|
176
173
|
return_value=(True, {"assets_view": {"assets": []}})
|
|
177
174
|
)
|
|
175
|
+
s.hyperlend_adapter.get_stable_markets = AsyncMock(
|
|
176
|
+
return_value=(
|
|
177
|
+
True,
|
|
178
|
+
{
|
|
179
|
+
"markets": {
|
|
180
|
+
"0x1234567890123456789012345678901234567890": {
|
|
181
|
+
"symbol": "USDT0",
|
|
182
|
+
"address": "0x1234567890123456789012345678901234567890",
|
|
183
|
+
"apy": 5.0,
|
|
184
|
+
"tvl": 1000000,
|
|
185
|
+
"underlying_token": {
|
|
186
|
+
"address": "0x1234567890123456789012345678901234567890",
|
|
187
|
+
"symbol": "USDT0",
|
|
188
|
+
"decimals": 6,
|
|
189
|
+
},
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
"notes": [],
|
|
193
|
+
},
|
|
194
|
+
)
|
|
195
|
+
)
|
|
196
|
+
s.hyperlend_adapter.get_lend_rate_history = AsyncMock(
|
|
197
|
+
return_value=(
|
|
198
|
+
True,
|
|
199
|
+
{
|
|
200
|
+
"rates": [{"rate": 5.0, "timestamp": 1700000000}],
|
|
201
|
+
"avg_rate": 5.0,
|
|
202
|
+
},
|
|
203
|
+
)
|
|
204
|
+
)
|
|
178
205
|
|
|
179
206
|
s.usdt_token_info = {
|
|
180
207
|
"id": "usdt0-hyperevm",
|
|
@@ -255,7 +282,9 @@ async def test_smoke(strategy):
|
|
|
255
282
|
assert isinstance(ok, bool)
|
|
256
283
|
assert isinstance(msg, str)
|
|
257
284
|
|
|
258
|
-
|
|
285
|
+
result = await strategy.update(**smoke_data.get("update", {}))
|
|
286
|
+
# update() returns (ok, msg, should_notify) or (ok, msg)
|
|
287
|
+
ok = result[0]
|
|
259
288
|
assert isinstance(ok, bool)
|
|
260
289
|
|
|
261
290
|
ok, msg = await strategy.withdraw(**smoke_data.get("withdraw", {}))
|
|
@@ -279,7 +308,9 @@ async def test_canonical_usage(strategy):
|
|
|
279
308
|
assert ok, f"Canonical example '{example_name}' deposit failed"
|
|
280
309
|
|
|
281
310
|
if "update" in example_data:
|
|
282
|
-
|
|
311
|
+
result = await strategy.update()
|
|
312
|
+
ok = result[0]
|
|
313
|
+
msg = result[1] if len(result) > 1 else ""
|
|
283
314
|
assert ok, f"Canonical example '{example_name}' update failed: {msg}"
|
|
284
315
|
|
|
285
316
|
if "status" in example_data:
|