falcon-limitless-agent 0.1.0__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 (34) hide show
  1. falcon_limitless_agent-0.1.0/.env.example +18 -0
  2. falcon_limitless_agent-0.1.0/.gitignore +61 -0
  3. falcon_limitless_agent-0.1.0/PKG-INFO +88 -0
  4. falcon_limitless_agent-0.1.0/README.md +55 -0
  5. falcon_limitless_agent-0.1.0/agent_bootstrap.py +11 -0
  6. falcon_limitless_agent-0.1.0/config.py +127 -0
  7. falcon_limitless_agent-0.1.0/config_util.py +25 -0
  8. falcon_limitless_agent-0.1.0/docs/CLIENT-ENV-REFERENCE.md +42 -0
  9. falcon_limitless_agent-0.1.0/dry_run_log.py +416 -0
  10. falcon_limitless_agent-0.1.0/limitless_entry.py +23 -0
  11. falcon_limitless_agent-0.1.0/limitless_preflight.py +88 -0
  12. falcon_limitless_agent-0.1.0/live_positions.py +63 -0
  13. falcon_limitless_agent-0.1.0/main.py +117 -0
  14. falcon_limitless_agent-0.1.0/market_id_utils.py +9 -0
  15. falcon_limitless_agent-0.1.0/market_prices.py +121 -0
  16. falcon_limitless_agent-0.1.0/paths.py +81 -0
  17. falcon_limitless_agent-0.1.0/position_close.py +97 -0
  18. falcon_limitless_agent-0.1.0/position_monitor.py +122 -0
  19. falcon_limitless_agent-0.1.0/preflight.py +81 -0
  20. falcon_limitless_agent-0.1.0/pyproject.toml +85 -0
  21. falcon_limitless_agent-0.1.0/report_sender.py +49 -0
  22. falcon_limitless_agent-0.1.0/requirements.txt +10 -0
  23. falcon_limitless_agent-0.1.0/resolution_tracker.py +147 -0
  24. falcon_limitless_agent-0.1.0/risk_filter.py +225 -0
  25. falcon_limitless_agent-0.1.0/risk_metrics.py +147 -0
  26. falcon_limitless_agent-0.1.0/risk_time.py +69 -0
  27. falcon_limitless_agent-0.1.0/strategy_sync.py +41 -0
  28. falcon_limitless_agent-0.1.0/trade_executor.py +135 -0
  29. falcon_limitless_agent-0.1.0/trade_types.py +26 -0
  30. falcon_limitless_agent-0.1.0/version.py +3 -0
  31. falcon_limitless_agent-0.1.0/wallet.py +37 -0
  32. falcon_limitless_agent-0.1.0/web_ui/__init__.py +0 -0
  33. falcon_limitless_agent-0.1.0/web_ui/server.py +369 -0
  34. falcon_limitless_agent-0.1.0/ws_listener.py +161 -0
@@ -0,0 +1,18 @@
1
+ # Falcon Limitless Agent — copy to .env and fill in values
2
+ FALCON_API_KEY=
3
+ FALCON_WS_URL=wss://api.falconai.pro/ws/signals
4
+ FALCON_API_BASE=https://api.falconai.pro/api/v1/external/limitless
5
+ SIGNAL_PROVIDERS=limitless
6
+ DASHBOARD_PORT=8070
7
+ DRY_RUN=true
8
+ LOG_LEVEL=INFO
9
+
10
+ # Optional: local Limitless HMAC (otherwise store creds in Falcon dashboard)
11
+ LIMITLESS__API_KEY=
12
+ LIMITLESS__SECRET=
13
+ LIMITLESS__PROFILE_ID=
14
+
15
+ TRADING__BANKROLL_USD=1000
16
+ TRADING__MAX_POSITION_USD=50
17
+ TRADING__MAX_DAILY_SPEND_USD=200
18
+ TRADING__MAX_OPEN_POSITIONS=10
@@ -0,0 +1,61 @@
1
+ # ── Secrets — NEVER commit ────────────────────────────────────────────────────
2
+ .env
3
+ *.env
4
+ !.env.example
5
+ !backend/.env.example
6
+ secrets/
7
+ *.pem
8
+ *.key
9
+ *.p12
10
+
11
+ # ── Node / Backend ────────────────────────────────────────────────────────────
12
+ node_modules/
13
+ npm-debug.log*
14
+ yarn-debug.log*
15
+ yarn-error.log*
16
+ .npm
17
+ .yarn-integrity
18
+
19
+ # ── Frontend build ────────────────────────────────────────────────────────────
20
+ frontend/dist/
21
+ frontend/build/
22
+ frontend/.vite/
23
+
24
+ # ── Logs ──────────────────────────────────────────────────────────────────────
25
+ logs/
26
+ *.log
27
+
28
+ # ── Python (docs/polymarket-copier) ──────────────────────────────────────────
29
+ __pycache__/
30
+ *.py[cod]
31
+ *.pyo
32
+ .Python
33
+ packages/falcon-polymarket-python/dist/
34
+ packages/falcon-mcp-server/*.tgz
35
+ venv/
36
+ .venv/
37
+ env/
38
+
39
+ # ── IDE ───────────────────────────────────────────────────────────────────────
40
+ .vscode/
41
+ .idea/
42
+ *.swp
43
+ .DS_Store
44
+ Thumbs.db
45
+
46
+ # ── OS ───────────────────────────────────────────────────────────────────────
47
+ Thumbs.db
48
+ desktop.ini
49
+
50
+ # ── Test / coverage ───────────────────────────────────────────────────────────
51
+ coverage/
52
+ .nyc_output/
53
+ jest-results/
54
+
55
+ # ── Uploads & generated files ─────────────────────────────────────────────────
56
+ uploads/
57
+ generated/
58
+
59
+ # ── Cursor IDE workspace files ────────────────────────────────────────────────
60
+ .cursor/
61
+ *.cursor-*
@@ -0,0 +1,88 @@
1
+ Metadata-Version: 2.4
2
+ Name: falcon-limitless-agent
3
+ Version: 0.1.0
4
+ Summary: Autonomous Limitless Exchange agent — Falcon signals, HMAC execution via Falcon API
5
+ Project-URL: Homepage, https://app.falconai.pro
6
+ Project-URL: Agent setup (app), https://app.falconai.pro/app/limitless/agents/client
7
+ Author: Falcon AI
8
+ License-Expression: MIT
9
+ Keywords: falcon,limitless,prediction-markets,sports,trading-agent
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Financial and Insurance Industry
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Topic :: Office/Business :: Financial :: Investment
16
+ Requires-Python: >=3.11
17
+ Requires-Dist: colorlog<7,>=6.8
18
+ Requires-Dist: falcon-agent-webui>=0.1.0
19
+ Requires-Dist: flask-cors<6,>=4.0
20
+ Requires-Dist: flask<4,>=3.0
21
+ Requires-Dist: httpx<1,>=0.27
22
+ Requires-Dist: pydantic-settings<3,>=2.0
23
+ Requires-Dist: pydantic<3,>=2.0
24
+ Requires-Dist: python-dotenv<2,>=1.0
25
+ Requires-Dist: waitress<4,>=3.0
26
+ Requires-Dist: websockets<16,>=12.0
27
+ Provides-Extra: dev
28
+ Requires-Dist: build>=1.0; extra == 'dev'
29
+ Requires-Dist: hatchling>=1.24; extra == 'dev'
30
+ Requires-Dist: pytest<9,>=8.0; extra == 'dev'
31
+ Requires-Dist: twine>=5.0; extra == 'dev'
32
+ Description-Content-Type: text/markdown
33
+
34
+ # Falcon Limitless Agent
35
+
36
+ Desktop client for **Limitless Exchange** copy signals and live execution.
37
+
38
+ | | |
39
+ |---|---|
40
+ | Dashboard port | **8070** |
41
+ | WebSocket provider | `limitless` |
42
+ | Falcon API base | `/api/v1/external/limitless` |
43
+
44
+ ## What it does
45
+
46
+ 1. Subscribes to Falcon personal copy signals (`providers: ["limitless"]`)
47
+ 2. Applies bankroll, position-size, and daily-cap risk rules
48
+ 3. **Dry-run** (default) logs intended trades without placing orders
49
+ 4. **Live** posts orders via Falcon (`POST /orders`) using HMAC credentials stored in the Falcon app
50
+
51
+ ## Quick start
52
+
53
+ ```bash
54
+ cd client/falcon-limitless-client
55
+ python -m venv .venv
56
+ .venv\Scripts\activate # Windows
57
+ # source .venv/bin/activate # Mac/Linux
58
+ pip install -r requirements.txt
59
+ pip install -e .
60
+ copy .env.example .env # fill FALCON_API_KEY
61
+ falcon-limitless-agent-check
62
+ falcon-limitless-agent
63
+ ```
64
+
65
+ Or on Windows: `install.bat` → `check.bat` → `run.bat`
66
+
67
+ ## Configuration
68
+
69
+ | Variable | Description |
70
+ |----------|-------------|
71
+ | `FALCON_API_KEY` | Falcon agent API key (Integration → API keys) |
72
+ | `FALCON_WS_URL` | Signal WebSocket (default `wss://api.falconai.pro/ws/signals`) |
73
+ | `FALCON_API_BASE` | Agent SDK base URL |
74
+ | `SIGNAL_PROVIDERS` | `limitless` |
75
+ | `DRY_RUN` | `true` (default) or `false` for live |
76
+ | `DASHBOARD_PORT` | `8070` |
77
+
78
+ Store **Limitless HMAC** credentials at [/app/limitless/agents/client](https://app.falconai.pro/app/limitless/agents/client) before setting `DRY_RUN=false`.
79
+
80
+ See also: `docs/CLIENT-ENV-REFERENCE.md` and `/downloads/LIMITLESS-CLIENT-ENV-REFERENCE.md`.
81
+
82
+ ## PyPI
83
+
84
+ ```bash
85
+ pip install falcon-limitless-agent
86
+ falcon-limitless-agent-check
87
+ falcon-limitless-agent
88
+ ```
@@ -0,0 +1,55 @@
1
+ # Falcon Limitless Agent
2
+
3
+ Desktop client for **Limitless Exchange** copy signals and live execution.
4
+
5
+ | | |
6
+ |---|---|
7
+ | Dashboard port | **8070** |
8
+ | WebSocket provider | `limitless` |
9
+ | Falcon API base | `/api/v1/external/limitless` |
10
+
11
+ ## What it does
12
+
13
+ 1. Subscribes to Falcon personal copy signals (`providers: ["limitless"]`)
14
+ 2. Applies bankroll, position-size, and daily-cap risk rules
15
+ 3. **Dry-run** (default) logs intended trades without placing orders
16
+ 4. **Live** posts orders via Falcon (`POST /orders`) using HMAC credentials stored in the Falcon app
17
+
18
+ ## Quick start
19
+
20
+ ```bash
21
+ cd client/falcon-limitless-client
22
+ python -m venv .venv
23
+ .venv\Scripts\activate # Windows
24
+ # source .venv/bin/activate # Mac/Linux
25
+ pip install -r requirements.txt
26
+ pip install -e .
27
+ copy .env.example .env # fill FALCON_API_KEY
28
+ falcon-limitless-agent-check
29
+ falcon-limitless-agent
30
+ ```
31
+
32
+ Or on Windows: `install.bat` → `check.bat` → `run.bat`
33
+
34
+ ## Configuration
35
+
36
+ | Variable | Description |
37
+ |----------|-------------|
38
+ | `FALCON_API_KEY` | Falcon agent API key (Integration → API keys) |
39
+ | `FALCON_WS_URL` | Signal WebSocket (default `wss://api.falconai.pro/ws/signals`) |
40
+ | `FALCON_API_BASE` | Agent SDK base URL |
41
+ | `SIGNAL_PROVIDERS` | `limitless` |
42
+ | `DRY_RUN` | `true` (default) or `false` for live |
43
+ | `DASHBOARD_PORT` | `8070` |
44
+
45
+ Store **Limitless HMAC** credentials at [/app/limitless/agents/client](https://app.falconai.pro/app/limitless/agents/client) before setting `DRY_RUN=false`.
46
+
47
+ See also: `docs/CLIENT-ENV-REFERENCE.md` and `/downloads/LIMITLESS-CLIENT-ENV-REFERENCE.md`.
48
+
49
+ ## PyPI
50
+
51
+ ```bash
52
+ pip install falcon-limitless-agent
53
+ falcon-limitless-agent-check
54
+ falcon-limitless-agent
55
+ ```
@@ -0,0 +1,11 @@
1
+ """Ensure this agent's source directory wins import resolution when co-installed with falcon-polymarket-agent."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import sys
6
+ from pathlib import Path
7
+
8
+ _AGENT_ROOT = Path(__file__).resolve().parent
9
+ _ROOT = str(_AGENT_ROOT)
10
+ if _ROOT not in sys.path:
11
+ sys.path.insert(0, _ROOT)
@@ -0,0 +1,127 @@
1
+ """Limitless Exchange agent configuration."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, List, Literal
6
+
7
+ from dotenv import load_dotenv
8
+ from pydantic import Field, field_validator, model_validator
9
+ from pydantic_settings import BaseSettings, SettingsConfigDict
10
+
11
+ from paths import client_root
12
+
13
+ load_dotenv(client_root() / ".env", override=False)
14
+
15
+ MIN_ORDER_USD = 1.0
16
+
17
+ _RISK_PRESETS = {
18
+ "conservative": {"kelly_multiplier": 0.10, "max_bankroll_pct": 0.02},
19
+ "balanced": {"kelly_multiplier": 0.25, "max_bankroll_pct": 0.05},
20
+ "aggressive": {"kelly_multiplier": 0.50, "max_bankroll_pct": 0.10},
21
+ }
22
+
23
+
24
+ class LimitlessAgentConfig(BaseSettings):
25
+ model_config = SettingsConfigDict(
26
+ env_file=".env",
27
+ env_file_encoding="utf-8",
28
+ env_nested_delimiter="__",
29
+ case_sensitive=False,
30
+ extra="ignore",
31
+ )
32
+
33
+ falcon_api_key: str = ""
34
+ falcon_ws_url: str = "wss://api.falconai.pro/ws/signals"
35
+ falcon_api_base: str = "https://api.falconai.pro/api/v1/external/limitless"
36
+
37
+ limitless__api_key: str = Field("", description="Optional local Limitless HMAC key")
38
+ limitless__secret: str = Field("", description="Optional local Limitless HMAC secret (base64)")
39
+ limitless__profile_id: str = Field("", description="Limitless profile id for x-on-behalf-of")
40
+
41
+ signal_categories: str = ""
42
+ signal_types: str = ""
43
+ signal_providers: str = Field("limitless", description="WS provider filter")
44
+ sync_strategies_on_start: bool = False
45
+ signal_min_edge: float = Field(0.0, ge=0.0)
46
+ signal_min_confidence: float = Field(0.0, ge=0.0, le=1.0)
47
+
48
+ trading__bankroll_usd: float = 1000.0
49
+ trading__max_position_usd: float = 50.0
50
+ trading__max_daily_spend_usd: float = 200.0
51
+ trading__max_open_positions: int = 10
52
+ trading__max_drawdown_usd: float = Field(0.0, ge=0.0)
53
+ trading__max_drawdown_pct: float = Field(0.0, ge=0.0, le=100.0)
54
+ trading__drawdown_window_days: int = Field(7, ge=1, le=90)
55
+ trading__max_daily_loss_usd: float = Field(0.0, ge=0.0)
56
+ trading__max_trades_per_day: int = Field(0, ge=0)
57
+ trading__max_pending_exposure_usd: float = Field(0.0, ge=0.0)
58
+ trading__max_per_market_usd: float = Field(0.0, ge=0.0)
59
+ trading__one_position_per_market: bool = False
60
+ trading__category_daily_caps: str = Field("", description="e.g. sports:50")
61
+ trading__trading_hours_utc: str = Field("", description="e.g. 09:00-17:00")
62
+ trading__blackout_hours_utc: str = Field("")
63
+ trading__cooldown_minutes_after_loss: int = Field(0, ge=0)
64
+ trading__min_minutes_between_trades: int = Field(0, ge=0)
65
+
66
+ risk_level: Literal["conservative", "balanced", "aggressive"] = "balanced"
67
+ dry_run: bool = True
68
+ log_level: str = "INFO"
69
+ dashboard_port: int = 8070
70
+ report_stats_to_platform: bool = False
71
+
72
+ @model_validator(mode="before")
73
+ @classmethod
74
+ def _ignore_empty_env_strings(cls, data: Any) -> Any:
75
+ if isinstance(data, dict):
76
+ return {k: v for k, v in data.items() if not (isinstance(v, str) and v.strip() == "")}
77
+ return data
78
+
79
+ @field_validator("limitless__api_key", "limitless__secret", mode="before")
80
+ @classmethod
81
+ def _strip(cls, v: object) -> object:
82
+ return v.strip() if isinstance(v, str) else v
83
+
84
+ @property
85
+ def categories(self) -> List[str]:
86
+ raw = self.signal_categories.strip()
87
+ if not raw or raw.lower() == "all":
88
+ return []
89
+ return [c.strip() for c in raw.split(",") if c.strip()]
90
+
91
+ @property
92
+ def providers(self) -> List[str]:
93
+ raw = self.signal_providers.strip()
94
+ if not raw or raw.lower() == "all":
95
+ return []
96
+ return [p.strip() for p in raw.split(",") if p.strip()]
97
+
98
+ @property
99
+ def allowed_signal_types(self) -> List[str]:
100
+ raw = self.signal_types.strip()
101
+ if not raw:
102
+ return []
103
+ return [t.strip() for t in raw.split(",") if t.strip()]
104
+
105
+ @property
106
+ def kelly_multiplier(self) -> float:
107
+ return _RISK_PRESETS[self.risk_level]["kelly_multiplier"]
108
+
109
+ @property
110
+ def max_bankroll_pct(self) -> float:
111
+ return _RISK_PRESETS[self.risk_level]["max_bankroll_pct"]
112
+
113
+ @property
114
+ def category_daily_caps_map(self) -> dict:
115
+ from risk_metrics import parse_category_caps
116
+
117
+ return parse_category_caps(self.trading__category_daily_caps)
118
+
119
+
120
+ _cfg: LimitlessAgentConfig | None = None
121
+
122
+
123
+ def get_config() -> LimitlessAgentConfig:
124
+ global _cfg
125
+ if _cfg is None:
126
+ _cfg = LimitlessAgentConfig()
127
+ return _cfg
@@ -0,0 +1,25 @@
1
+ """Shared config helpers."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import re
6
+
7
+ _PLACEHOLDER_KEY = re.compile(
8
+ r"(REPLACE|your_|placeholder|changeme|xxx|test_key)",
9
+ re.I,
10
+ )
11
+
12
+
13
+ def is_placeholder_api_key(key: str) -> bool:
14
+ k = (key or "").strip()
15
+ if not k:
16
+ return True
17
+ if not (k.startswith("fai_") or k.startswith("aif_")):
18
+ return True
19
+ if _PLACEHOLDER_KEY.search(k):
20
+ return True
21
+ return len(k) < 12
22
+
23
+
24
+ def is_runnable_api_key(key: str) -> bool:
25
+ return not is_placeholder_api_key(key)
@@ -0,0 +1,42 @@
1
+ # Falcon Limitless Agent — environment reference
2
+
3
+ Copy `falcon-limitless-client.env.example` to `.env` in your client folder.
4
+
5
+ ## Required
6
+
7
+ | Variable | Example | Notes |
8
+ |----------|---------|-------|
9
+ | `FALCON_API_KEY` | `aif_…` | Claimed sandbox agent key or Integration API key |
10
+
11
+ ## Falcon platform
12
+
13
+ | Variable | Default | Notes |
14
+ |----------|---------|-------|
15
+ | `FALCON_WS_URL` | `wss://api.falconai.pro/ws/signals` | Personal copy signal stream |
16
+ | `FALCON_API_BASE` | `https://api.falconai.pro/api/v1/external/limitless` | Agent SDK |
17
+ | `SIGNAL_PROVIDERS` | `limitless` | WebSocket filter |
18
+ | `SIGNAL_CATEGORIES` | *(empty = all)* | Comma list, e.g. `sports` |
19
+ | `DASHBOARD_PORT` | `8070` | Local web UI |
20
+ | `DRY_RUN` | `true` | Set `false` only after preflight + HMAC creds in Falcon |
21
+
22
+ ## Risk limits
23
+
24
+ | Variable | Default |
25
+ |----------|---------|
26
+ | `TRADING__BANKROLL_USD` | `1000` |
27
+ | `TRADING__MAX_POSITION_USD` | `50` |
28
+ | `TRADING__MAX_DAILY_SPEND_USD` | `200` |
29
+ | `TRADING__MAX_OPEN_POSITIONS` | `10` |
30
+ | `RISK_LEVEL` | `balanced` (`conservative` / `aggressive`) |
31
+
32
+ ## Limitless credentials
33
+
34
+ Prefer storing HMAC in the Falcon dashboard. Optional local overrides:
35
+
36
+ | Variable | Notes |
37
+ |----------|-------|
38
+ | `LIMITLESS__API_KEY` | Limitless API key |
39
+ | `LIMITLESS__SECRET` | Base64 HMAC secret |
40
+ | `LIMITLESS__PROFILE_ID` | Profile for `x-on-behalf-of` |
41
+
42
+ Live orders use server-stored credentials via `POST /orders` on the Falcon Agent SDK.