drazill 0.2.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.
- drazill-0.2.0/.gitignore +134 -0
- drazill-0.2.0/CHANGELOG.md +77 -0
- drazill-0.2.0/LICENSE +21 -0
- drazill-0.2.0/PKG-INFO +496 -0
- drazill-0.2.0/README.md +461 -0
- drazill-0.2.0/drazill/__init__.py +341 -0
- drazill-0.2.0/drazill/_client.py +470 -0
- drazill-0.2.0/drazill/_errors.py +64 -0
- drazill-0.2.0/drazill/_pagination.py +166 -0
- drazill-0.2.0/drazill/_websocket.py +195 -0
- drazill-0.2.0/drazill/py.typed +0 -0
- drazill-0.2.0/drazill/resources/__init__.py +203 -0
- drazill-0.2.0/drazill/resources/activity.py +60 -0
- drazill-0.2.0/drazill/resources/api_keys.py +128 -0
- drazill-0.2.0/drazill/resources/auth.py +72 -0
- drazill-0.2.0/drazill/resources/bracket_orders.py +100 -0
- drazill-0.2.0/drazill/resources/calendar.py +38 -0
- drazill-0.2.0/drazill/resources/chat.py +238 -0
- drazill-0.2.0/drazill/resources/comments.py +266 -0
- drazill-0.2.0/drazill/resources/compliance.py +264 -0
- drazill-0.2.0/drazill/resources/conditional_orders.py +138 -0
- drazill-0.2.0/drazill/resources/contests.py +128 -0
- drazill-0.2.0/drazill/resources/copy_trades.py +262 -0
- drazill-0.2.0/drazill/resources/crypto.py +182 -0
- drazill-0.2.0/drazill/resources/data_dictionary.py +34 -0
- drazill-0.2.0/drazill/resources/data_exports.py +258 -0
- drazill-0.2.0/drazill/resources/developers.py +72 -0
- drazill-0.2.0/drazill/resources/disputes.py +140 -0
- drazill-0.2.0/drazill/resources/enterprise.py +504 -0
- drazill-0.2.0/drazill/resources/events.py +84 -0
- drazill-0.2.0/drazill/resources/feature_flags.py +48 -0
- drazill-0.2.0/drazill/resources/fees.py +50 -0
- drazill-0.2.0/drazill/resources/geo.py +50 -0
- drazill-0.2.0/drazill/resources/giveaway.py +68 -0
- drazill-0.2.0/drazill/resources/health.py +82 -0
- drazill-0.2.0/drazill/resources/hubs.py +50 -0
- drazill-0.2.0/drazill/resources/info.py +34 -0
- drazill-0.2.0/drazill/resources/institutional.py +116 -0
- drazill-0.2.0/drazill/resources/intelligence.py +184 -0
- drazill-0.2.0/drazill/resources/lessons.py +228 -0
- drazill-0.2.0/drazill/resources/live.py +36 -0
- drazill-0.2.0/drazill/resources/market_requests.py +70 -0
- drazill-0.2.0/drazill/resources/markets.py +1138 -0
- drazill-0.2.0/drazill/resources/me.py +408 -0
- drazill-0.2.0/drazill/resources/moderation.py +100 -0
- drazill-0.2.0/drazill/resources/news.py +48 -0
- drazill-0.2.0/drazill/resources/notifications.py +276 -0
- drazill-0.2.0/drazill/resources/openapi.py +50 -0
- drazill-0.2.0/drazill/resources/orders.py +476 -0
- drazill-0.2.0/drazill/resources/paper.py +230 -0
- drazill-0.2.0/drazill/resources/parlays.py +196 -0
- drazill-0.2.0/drazill/resources/portfolio.py +50 -0
- drazill-0.2.0/drazill/resources/price_alerts.py +108 -0
- drazill-0.2.0/drazill/resources/promos.py +74 -0
- drazill-0.2.0/drazill/resources/push.py +156 -0
- drazill-0.2.0/drazill/resources/qa_feedback.py +72 -0
- drazill-0.2.0/drazill/resources/rank.py +250 -0
- drazill-0.2.0/drazill/resources/referrals.py +108 -0
- drazill-0.2.0/drazill/resources/rewards.py +276 -0
- drazill-0.2.0/drazill/resources/risk_overlay.py +122 -0
- drazill-0.2.0/drazill/resources/search.py +72 -0
- drazill-0.2.0/drazill/resources/security.py +204 -0
- drazill-0.2.0/drazill/resources/series.py +34 -0
- drazill-0.2.0/drazill/resources/settings.py +34 -0
- drazill-0.2.0/drazill/resources/sports.py +318 -0
- drazill-0.2.0/drazill/resources/status.py +34 -0
- drazill-0.2.0/drazill/resources/taxonomy.py +66 -0
- drazill-0.2.0/drazill/resources/terminal.py +134 -0
- drazill-0.2.0/drazill/resources/trades.py +82 -0
- drazill-0.2.0/drazill/resources/trailing_stops.py +128 -0
- drazill-0.2.0/drazill/resources/twap_orders.py +140 -0
- drazill-0.2.0/drazill/resources/usage.py +58 -0
- drazill-0.2.0/drazill/resources/users.py +804 -0
- drazill-0.2.0/drazill/resources/waitlist.py +120 -0
- drazill-0.2.0/drazill/resources/wallet.py +766 -0
- drazill-0.2.0/drazill/resources/watchlist.py +136 -0
- drazill-0.2.0/drazill/resources/webhooks.py +292 -0
- drazill-0.2.0/drazill/types/__init__.py +22 -0
- drazill-0.2.0/drazill/types/common.py +49 -0
- drazill-0.2.0/drazill/types/models.py +11187 -0
- drazill-0.2.0/drazill/types/webhooks.py +23 -0
- drazill-0.2.0/drazill/webhooks.py +92 -0
- drazill-0.2.0/examples/quickstart_markets.py +87 -0
- drazill-0.2.0/examples/quickstart_trade.py +147 -0
- drazill-0.2.0/examples/webhooks.py +38 -0
- drazill-0.2.0/pyproject.toml +57 -0
- drazill-0.2.0/tests/__init__.py +0 -0
- drazill-0.2.0/tests/conftest.py +469 -0
- drazill-0.2.0/tests/test_base_url_resolution.py +107 -0
- drazill-0.2.0/tests/test_check_versions.py +47 -0
- drazill-0.2.0/tests/test_client.py +430 -0
- drazill-0.2.0/tests/test_contract_segments.py +60 -0
- drazill-0.2.0/tests/test_errors.py +223 -0
- drazill-0.2.0/tests/test_generator.py +90 -0
- drazill-0.2.0/tests/test_init.py +182 -0
- drazill-0.2.0/tests/test_pagination.py +297 -0
- drazill-0.2.0/tests/test_request_options.py +126 -0
- drazill-0.2.0/tests/test_resources.py +261 -0
- drazill-0.2.0/tests/test_resources_async.py +117 -0
- drazill-0.2.0/tests/test_webhooks.py +108 -0
- drazill-0.2.0/tests/test_websocket.py +301 -0
drazill-0.2.0/.gitignore
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# DRAZILL BACKEND - GITIGNORE
|
|
3
|
+
# =============================================================================
|
|
4
|
+
|
|
5
|
+
# Python
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.py[cod]
|
|
8
|
+
*$py.class
|
|
9
|
+
*.so
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
/lib/
|
|
18
|
+
/lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
|
|
27
|
+
# Virtual environments
|
|
28
|
+
venv/
|
|
29
|
+
ENV/
|
|
30
|
+
env/
|
|
31
|
+
.venv/
|
|
32
|
+
# ...but the sandbox RL environment package is source, not a virtualenv (DIW-10).
|
|
33
|
+
# Narrow to .py sources so build artifacts (__pycache__) stay ignored.
|
|
34
|
+
!app/services/ml/sandbox/env/
|
|
35
|
+
!app/services/ml/sandbox/env/*.py
|
|
36
|
+
|
|
37
|
+
# Testing
|
|
38
|
+
.pytest_cache/
|
|
39
|
+
.coverage
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
|
|
44
|
+
# IDEs
|
|
45
|
+
.idea/
|
|
46
|
+
.vscode/
|
|
47
|
+
*.swp
|
|
48
|
+
*.swo
|
|
49
|
+
*~
|
|
50
|
+
.project
|
|
51
|
+
.pydevproject
|
|
52
|
+
.settings/
|
|
53
|
+
|
|
54
|
+
# Generated multi-root Cursor workspace (machine-specific, churny worktree paths)
|
|
55
|
+
*.code-workspace
|
|
56
|
+
|
|
57
|
+
# Environment files
|
|
58
|
+
.env
|
|
59
|
+
.env.local
|
|
60
|
+
.env.*.local
|
|
61
|
+
*.env
|
|
62
|
+
*.env.*
|
|
63
|
+
*.env.bak
|
|
64
|
+
*.env.backup
|
|
65
|
+
*.env.backup.*
|
|
66
|
+
*.env.orig
|
|
67
|
+
*.env.save
|
|
68
|
+
*.env.tmp
|
|
69
|
+
*.env~
|
|
70
|
+
config.*.env
|
|
71
|
+
!config.example.env
|
|
72
|
+
!*.example.env
|
|
73
|
+
!*.env.example
|
|
74
|
+
.envrc
|
|
75
|
+
.envrc.*
|
|
76
|
+
|
|
77
|
+
# Infrastructure
|
|
78
|
+
infrastructure/config/*.env
|
|
79
|
+
!infrastructure/config/*.env.example
|
|
80
|
+
# DI-1: the staging ML enablement set is a reviewed, secret-free flags-only file
|
|
81
|
+
# (all ML_*_ENABLED booleans; no keys/secrets) that ops append to the staging env.
|
|
82
|
+
# Committed intentionally like scripts/ml/demo_flags.env.example — the `.env.example`
|
|
83
|
+
# suffix keeps it out of the tracked-private-env CI gate (scripts/ci/check_no_tracked_env.py).
|
|
84
|
+
!infrastructure/ml/staging_ml_flags.env.example
|
|
85
|
+
|
|
86
|
+
# AWS Key Pairs - NEVER commit these
|
|
87
|
+
*.pem
|
|
88
|
+
*.key
|
|
89
|
+
drazill-key.pem
|
|
90
|
+
|
|
91
|
+
# OS files
|
|
92
|
+
.DS_Store
|
|
93
|
+
Thumbs.db
|
|
94
|
+
|
|
95
|
+
# Database
|
|
96
|
+
*.db
|
|
97
|
+
*.sqlite
|
|
98
|
+
*.sqlite3
|
|
99
|
+
|
|
100
|
+
# Logs
|
|
101
|
+
*.log
|
|
102
|
+
logs/
|
|
103
|
+
|
|
104
|
+
# Local development
|
|
105
|
+
test.db
|
|
106
|
+
local.db
|
|
107
|
+
tmp/
|
|
108
|
+
|
|
109
|
+
# AWS artifacts
|
|
110
|
+
.aws-sam/
|
|
111
|
+
samconfig.toml
|
|
112
|
+
|
|
113
|
+
# Package files downloaded (macOS installers — never commit)
|
|
114
|
+
*.pkg
|
|
115
|
+
|
|
116
|
+
# SDK build artifacts
|
|
117
|
+
sdks/typescript/dist/
|
|
118
|
+
sdks/typescript/node_modules/
|
|
119
|
+
sdks/typescript/*.tgz
|
|
120
|
+
sdks/python/dist/
|
|
121
|
+
sdks/python/build/
|
|
122
|
+
sdks/python/*.egg-info/
|
|
123
|
+
|
|
124
|
+
# Local cold-start bootstrap state + logs (may contain operator emails) — never commit
|
|
125
|
+
.bootstrap-state/
|
|
126
|
+
|
|
127
|
+
# Redis dump written to CWD when a local redis-server saves
|
|
128
|
+
dump.rdb
|
|
129
|
+
|
|
130
|
+
# Fern AI-generated API examples — a build artifact the Fern CLI writes next to the
|
|
131
|
+
# spec (fern/openapi/) on `fern generate --docs` / `fern docs dev`. Regenerated each
|
|
132
|
+
# build; not a source of truth (the truth-first docs mandate authors examples via
|
|
133
|
+
# x-fern-examples). See fern/AGENTS.md and https://buildwithfern.com/learn/docs/ai-features/ai-examples
|
|
134
|
+
**/ai_examples_override.yml
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
- **The default API base URL is now staging** (`https://staging.drazill.com/api/v1`),
|
|
7
|
+
and the default realtime URL is `wss://staging.drazill.com/ws`. Production is
|
|
8
|
+
not yet a separate live environment; because a published package cannot be
|
|
9
|
+
recalled, an unconfigured client must not be able to start trading real money
|
|
10
|
+
on its own the day `api.drazill.com` goes live. Pass `base_url=` (or set
|
|
11
|
+
`DRAZILL_BASE_URL`) to target any other environment. The default moves to
|
|
12
|
+
production in the release that ships alongside it (DRA-922).
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- `DRAZILL_BASE_URL` / `DRAZILL_WS_URL` environment-variable overrides, resolved
|
|
16
|
+
as **explicit argument > environment variable > default**. `resolve_base_url`
|
|
17
|
+
and `DEFAULT_BASE_URL` are exported from the package root so callers can assert
|
|
18
|
+
which environment an unconfigured client resolves to (DRA-922).
|
|
19
|
+
- First-class pagination iterators, exported from the package root:
|
|
20
|
+
`iter_cursor`/`aiter_cursor` (the canonical signed-cursor scheme) and
|
|
21
|
+
`iter_offset`/`aiter_offset`. Pass a bound resource method and iterate items
|
|
22
|
+
in one line — `for trade in iter_cursor(client.trades.get_trades_cursor,
|
|
23
|
+
market_id=...)` (DX-21).
|
|
24
|
+
- `RequestOptions` for application-owned idempotency keys + per-request timeouts
|
|
25
|
+
on unsafe-verb methods (DX-23).
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
- Corrected the advertised API surface. The SDK covers **61 resource groups /
|
|
29
|
+
442 operations / 799 types** — the 0.2.0 notes and README said 41/319/458,
|
|
30
|
+
which rotted as the contract grew. The counts are now stamped into the README
|
|
31
|
+
by `sdks/generate_sdks.py` and kept honest by the SDK drift gate, so they can
|
|
32
|
+
no longer drift from the code (DX-19, DX-25).
|
|
33
|
+
|
|
34
|
+
## 0.2.0 (2026-06-01)
|
|
35
|
+
|
|
36
|
+
Full public API coverage. Resources and types are now generated from the
|
|
37
|
+
canonical OpenAPI contract (`docs/api/openapi.v1.json`) via
|
|
38
|
+
`sdks/generate_sdks.py`, keeping the SDK in lockstep with the backend.
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
- Complete coverage of the public API: **41 resource groups / 319 operations**
|
|
42
|
+
(previously 8 resources). New groups include disputes, moderation, rewards,
|
|
43
|
+
compliance, chat, copy-trading, lessons, market intelligence, paper trading,
|
|
44
|
+
sports, crypto, rank, parlays, conditional/bracket/TWAP/trailing-stop orders,
|
|
45
|
+
price alerts, referrals, api-keys, security, geo, fees, settings, and more.
|
|
46
|
+
- Pydantic models generated for every contract schema (458 types) under
|
|
47
|
+
`drazill.types.models`, re-exported from `drazill.types`.
|
|
48
|
+
- Multipart file upload support (e.g. `users.upload_avatar`,
|
|
49
|
+
`users.upload_background`).
|
|
50
|
+
- Query params on `POST`/`PATCH`/`PUT`/`DELETE` (e.g.
|
|
51
|
+
`orders.place_order(body, include_receipt=True)`).
|
|
52
|
+
|
|
53
|
+
### Changed (breaking)
|
|
54
|
+
- **Method names now mirror the API operation** (e.g. `markets.list()` →
|
|
55
|
+
`markets.list_markets()`, `markets.get(id)` → `markets.get_market(id)`,
|
|
56
|
+
`orders.create(...)` → `orders.place_order(body)`). See the README for the
|
|
57
|
+
naming convention and full examples.
|
|
58
|
+
- Request bodies are passed as a single positional argument (a typed model or a
|
|
59
|
+
`dict`) instead of keyword arguments.
|
|
60
|
+
- Query values keep their native types (numbers are no longer stringified);
|
|
61
|
+
enums and bools are coerced for transport.
|
|
62
|
+
- Removed per-resource `list_all()` iterators; paginate with the returned page
|
|
63
|
+
object (`page`/`pages`) or cursor endpoints (`*_cursor`).
|
|
64
|
+
|
|
65
|
+
## 0.1.0 (2026-03-06)
|
|
66
|
+
|
|
67
|
+
Initial release.
|
|
68
|
+
|
|
69
|
+
- Synchronous client (`DrazillClient`) and async client (`AsyncDrazillClient`)
|
|
70
|
+
- Full type safety with Pydantic models for all API responses
|
|
71
|
+
- Resource classes for Markets, Orders, Wallet, Users, Comments, Watchlist, and Notifications
|
|
72
|
+
- WebSocket client with auto-reconnect and channel subscriptions (requires `drazill[websocket]`)
|
|
73
|
+
- API key (`X-API-Key`) and Bearer token authentication
|
|
74
|
+
- Automatic retry with exponential backoff for 5xx and 429 errors
|
|
75
|
+
- Auto-pagination iterators via `list_all()` helpers (sync and async)
|
|
76
|
+
- Typed error classes: `ApiError`, `AuthenticationError`, `RateLimitError`, `ValidationError`, `NetworkError`
|
|
77
|
+
- `py.typed` marker for PEP 561 type checking support
|
drazill-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Drazill Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|