wayfinder-paths 0.1.7__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.

Files changed (149) hide show
  1. wayfinder_paths/CONFIG_GUIDE.md +399 -0
  2. wayfinder_paths/__init__.py +22 -0
  3. wayfinder_paths/abis/generic/erc20.json +383 -0
  4. wayfinder_paths/adapters/__init__.py +0 -0
  5. wayfinder_paths/adapters/balance_adapter/README.md +94 -0
  6. wayfinder_paths/adapters/balance_adapter/adapter.py +238 -0
  7. wayfinder_paths/adapters/balance_adapter/examples.json +6 -0
  8. wayfinder_paths/adapters/balance_adapter/manifest.yaml +8 -0
  9. wayfinder_paths/adapters/balance_adapter/test_adapter.py +59 -0
  10. wayfinder_paths/adapters/brap_adapter/README.md +249 -0
  11. wayfinder_paths/adapters/brap_adapter/__init__.py +7 -0
  12. wayfinder_paths/adapters/brap_adapter/adapter.py +726 -0
  13. wayfinder_paths/adapters/brap_adapter/examples.json +175 -0
  14. wayfinder_paths/adapters/brap_adapter/manifest.yaml +11 -0
  15. wayfinder_paths/adapters/brap_adapter/test_adapter.py +286 -0
  16. wayfinder_paths/adapters/hyperlend_adapter/__init__.py +7 -0
  17. wayfinder_paths/adapters/hyperlend_adapter/adapter.py +305 -0
  18. wayfinder_paths/adapters/hyperlend_adapter/manifest.yaml +10 -0
  19. wayfinder_paths/adapters/hyperlend_adapter/test_adapter.py +274 -0
  20. wayfinder_paths/adapters/hyperliquid_adapter/__init__.py +18 -0
  21. wayfinder_paths/adapters/hyperliquid_adapter/adapter.py +1093 -0
  22. wayfinder_paths/adapters/hyperliquid_adapter/executor.py +549 -0
  23. wayfinder_paths/adapters/hyperliquid_adapter/manifest.yaml +8 -0
  24. wayfinder_paths/adapters/hyperliquid_adapter/paired_filler.py +1050 -0
  25. wayfinder_paths/adapters/hyperliquid_adapter/test_adapter.py +126 -0
  26. wayfinder_paths/adapters/hyperliquid_adapter/test_adapter_live.py +219 -0
  27. wayfinder_paths/adapters/hyperliquid_adapter/test_utils.py +220 -0
  28. wayfinder_paths/adapters/hyperliquid_adapter/utils.py +134 -0
  29. wayfinder_paths/adapters/ledger_adapter/README.md +145 -0
  30. wayfinder_paths/adapters/ledger_adapter/__init__.py +7 -0
  31. wayfinder_paths/adapters/ledger_adapter/adapter.py +289 -0
  32. wayfinder_paths/adapters/ledger_adapter/examples.json +137 -0
  33. wayfinder_paths/adapters/ledger_adapter/manifest.yaml +11 -0
  34. wayfinder_paths/adapters/ledger_adapter/test_adapter.py +205 -0
  35. wayfinder_paths/adapters/pool_adapter/README.md +206 -0
  36. wayfinder_paths/adapters/pool_adapter/__init__.py +7 -0
  37. wayfinder_paths/adapters/pool_adapter/adapter.py +282 -0
  38. wayfinder_paths/adapters/pool_adapter/examples.json +143 -0
  39. wayfinder_paths/adapters/pool_adapter/manifest.yaml +10 -0
  40. wayfinder_paths/adapters/pool_adapter/test_adapter.py +220 -0
  41. wayfinder_paths/adapters/token_adapter/README.md +101 -0
  42. wayfinder_paths/adapters/token_adapter/__init__.py +3 -0
  43. wayfinder_paths/adapters/token_adapter/adapter.py +96 -0
  44. wayfinder_paths/adapters/token_adapter/examples.json +26 -0
  45. wayfinder_paths/adapters/token_adapter/manifest.yaml +6 -0
  46. wayfinder_paths/adapters/token_adapter/test_adapter.py +125 -0
  47. wayfinder_paths/config.example.json +22 -0
  48. wayfinder_paths/conftest.py +31 -0
  49. wayfinder_paths/core/__init__.py +18 -0
  50. wayfinder_paths/core/adapters/BaseAdapter.py +65 -0
  51. wayfinder_paths/core/adapters/__init__.py +5 -0
  52. wayfinder_paths/core/adapters/base.py +5 -0
  53. wayfinder_paths/core/adapters/models.py +46 -0
  54. wayfinder_paths/core/analytics/__init__.py +11 -0
  55. wayfinder_paths/core/analytics/bootstrap.py +57 -0
  56. wayfinder_paths/core/analytics/stats.py +48 -0
  57. wayfinder_paths/core/analytics/test_analytics.py +170 -0
  58. wayfinder_paths/core/clients/AuthClient.py +83 -0
  59. wayfinder_paths/core/clients/BRAPClient.py +109 -0
  60. wayfinder_paths/core/clients/ClientManager.py +210 -0
  61. wayfinder_paths/core/clients/HyperlendClient.py +192 -0
  62. wayfinder_paths/core/clients/LedgerClient.py +443 -0
  63. wayfinder_paths/core/clients/PoolClient.py +128 -0
  64. wayfinder_paths/core/clients/SimulationClient.py +192 -0
  65. wayfinder_paths/core/clients/TokenClient.py +89 -0
  66. wayfinder_paths/core/clients/TransactionClient.py +63 -0
  67. wayfinder_paths/core/clients/WalletClient.py +94 -0
  68. wayfinder_paths/core/clients/WayfinderClient.py +269 -0
  69. wayfinder_paths/core/clients/__init__.py +48 -0
  70. wayfinder_paths/core/clients/protocols.py +392 -0
  71. wayfinder_paths/core/clients/sdk_example.py +110 -0
  72. wayfinder_paths/core/config.py +458 -0
  73. wayfinder_paths/core/constants/__init__.py +26 -0
  74. wayfinder_paths/core/constants/base.py +42 -0
  75. wayfinder_paths/core/constants/erc20_abi.py +118 -0
  76. wayfinder_paths/core/constants/hyperlend_abi.py +152 -0
  77. wayfinder_paths/core/engine/StrategyJob.py +188 -0
  78. wayfinder_paths/core/engine/__init__.py +5 -0
  79. wayfinder_paths/core/engine/manifest.py +97 -0
  80. wayfinder_paths/core/services/__init__.py +0 -0
  81. wayfinder_paths/core/services/base.py +179 -0
  82. wayfinder_paths/core/services/local_evm_txn.py +430 -0
  83. wayfinder_paths/core/services/local_token_txn.py +231 -0
  84. wayfinder_paths/core/services/web3_service.py +45 -0
  85. wayfinder_paths/core/settings.py +61 -0
  86. wayfinder_paths/core/strategies/Strategy.py +280 -0
  87. wayfinder_paths/core/strategies/__init__.py +5 -0
  88. wayfinder_paths/core/strategies/base.py +7 -0
  89. wayfinder_paths/core/strategies/descriptors.py +81 -0
  90. wayfinder_paths/core/utils/__init__.py +1 -0
  91. wayfinder_paths/core/utils/evm_helpers.py +206 -0
  92. wayfinder_paths/core/utils/wallets.py +77 -0
  93. wayfinder_paths/core/wallets/README.md +91 -0
  94. wayfinder_paths/core/wallets/WalletManager.py +56 -0
  95. wayfinder_paths/core/wallets/__init__.py +7 -0
  96. wayfinder_paths/policies/enso.py +17 -0
  97. wayfinder_paths/policies/erc20.py +34 -0
  98. wayfinder_paths/policies/evm.py +21 -0
  99. wayfinder_paths/policies/hyper_evm.py +19 -0
  100. wayfinder_paths/policies/hyperlend.py +12 -0
  101. wayfinder_paths/policies/hyperliquid.py +30 -0
  102. wayfinder_paths/policies/moonwell.py +54 -0
  103. wayfinder_paths/policies/prjx.py +30 -0
  104. wayfinder_paths/policies/util.py +27 -0
  105. wayfinder_paths/run_strategy.py +411 -0
  106. wayfinder_paths/scripts/__init__.py +0 -0
  107. wayfinder_paths/scripts/create_strategy.py +181 -0
  108. wayfinder_paths/scripts/make_wallets.py +169 -0
  109. wayfinder_paths/scripts/run_strategy.py +124 -0
  110. wayfinder_paths/scripts/validate_manifests.py +213 -0
  111. wayfinder_paths/strategies/__init__.py +0 -0
  112. wayfinder_paths/strategies/basis_trading_strategy/README.md +213 -0
  113. wayfinder_paths/strategies/basis_trading_strategy/__init__.py +3 -0
  114. wayfinder_paths/strategies/basis_trading_strategy/constants.py +1 -0
  115. wayfinder_paths/strategies/basis_trading_strategy/examples.json +16 -0
  116. wayfinder_paths/strategies/basis_trading_strategy/manifest.yaml +23 -0
  117. wayfinder_paths/strategies/basis_trading_strategy/snapshot_mixin.py +1011 -0
  118. wayfinder_paths/strategies/basis_trading_strategy/strategy.py +4522 -0
  119. wayfinder_paths/strategies/basis_trading_strategy/test_strategy.py +727 -0
  120. wayfinder_paths/strategies/basis_trading_strategy/types.py +39 -0
  121. wayfinder_paths/strategies/config.py +85 -0
  122. wayfinder_paths/strategies/hyperlend_stable_yield_strategy/README.md +100 -0
  123. wayfinder_paths/strategies/hyperlend_stable_yield_strategy/examples.json +8 -0
  124. wayfinder_paths/strategies/hyperlend_stable_yield_strategy/manifest.yaml +7 -0
  125. wayfinder_paths/strategies/hyperlend_stable_yield_strategy/strategy.py +2270 -0
  126. wayfinder_paths/strategies/hyperlend_stable_yield_strategy/test_strategy.py +352 -0
  127. wayfinder_paths/strategies/stablecoin_yield_strategy/README.md +96 -0
  128. wayfinder_paths/strategies/stablecoin_yield_strategy/examples.json +17 -0
  129. wayfinder_paths/strategies/stablecoin_yield_strategy/manifest.yaml +17 -0
  130. wayfinder_paths/strategies/stablecoin_yield_strategy/strategy.py +1810 -0
  131. wayfinder_paths/strategies/stablecoin_yield_strategy/test_strategy.py +520 -0
  132. wayfinder_paths/templates/adapter/README.md +105 -0
  133. wayfinder_paths/templates/adapter/adapter.py +26 -0
  134. wayfinder_paths/templates/adapter/examples.json +8 -0
  135. wayfinder_paths/templates/adapter/manifest.yaml +6 -0
  136. wayfinder_paths/templates/adapter/test_adapter.py +49 -0
  137. wayfinder_paths/templates/strategy/README.md +153 -0
  138. wayfinder_paths/templates/strategy/examples.json +11 -0
  139. wayfinder_paths/templates/strategy/manifest.yaml +8 -0
  140. wayfinder_paths/templates/strategy/strategy.py +57 -0
  141. wayfinder_paths/templates/strategy/test_strategy.py +197 -0
  142. wayfinder_paths/tests/__init__.py +0 -0
  143. wayfinder_paths/tests/test_smoke_manifest.py +48 -0
  144. wayfinder_paths/tests/test_test_coverage.py +212 -0
  145. wayfinder_paths/tests/test_utils.py +64 -0
  146. wayfinder_paths-0.1.7.dist-info/LICENSE +21 -0
  147. wayfinder_paths-0.1.7.dist-info/METADATA +777 -0
  148. wayfinder_paths-0.1.7.dist-info/RECORD +149 -0
  149. wayfinder_paths-0.1.7.dist-info/WHEEL +4 -0
@@ -0,0 +1,399 @@
1
+ # Configuration Guide
2
+
3
+ This guide explains how to configure your strategies for local testing.
4
+
5
+ ## Quick Setup
6
+
7
+ ```bash
8
+ # 1. Generate test wallets (required!)
9
+ # Creates a main wallet (or use 'just create-strategy' which auto-creates wallets)
10
+ just create-wallets
11
+ # Or manually: poetry run python wayfinder_paths/scripts/make_wallets.py -n 1
12
+
13
+ # 2. Create your config file
14
+ cp wayfinder_paths/config.example.json config.json
15
+
16
+ # 3. Edit config.json with your Wayfinder credentials
17
+ # NEVER commit this file - it contains your credentials!
18
+ ```
19
+
20
+ ## Configuration Structure
21
+
22
+ ### config.json Structure
23
+
24
+ ```json
25
+ {
26
+ "user": {
27
+ "username": "your_username", // OPTIONAL: For OAuth authentication
28
+ "password": "your_password", // OPTIONAL: For OAuth authentication
29
+ "refresh_token": null, // OPTIONAL: Alternative to username/password
30
+ "api_key": "sk_live_abc123..." // OPTIONAL: For service account authentication (loaded directly by clients, not stored in UserConfig)
31
+ },
32
+ "system": {
33
+ "api_base_url": "https://wayfinder.ai/api/v1",
34
+ "api_key": "sk_live_abc123...", // OPTIONAL: System-level API key (alternative to user.api_key, loaded directly by clients)
35
+ "wallets_path": "wallets.json" // Path to your generated wallets.json
36
+ },
37
+ "strategy": {
38
+ "rpc_urls": { // RPC endpoints for different chains
39
+ "1": "https://eth.llamarpc.com",
40
+ "42161": "https://arb1.arbitrum.io/rpc",
41
+ "8453": "https://mainnet.base.org",
42
+ "solana": "https://api.mainnet-beta.solana.com"
43
+ }
44
+ }
45
+ }
46
+ ```
47
+
48
+ ## User Configuration
49
+
50
+ **Authentication (choose one method):**
51
+
52
+ **Option 1: Service Account (API Key) - Recommended for Production**
53
+ - `user.api_key` - Your Wayfinder API key for service account authentication (loaded directly by clients from config.json)
54
+ - OR `system.api_key` - System-level API key (alternative location, loaded directly by clients)
55
+ - OR set `WAYFINDER_API_KEY` environment variable
56
+ - OR pass `api_key` parameter to strategy constructor
57
+
58
+ **Note:** API keys in `config.json` are loaded directly by `WayfinderClient` via `_load_config_credentials()`, not through the `UserConfig` or `SystemConfig` dataclasses. This is intentional to allow flexible credential loading.
59
+
60
+ **Option 2: Personal Access (OAuth) - For Development**
61
+ - `user.username` - Your Wayfinder backend username
62
+ - `user.password` - Your Wayfinder backend password
63
+ - OR `user.refresh_token` - Alternative to username/password
64
+
65
+ **Other Optional fields:**
66
+ - `user.main_wallet_address` - Override auto-loaded main wallet
67
+ - `user.strategy_wallet_address` - Override auto-loaded strategy wallet
68
+
69
+ **Security Note:** Never commit `config.json` to version control. Add it to `.gitignore`.
70
+
71
+ ## System Configuration
72
+
73
+ These are managed automatically by Wayfinder:
74
+ - `api_base_url` - Wayfinder backend API endpoint
75
+ - `wallets_path` - Location of generated wallets.json
76
+ - `job_id` - Auto-generated by Wayfinder
77
+ - `job_type` - Set to "strategy"
78
+
79
+ ## Strategy Configuration
80
+
81
+ ### RPC Endpoints
82
+
83
+ Default RPC URLs are provided for:
84
+ - Ethereum (chain ID: 1)
85
+ - Arbitrum (chain ID: 42161)
86
+ - Base (chain ID: 8453)
87
+ - Solana
88
+
89
+ You can override these in `config.json` if needed.
90
+
91
+ ### Strategy-Specific Settings
92
+
93
+ Individual strategies may have their own configuration parameters. Check the strategy's README for available options.
94
+
95
+ ## Wallet Generation for Testing
96
+
97
+ Use the built-in script to generate test wallets for local development:
98
+
99
+ ```bash
100
+ # Generate main wallet (recommended for initial setup)
101
+ poetry run python wayfinder_paths/scripts/make_wallets.py -n 1
102
+
103
+ # Add additional wallets for multi-account testing
104
+ poetry run python wayfinder_paths/scripts/make_wallets.py -n 3
105
+
106
+ # Create a wallet with a specific label (e.g., for a strategy)
107
+ poetry run python wayfinder_paths/scripts/make_wallets.py --label "my_strategy_name"
108
+
109
+ # Generate keystore files (for geth/web3 compatibility)
110
+ poetry run python wayfinder_paths/scripts/make_wallets.py -n 1 --keystore-password "your-password"
111
+ ```
112
+
113
+ This creates `wallets.json` in the repository root with:
114
+ - **main** wallet - your main wallet for testing (labeled "main")
115
+ - Additional wallets with labels if specified
116
+
117
+ **Note:** Generated wallets are for testing only. Wallet addresses are automatically loaded from `wallets.json` when not explicitly set in config. Strategy-specific wallets are automatically created when you use `just create-strategy "Strategy Name"`.
118
+
119
+ ## Per-Strategy Wallets
120
+
121
+ Each strategy should have its own dedicated wallet for isolation and security. The system automatically looks up wallets by strategy directory name.
122
+
123
+ ### How It Works
124
+
125
+ When you run a strategy:
126
+ 1. The system uses the strategy directory name (e.g., `hyperlend_stable_yield_strategy`) to look up a wallet
127
+ 2. It searches `wallets.json` for a wallet with a matching `label`
128
+ 3. If found, that wallet is used as the strategy's dedicated wallet
129
+ 4. Falls back to `strategy_wallet_address` from config if explicitly provided
130
+
131
+ ### Creating a Strategy with Wallet
132
+
133
+ The easiest way to create a new strategy with its own wallet:
134
+
135
+ ```bash
136
+ # Create a new strategy with dedicated wallet
137
+ just create-strategy "My Strategy Name"
138
+
139
+ # This automatically:
140
+ # - Creates the strategy directory
141
+ # - Generates a wallet with label matching the directory name
142
+ # - Updates the manifest with the correct name and entrypoint
143
+ ```
144
+
145
+ ### Wallet Structure
146
+
147
+ Wallets in `wallets.json` are stored with labels that match strategy directory names:
148
+
149
+ ```json
150
+ [
151
+ {
152
+ "address": "0x...",
153
+ "private_key_hex": "...",
154
+ "label": "main"
155
+ },
156
+ {
157
+ "address": "0x...",
158
+ "private_key_hex": "...",
159
+ "label": "hyperlend_stable_yield_strategy"
160
+ },
161
+ {
162
+ "address": "0x...",
163
+ "private_key_hex": "...",
164
+ "label": "my_awesome_strategy"
165
+ }
166
+ ]
167
+ ```
168
+
169
+ ### Manual Wallet Creation
170
+
171
+ If you need to manually create a wallet for an existing strategy:
172
+
173
+ ```bash
174
+ # Generate a wallet
175
+ poetry run python wayfinder_paths/scripts/make_wallets.py -n 1
176
+
177
+ # Then edit wallets.json to add a label matching your strategy directory name:
178
+ # {
179
+ # "address": "0x...",
180
+ # "private_key_hex": "...",
181
+ # "label": "your_strategy_directory_name"
182
+ # }
183
+ ```
184
+
185
+ ### Strategy Access
186
+
187
+ Strategies access wallets the same way as before:
188
+
189
+ ```python
190
+ # In strategy code
191
+ strategy_address = self.config.get("strategy_wallet").get("address")
192
+ main_address = self.config.get("main_wallet").get("address")
193
+ ```
194
+
195
+ The strategy wallet is automatically populated from the wallet with label matching the strategy directory name.
196
+
197
+ ## Loading Configuration
198
+
199
+ The configuration is loaded automatically when running strategies via `run_strategy.py`:
200
+
201
+ ```bash
202
+ poetry run python wayfinder_paths/run_strategy.py stablecoin_yield_strategy --config config.json
203
+ ```
204
+
205
+ For programmatic use:
206
+
207
+ ```python
208
+ from pathlib import Path
209
+ from core.config import StrategyJobConfig
210
+ import json
211
+
212
+ # Load from file
213
+ with open("config.json") as f:
214
+ config_data = json.load(f)
215
+
216
+ config = StrategyJobConfig.from_dict(config_data)
217
+
218
+ # Configuration now has:
219
+ # - config.user.username & password (for Wayfinder backend)
220
+ # - config.system.api_base_url & wallets_path
221
+ # - config.strategy_config (strategy-specific settings)
222
+ ```
223
+
224
+ ## Wallet Abstraction
225
+
226
+ The strategy system supports multiple wallet types through a wallet abstraction layer. By default, adapters use local private keys (self-custodial wallets), but you can inject custom wallet providers for custodial wallets like Privy or Turnkey.
227
+
228
+ ### Default Behavior (Local Wallets)
229
+
230
+ By default, adapters use `LocalWalletProvider` which resolves private keys from:
231
+ - `wallets.json` (matched by address)
232
+ - Environment variables (`PRIVATE_KEY`, `PRIVATE_KEY_STRATEGY`)
233
+ - Wallet config in `config.json`
234
+
235
+ No code changes are required - existing strategies continue to work.
236
+
237
+ ### Using Custom Wallet Providers
238
+
239
+ To use a custodial wallet provider (e.g., Privy, Turnkey), inject it directly into adapters:
240
+
241
+ ```python
242
+ from adapters.evm_transaction_adapter.adapter import EvmTransactionAdapter
243
+ from my_privy_integration import PrivyWalletProvider
244
+
245
+ # Create your custom wallet provider
246
+ privy_provider = PrivyWalletProvider(privy_api_key, privy_wallet_id)
247
+
248
+ # Inject it into adapters
249
+ adapter = EvmTransactionAdapter(config, wallet_provider=privy_provider)
250
+ ```
251
+
252
+ See `core/wallets/README.md` for details on implementing custom wallet providers.
253
+
254
+ ## Security Best Practices
255
+
256
+ 1. **Never commit `config.json`** - add it to `.gitignore`
257
+ 2. **Never commit `wallets.json`** - contains private keys
258
+ 3. **Use test wallets** - the script generates throwaway wallets for testing
259
+ 4. **Keep credentials secure** - Wayfinder username/password grant access to backend resources
260
+ 5. **Set conservative parameters** for initial testing:
261
+ - Lower leverage ratios
262
+ - Higher slippage tolerance
263
+ - Lower position sizes
264
+
265
+ ## Authentication with Wayfinder Backend
266
+
267
+ Wayfinder Paths supports **dual authentication** for different use cases:
268
+
269
+ ### 1. Service Account Authentication (API Key)
270
+
271
+ **Best for:** Backend services, automated systems, and production deployments with higher rate limits.
272
+
273
+ API keys provide service account authentication and are automatically discovered by all clients. You can provide an API key in three ways:
274
+
275
+ #### Option A: Strategy Constructor (Programmatic)
276
+ ```python
277
+ from wayfinder_paths.strategies.stablecoin_yield_strategy.strategy import StablecoinYieldStrategy
278
+
279
+ strategy = StablecoinYieldStrategy(
280
+ config={...},
281
+ api_key="sk_live_abc123..." # Sets WAYFINDER_API_KEY env var automatically
282
+ )
283
+ ```
284
+
285
+ #### Option B: Environment Variable
286
+ ```bash
287
+ export WAYFINDER_API_KEY="sk_live_abc123..."
288
+ ```
289
+
290
+ #### Option C: config.json
291
+ ```json
292
+ {
293
+ "user": {
294
+ "api_key": "sk_live_abc123..."
295
+ },
296
+ "system": {
297
+ "api_key": "sk_live_abc123..." // Alternative: system-level API key
298
+ }
299
+ }
300
+ ```
301
+
302
+ **Priority Order:** Constructor parameter > `config.json` (user.api_key or system.api_key) > `WAYFINDER_API_KEY` environment variable
303
+
304
+ **How It Works:**
305
+ - When a strategy receives an `api_key`, it sets `os.environ["WAYFINDER_API_KEY"]`
306
+ - All clients created by adapters automatically discover the API key from:
307
+ - Constructor parameter (if passed)
308
+ - `config.json` (via `WayfinderClient._load_config_credentials()` which reads `user.api_key` or `system.api_key`)
309
+ - `WAYFINDER_API_KEY` environment variable
310
+ - API keys are included in **all** API requests (including public endpoints) for rate limiting
311
+ - No need to pass API keys explicitly to adapters or clients—they auto-discover it
312
+ - **Note:** API keys in `config.json` are loaded directly by clients, not stored in the `UserConfig` or `SystemConfig` dataclasses
313
+
314
+ ### 2. Personal Access Authentication (OAuth)
315
+
316
+ **Best for:** Standalone SDK users and local development.
317
+
318
+ The `username` and `password` in your config authenticate with the Wayfinder backend to access:
319
+ - Wallet management
320
+ - Transaction signing services
321
+ - Strategy execution services
322
+
323
+ ```json
324
+ {
325
+ "user": {
326
+ "username": "your_username",
327
+ "password": "your_password",
328
+ "refresh_token": null // Optional: use refresh token instead of username/password
329
+ }
330
+ }
331
+ ```
332
+
333
+ **Fallback Behavior:**
334
+ - If an API key is not found or authentication fails, the system automatically falls back to OAuth
335
+ - OAuth tokens are automatically refreshed when they expire
336
+
337
+ ### Security Best Practices
338
+
339
+ - **Never commit credentials** to version control - add `config.json` to `.gitignore`
340
+ - **Use API keys for production** - they provide better rate limits and don't require token refresh
341
+ - **Use OAuth for development** - simpler setup for local testing
342
+ - **Rotate credentials regularly** - especially if exposed or compromised
343
+
344
+ ## Configuration in Strategies
345
+
346
+ Strategies receive configuration automatically through StrategyJob:
347
+
348
+ ```python
349
+ from core.strategies.Strategy import Strategy
350
+
351
+ class MyStrategy(Strategy):
352
+ async def setup(self):
353
+ # Access strategy-specific config
354
+ target_leverage = self.config.get("target_leverage", 1.0)
355
+
356
+ # Access RPC URLs
357
+ eth_rpc = self.config.get("rpc_urls", {}).get("1")
358
+
359
+ # Configuration is already loaded from config.json
360
+ ```
361
+
362
+ ## Advanced: Custom RPC Endpoints
363
+
364
+ To use custom RPC endpoints, update the `strategy.rpc_urls` section in `config.json`:
365
+
366
+ ```json
367
+ {
368
+ "strategy": {
369
+ "rpc_urls": {
370
+ "1": "https://your-custom-ethereum-rpc.com",
371
+ "8453": "https://your-custom-base-rpc.com"
372
+ }
373
+ }
374
+ }
375
+ ```
376
+
377
+ ## Troubleshooting
378
+
379
+ **Issue:** "Authentication failed"
380
+ - **If using API key:**
381
+ - Verify API key is correct and not expired
382
+ - Check that API key is set in one of: constructor parameter, `config.json` (user.api_key or system.api_key), or `WAYFINDER_API_KEY` env var
383
+ - Ensure API key has proper permissions for the operations you're performing
384
+ - **If using OAuth:**
385
+ - Check that `username` and `password` are correct in `config.json`
386
+ - Verify your Wayfinder account credentials
387
+ - Try using `refresh_token` instead if you have one
388
+ - **General:**
389
+ - The system automatically falls back from API key to OAuth if API key authentication fails
390
+ - Check logs for specific authentication error messages
391
+
392
+ **Issue:** "Wallet not found"
393
+ - Run the wallet generation script first
394
+ - Check that `wallets.json` exists in repository root
395
+ - Verify `system.wallets_path` in config points to the correct location
396
+
397
+ **Issue:** "Invalid config"
398
+ - Ensure `config.json` follows the correct structure
399
+ - Check that all required fields are present
@@ -0,0 +1,22 @@
1
+ """Wayfinder Path - Trading strategies and adapters for automated strategy management"""
2
+
3
+ __version__ = "0.1.0"
4
+
5
+ # Re-export commonly used items for convenience
6
+ from wayfinder_paths.core import (
7
+ BaseAdapter,
8
+ LiquidationResult,
9
+ StatusDict,
10
+ StatusTuple,
11
+ Strategy,
12
+ StrategyJob,
13
+ )
14
+
15
+ __all__ = [
16
+ "__version__",
17
+ "BaseAdapter",
18
+ "Strategy",
19
+ "StatusDict",
20
+ "StatusTuple",
21
+ "StrategyJob",
22
+ ]