tickerdb 0.2.0__tar.gz → 0.2.2__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.
- tickerdb-0.2.2/CHANGELOG.md +48 -0
- {tickerdb-0.2.0 → tickerdb-0.2.2}/PKG-INFO +33 -97
- {tickerdb-0.2.0 → tickerdb-0.2.2}/README.md +31 -96
- {tickerdb-0.2.0 → tickerdb-0.2.2}/examples/smoke_test.py +2 -5
- {tickerdb-0.2.0 → tickerdb-0.2.2}/pyproject.toml +1 -0
- {tickerdb-0.2.0 → tickerdb-0.2.2}/src/tickerdb/__init__.py +0 -22
- tickerdb-0.2.2/src/tickerdb/_endpoints.py +124 -0
- {tickerdb-0.2.0 → tickerdb-0.2.2}/src/tickerdb/_version.py +1 -1
- {tickerdb-0.2.0 → tickerdb-0.2.2}/src/tickerdb/async_client.py +0 -367
- {tickerdb-0.2.0 → tickerdb-0.2.2}/src/tickerdb/client.py +0 -359
- {tickerdb-0.2.0 → tickerdb-0.2.2}/src/tickerdb/types/__init__.py +0 -34
- {tickerdb-0.2.0 → tickerdb-0.2.2}/src/tickerdb/types/account.py +0 -2
- {tickerdb-0.2.0 → tickerdb-0.2.2}/src/tickerdb/types/summary.py +1 -2
- {tickerdb-0.2.0 → tickerdb-0.2.2}/tests/test_client.py +0 -16
- tickerdb-0.2.2/tests/test_endpoints.py +59 -0
- tickerdb-0.2.0/src/tickerdb/_endpoints.py +0 -282
- tickerdb-0.2.0/src/tickerdb/types/screeners.py +0 -64
- tickerdb-0.2.0/src/tickerdb/types/teams.py +0 -66
- tickerdb-0.2.0/src/tickerdb/types/webhooks.py +0 -31
- tickerdb-0.2.0/tests/test_endpoints.py +0 -111
- {tickerdb-0.2.0 → tickerdb-0.2.2}/.claude/settings.local.json +0 -0
- {tickerdb-0.2.0 → tickerdb-0.2.2}/.gitattributes +0 -0
- {tickerdb-0.2.0 → tickerdb-0.2.2}/.gitignore +0 -0
- {tickerdb-0.2.0 → tickerdb-0.2.2}/src/tickerdb/_transport.py +0 -0
- {tickerdb-0.2.0 → tickerdb-0.2.2}/src/tickerdb/exceptions.py +0 -0
- {tickerdb-0.2.0 → tickerdb-0.2.2}/src/tickerdb/py.typed +0 -0
- {tickerdb-0.2.0 → tickerdb-0.2.2}/src/tickerdb/query.py +0 -0
- {tickerdb-0.2.0 → tickerdb-0.2.2}/src/tickerdb/types/common.py +0 -0
- {tickerdb-0.2.0 → tickerdb-0.2.2}/src/tickerdb/types/ohlcv.py +0 -0
- {tickerdb-0.2.0 → tickerdb-0.2.2}/src/tickerdb/types/search.py +0 -0
- {tickerdb-0.2.0 → tickerdb-0.2.2}/tests/conftest.py +0 -0
- {tickerdb-0.2.0 → tickerdb-0.2.2}/tests/test_query.py +0 -0
- {tickerdb-0.2.0 → tickerdb-0.2.2}/tests/test_transport.py +0 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.2.0] - 2026-07-10
|
|
11
|
+
|
|
12
|
+
Full parity with the TickerDB `/v1` API plus an internal refactor. **No breaking
|
|
13
|
+
changes** — every existing method, argument, and the `{"data", "rate_limits"}`
|
|
14
|
+
result shape is unchanged, so upgrading from 0.1.x is drop-in.
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- `account()` — plan tier, limits, usage, and credit balance (does not consume
|
|
19
|
+
the monthly quota).
|
|
20
|
+
- `ohlcv()` and `iter_ohlcv()` — daily OHLCV bars (split/dividend-adjusted for
|
|
21
|
+
equities, unadjusted for crypto), cursor-paginated and credit-metered;
|
|
22
|
+
`iter_ohlcv()` streams every bar across pages.
|
|
23
|
+
- `search(date=...)` and a `.date()` method on the query builder for
|
|
24
|
+
point-in-time snapshot searches.
|
|
25
|
+
- `summary(offset=...)` for paging history/sample ranges.
|
|
26
|
+
- `InsufficientCreditsError` — raised by credit-metered calls (e.g. OHLCV) that
|
|
27
|
+
would exceed the account's credit balance. Subclasses `RateLimitError` and
|
|
28
|
+
carries `credits_required` / `credits_remaining`.
|
|
29
|
+
- Typed models for every new endpoint, exported from the package root.
|
|
30
|
+
- Test suite (pytest, mocked transport), a read-only `examples/smoke_test.py`,
|
|
31
|
+
and a `dev` optional-dependencies group.
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
- Internal refactor (no user-facing impact): shared transport layer
|
|
36
|
+
(`_transport`), pure request builders (`_endpoints`), a unified
|
|
37
|
+
`BaseSearchQuery`, a `src/` layout, and a domain-split `types/` package.
|
|
38
|
+
- Version is now a single source of truth in `_version.py`, read dynamically by
|
|
39
|
+
the build backend; the `User-Agent` header derives from it.
|
|
40
|
+
|
|
41
|
+
## [0.1.18] and earlier
|
|
42
|
+
|
|
43
|
+
See the [git history](https://github.com/tickerdb/tickerdb-python/commits/main)
|
|
44
|
+
and [PyPI release history](https://pypi.org/project/tickerdb/#history) for
|
|
45
|
+
releases prior to this changelog.
|
|
46
|
+
|
|
47
|
+
[Unreleased]: https://github.com/tickerdb/tickerdb-python/compare/v0.2.0...HEAD
|
|
48
|
+
[0.2.0]: https://github.com/tickerdb/tickerdb-python/compare/v0.1.18...v0.2.0
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tickerdb
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Connect your agent to pre-computed market context that improves reasoning and reduces token usage.
|
|
5
5
|
Project-URL: Homepage, https://tickerdb.com
|
|
6
6
|
Project-URL: Documentation, https://tickerdb.com/docs
|
|
7
7
|
Project-URL: Repository, https://github.com/tickerdb/tickerdb-python
|
|
8
|
+
Project-URL: Changelog, https://github.com/tickerdb/tickerdb-python/blob/main/CHANGELOG.md
|
|
8
9
|
Project-URL: Issues, https://github.com/tickerdb/tickerdb-python/issues
|
|
9
10
|
Author-email: TickerDB <support@tickerdb.com>
|
|
10
11
|
License-Expression: MIT
|
|
@@ -30,17 +31,18 @@ Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
|
30
31
|
Requires-Dist: ruff>=0.1; extra == 'dev'
|
|
31
32
|
Description-Content-Type: text/markdown
|
|
32
33
|
|
|
33
|
-
# TickerDB -
|
|
34
|
+
# TickerDB - Pre-computed market data for agents.
|
|
34
35
|
|
|
35
36
|
[](https://pypi.org/project/tickerdb/)
|
|
36
37
|
[](https://pypi.org/project/tickerdb/)
|
|
37
38
|
|
|
38
|
-
Connect your agent to
|
|
39
|
+
Connect your agent to hundreds of indicators like trend_direction, support_level, and analyst_consensus to improve reasoning and reduce token usage.
|
|
39
40
|
|
|
40
41
|
- Sync and async clients
|
|
41
42
|
- Full type hints for IDE autocompletion
|
|
42
43
|
- Typed exceptions for every error class
|
|
43
44
|
- Rate limit information on every response
|
|
45
|
+
- Covers the full v1 API: summaries, search, and OHLCV
|
|
44
46
|
|
|
45
47
|
**Full API documentation:** [https://tickerdb.com/docs](https://tickerdb.com/docs)
|
|
46
48
|
|
|
@@ -178,42 +180,11 @@ result = client.summary(
|
|
|
178
180
|
print(result["data"]["stats"])
|
|
179
181
|
```
|
|
180
182
|
|
|
181
|
-
### Watchlist
|
|
182
|
-
|
|
183
|
-
Get the saved watchlist snapshot for the authenticated account.
|
|
184
|
-
|
|
185
|
-
```python
|
|
186
|
-
result = client.watchlist()
|
|
187
|
-
print(result["data"]["as_of_date"])
|
|
188
|
-
result = client.watchlist(date="2025-01-15")
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
Add tickers to the saved watchlist:
|
|
192
|
-
|
|
193
|
-
```python
|
|
194
|
-
result = client.add_to_watchlist(["AAPL", "MSFT", "TSLA"])
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
Remove tickers from the saved watchlist:
|
|
198
|
-
|
|
199
|
-
```python
|
|
200
|
-
result = client.remove_from_watchlist(["TSLA"])
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
### Watchlist Changes
|
|
204
|
-
|
|
205
|
-
Get field-level state changes for your saved watchlist tickers since the last pipeline run.
|
|
206
|
-
|
|
207
|
-
```python
|
|
208
|
-
result = client.watchlist_changes()
|
|
209
|
-
result = client.watchlist_changes(timeframe="weekly")
|
|
210
|
-
```
|
|
211
|
-
|
|
212
183
|
### Band Stability Metadata
|
|
213
184
|
|
|
214
185
|
Summary omits sibling `_meta` objects by default so the primary band label stays front-and-center. Set `meta=True` to include full paid-tier stability metadata across the response, or request just the few `*_meta` fields you need via `fields`.
|
|
215
186
|
|
|
216
|
-
Summary
|
|
187
|
+
Summary responses also include `as_of_date` so you can tell which market session the snapshot represents.
|
|
217
188
|
|
|
218
189
|
```python
|
|
219
190
|
result = client.summary("AAPL", meta=True)
|
|
@@ -232,8 +203,6 @@ from tickerdb import Stability, BandMeta
|
|
|
232
203
|
|
|
233
204
|
`Stability` is one of `"fresh"`, `"holding"`, `"established"`, or `"volatile"`. `BandMeta` contains the full metadata dict. Stability metadata is available on Plus and Pro tiers only.
|
|
234
205
|
|
|
235
|
-
Stability context also appears in **Watchlist**, which still includes paid-tier `_meta` objects by default, and in **Watchlist Changes**, which include stability fields inline for each changed band.
|
|
236
|
-
|
|
237
206
|
### Query Builder
|
|
238
207
|
|
|
239
208
|
The SDK includes a fluent query builder for searching assets by categorical state. Chain methods in order: select, filters, sort, limit.
|
|
@@ -281,66 +250,6 @@ for bar in client.iter_ohlcv("AAPL", start="2025-01-01"):
|
|
|
281
250
|
|
|
282
251
|
If a request would exceed your credit balance, `InsufficientCreditsError` is raised with `credits_required` and `credits_remaining` attributes.
|
|
283
252
|
|
|
284
|
-
### Screeners
|
|
285
|
-
|
|
286
|
-
List, create, update, and delete saved screeners. Built-in "default" screeners and your saved "custom" screeners are returned together.
|
|
287
|
-
|
|
288
|
-
```python
|
|
289
|
-
result = client.list_screeners()
|
|
290
|
-
print(result["data"]["screeners"])
|
|
291
|
-
|
|
292
|
-
created = client.create_screener(
|
|
293
|
-
name="Oversold tech",
|
|
294
|
-
filters=[
|
|
295
|
-
{"field": "momentum_rsi_zone", "op": "in", "value": ["deep_oversold", "oversold"]},
|
|
296
|
-
{"field": "sector", "op": "eq", "value": "Technology"},
|
|
297
|
-
],
|
|
298
|
-
sort={"field": "market_cap", "direction": "desc"},
|
|
299
|
-
)
|
|
300
|
-
screener_id = created["data"]["screener"]["id"]
|
|
301
|
-
|
|
302
|
-
client.update_screener(screener_id, name="Oversold tech (updated)")
|
|
303
|
-
client.delete_screener(screener_id) # delete a custom screener
|
|
304
|
-
client.delete_screener("oversold", kind="default") # hide a built-in screener
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
Filters support value operators (`eq`, `neq`, `in`, `gt`, `gte`, `lt`, `lte`, `exists`) and change filters (`{"type": "change", "field": ..., "from": ..., "to": ...}`).
|
|
308
|
-
|
|
309
|
-
### Webhooks
|
|
310
|
-
|
|
311
|
-
Manage webhooks and inspect their delivery history.
|
|
312
|
-
|
|
313
|
-
```python
|
|
314
|
-
hooks = client.list_webhooks()
|
|
315
|
-
created = client.create_webhook("https://example.com/hook", events={"daily": True})
|
|
316
|
-
webhook_id = created["data"]["id"]
|
|
317
|
-
|
|
318
|
-
client.update_webhook(webhook_id, active=False)
|
|
319
|
-
client.delete_webhook(webhook_id)
|
|
320
|
-
|
|
321
|
-
# Recent delivery attempts (status, retries, HTTP status, errors)
|
|
322
|
-
deliveries = client.webhook_deliveries(limit=20)
|
|
323
|
-
deliveries = client.webhook_deliveries(webhook_id=webhook_id)
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
### Teams
|
|
327
|
-
|
|
328
|
-
View teams and manage members (most write actions require a business plan and owner/admin role).
|
|
329
|
-
|
|
330
|
-
```python
|
|
331
|
-
teams = client.get_teams()
|
|
332
|
-
|
|
333
|
-
team_id = client.create_team("Research")["data"]["team"]["id"]
|
|
334
|
-
client.invite_member(team_id, "analyst@example.com", role="member")
|
|
335
|
-
client.promote_member(team_id, user_id, role="admin")
|
|
336
|
-
client.set_seats(team_id, total_seats=10)
|
|
337
|
-
client.rename_team(team_id, "Research & Strategy")
|
|
338
|
-
|
|
339
|
-
# Also: remove_member, cancel_invite, resend_invite, leave_team
|
|
340
|
-
```
|
|
341
|
-
|
|
342
|
-
All team methods are also available on `AsyncTickerDB` with `await`.
|
|
343
|
-
|
|
344
253
|
## Error Handling
|
|
345
254
|
|
|
346
255
|
The SDK raises typed exceptions for all API errors:
|
|
@@ -392,6 +301,33 @@ print(limits["hourly_request_limit"]) # Hourly limit
|
|
|
392
301
|
print(limits["hourly_requests_remaining"]) # Hourly remaining
|
|
393
302
|
```
|
|
394
303
|
|
|
304
|
+
## Development
|
|
305
|
+
|
|
306
|
+
Requires Python 3.8+.
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
git clone https://github.com/tickerdb/tickerdb-python
|
|
310
|
+
cd tickerdb-python
|
|
311
|
+
|
|
312
|
+
python -m venv .venv
|
|
313
|
+
source .venv/bin/activate # Windows (PowerShell): .venv\Scripts\Activate.ps1
|
|
314
|
+
|
|
315
|
+
pip install -e ".[dev]" # editable install + dev tools
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
Run the checks (no API key required — the suite uses a mocked transport):
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
pytest
|
|
322
|
+
ruff check src tests
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
`examples/smoke_test.py` runs a read-only check against the live API using your key:
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
TICKERDB_API_KEY=tdb_your_key python examples/smoke_test.py
|
|
329
|
+
```
|
|
330
|
+
|
|
395
331
|
## Links
|
|
396
332
|
|
|
397
333
|
- [TickerDB Website](https://tickerdb.com)
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
# TickerDB -
|
|
1
|
+
# TickerDB - Pre-computed market data for agents.
|
|
2
2
|
|
|
3
3
|
[](https://pypi.org/project/tickerdb/)
|
|
4
4
|
[](https://pypi.org/project/tickerdb/)
|
|
5
5
|
|
|
6
|
-
Connect your agent to
|
|
6
|
+
Connect your agent to hundreds of indicators like trend_direction, support_level, and analyst_consensus to improve reasoning and reduce token usage.
|
|
7
7
|
|
|
8
8
|
- Sync and async clients
|
|
9
9
|
- Full type hints for IDE autocompletion
|
|
10
10
|
- Typed exceptions for every error class
|
|
11
11
|
- Rate limit information on every response
|
|
12
|
+
- Covers the full v1 API: summaries, search, and OHLCV
|
|
12
13
|
|
|
13
14
|
**Full API documentation:** [https://tickerdb.com/docs](https://tickerdb.com/docs)
|
|
14
15
|
|
|
@@ -146,42 +147,11 @@ result = client.summary(
|
|
|
146
147
|
print(result["data"]["stats"])
|
|
147
148
|
```
|
|
148
149
|
|
|
149
|
-
### Watchlist
|
|
150
|
-
|
|
151
|
-
Get the saved watchlist snapshot for the authenticated account.
|
|
152
|
-
|
|
153
|
-
```python
|
|
154
|
-
result = client.watchlist()
|
|
155
|
-
print(result["data"]["as_of_date"])
|
|
156
|
-
result = client.watchlist(date="2025-01-15")
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
Add tickers to the saved watchlist:
|
|
160
|
-
|
|
161
|
-
```python
|
|
162
|
-
result = client.add_to_watchlist(["AAPL", "MSFT", "TSLA"])
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
Remove tickers from the saved watchlist:
|
|
166
|
-
|
|
167
|
-
```python
|
|
168
|
-
result = client.remove_from_watchlist(["TSLA"])
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
### Watchlist Changes
|
|
172
|
-
|
|
173
|
-
Get field-level state changes for your saved watchlist tickers since the last pipeline run.
|
|
174
|
-
|
|
175
|
-
```python
|
|
176
|
-
result = client.watchlist_changes()
|
|
177
|
-
result = client.watchlist_changes(timeframe="weekly")
|
|
178
|
-
```
|
|
179
|
-
|
|
180
150
|
### Band Stability Metadata
|
|
181
151
|
|
|
182
152
|
Summary omits sibling `_meta` objects by default so the primary band label stays front-and-center. Set `meta=True` to include full paid-tier stability metadata across the response, or request just the few `*_meta` fields you need via `fields`.
|
|
183
153
|
|
|
184
|
-
Summary
|
|
154
|
+
Summary responses also include `as_of_date` so you can tell which market session the snapshot represents.
|
|
185
155
|
|
|
186
156
|
```python
|
|
187
157
|
result = client.summary("AAPL", meta=True)
|
|
@@ -200,8 +170,6 @@ from tickerdb import Stability, BandMeta
|
|
|
200
170
|
|
|
201
171
|
`Stability` is one of `"fresh"`, `"holding"`, `"established"`, or `"volatile"`. `BandMeta` contains the full metadata dict. Stability metadata is available on Plus and Pro tiers only.
|
|
202
172
|
|
|
203
|
-
Stability context also appears in **Watchlist**, which still includes paid-tier `_meta` objects by default, and in **Watchlist Changes**, which include stability fields inline for each changed band.
|
|
204
|
-
|
|
205
173
|
### Query Builder
|
|
206
174
|
|
|
207
175
|
The SDK includes a fluent query builder for searching assets by categorical state. Chain methods in order: select, filters, sort, limit.
|
|
@@ -249,66 +217,6 @@ for bar in client.iter_ohlcv("AAPL", start="2025-01-01"):
|
|
|
249
217
|
|
|
250
218
|
If a request would exceed your credit balance, `InsufficientCreditsError` is raised with `credits_required` and `credits_remaining` attributes.
|
|
251
219
|
|
|
252
|
-
### Screeners
|
|
253
|
-
|
|
254
|
-
List, create, update, and delete saved screeners. Built-in "default" screeners and your saved "custom" screeners are returned together.
|
|
255
|
-
|
|
256
|
-
```python
|
|
257
|
-
result = client.list_screeners()
|
|
258
|
-
print(result["data"]["screeners"])
|
|
259
|
-
|
|
260
|
-
created = client.create_screener(
|
|
261
|
-
name="Oversold tech",
|
|
262
|
-
filters=[
|
|
263
|
-
{"field": "momentum_rsi_zone", "op": "in", "value": ["deep_oversold", "oversold"]},
|
|
264
|
-
{"field": "sector", "op": "eq", "value": "Technology"},
|
|
265
|
-
],
|
|
266
|
-
sort={"field": "market_cap", "direction": "desc"},
|
|
267
|
-
)
|
|
268
|
-
screener_id = created["data"]["screener"]["id"]
|
|
269
|
-
|
|
270
|
-
client.update_screener(screener_id, name="Oversold tech (updated)")
|
|
271
|
-
client.delete_screener(screener_id) # delete a custom screener
|
|
272
|
-
client.delete_screener("oversold", kind="default") # hide a built-in screener
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
Filters support value operators (`eq`, `neq`, `in`, `gt`, `gte`, `lt`, `lte`, `exists`) and change filters (`{"type": "change", "field": ..., "from": ..., "to": ...}`).
|
|
276
|
-
|
|
277
|
-
### Webhooks
|
|
278
|
-
|
|
279
|
-
Manage webhooks and inspect their delivery history.
|
|
280
|
-
|
|
281
|
-
```python
|
|
282
|
-
hooks = client.list_webhooks()
|
|
283
|
-
created = client.create_webhook("https://example.com/hook", events={"daily": True})
|
|
284
|
-
webhook_id = created["data"]["id"]
|
|
285
|
-
|
|
286
|
-
client.update_webhook(webhook_id, active=False)
|
|
287
|
-
client.delete_webhook(webhook_id)
|
|
288
|
-
|
|
289
|
-
# Recent delivery attempts (status, retries, HTTP status, errors)
|
|
290
|
-
deliveries = client.webhook_deliveries(limit=20)
|
|
291
|
-
deliveries = client.webhook_deliveries(webhook_id=webhook_id)
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
### Teams
|
|
295
|
-
|
|
296
|
-
View teams and manage members (most write actions require a business plan and owner/admin role).
|
|
297
|
-
|
|
298
|
-
```python
|
|
299
|
-
teams = client.get_teams()
|
|
300
|
-
|
|
301
|
-
team_id = client.create_team("Research")["data"]["team"]["id"]
|
|
302
|
-
client.invite_member(team_id, "analyst@example.com", role="member")
|
|
303
|
-
client.promote_member(team_id, user_id, role="admin")
|
|
304
|
-
client.set_seats(team_id, total_seats=10)
|
|
305
|
-
client.rename_team(team_id, "Research & Strategy")
|
|
306
|
-
|
|
307
|
-
# Also: remove_member, cancel_invite, resend_invite, leave_team
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
All team methods are also available on `AsyncTickerDB` with `await`.
|
|
311
|
-
|
|
312
220
|
## Error Handling
|
|
313
221
|
|
|
314
222
|
The SDK raises typed exceptions for all API errors:
|
|
@@ -360,6 +268,33 @@ print(limits["hourly_request_limit"]) # Hourly limit
|
|
|
360
268
|
print(limits["hourly_requests_remaining"]) # Hourly remaining
|
|
361
269
|
```
|
|
362
270
|
|
|
271
|
+
## Development
|
|
272
|
+
|
|
273
|
+
Requires Python 3.8+.
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
git clone https://github.com/tickerdb/tickerdb-python
|
|
277
|
+
cd tickerdb-python
|
|
278
|
+
|
|
279
|
+
python -m venv .venv
|
|
280
|
+
source .venv/bin/activate # Windows (PowerShell): .venv\Scripts\Activate.ps1
|
|
281
|
+
|
|
282
|
+
pip install -e ".[dev]" # editable install + dev tools
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Run the checks (no API key required — the suite uses a mocked transport):
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
pytest
|
|
289
|
+
ruff check src tests
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
`examples/smoke_test.py` runs a read-only check against the live API using your key:
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
TICKERDB_API_KEY=tdb_your_key python examples/smoke_test.py
|
|
296
|
+
```
|
|
297
|
+
|
|
363
298
|
## Links
|
|
364
299
|
|
|
365
300
|
- [TickerDB Website](https://tickerdb.com)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"""Read-only smoke test against the live TickerDB API.
|
|
2
2
|
|
|
3
3
|
Exercises the main read endpoints with a real API key so you can confirm the
|
|
4
|
-
SDK talks to production correctly. It performs no writes
|
|
5
|
-
|
|
4
|
+
SDK talks to production correctly. It performs no writes, so it is safe to
|
|
5
|
+
run against any account.
|
|
6
6
|
|
|
7
7
|
Usage::
|
|
8
8
|
|
|
@@ -52,9 +52,6 @@ def main() -> int:
|
|
|
52
52
|
bars = client.ohlcv(ticker, limit=5)["data"].get("bars", [])
|
|
53
53
|
print(f"ohlcv : {len(bars)} bars, latest close="
|
|
54
54
|
f"{bars[0]['close'] if bars else 'n/a'}")
|
|
55
|
-
|
|
56
|
-
wl = client.watchlist()["data"]
|
|
57
|
-
print(f"watchlist: as_of={wl.get('as_of_date')}")
|
|
58
55
|
except TickerDBError as e:
|
|
59
56
|
print(f"\nAPI error [{e.status_code}] {e.error_type}: {e.message}")
|
|
60
57
|
return 1
|
|
@@ -49,6 +49,7 @@ dev = [
|
|
|
49
49
|
Homepage = "https://tickerdb.com"
|
|
50
50
|
Documentation = "https://tickerdb.com/docs"
|
|
51
51
|
Repository = "https://github.com/tickerdb/tickerdb-python"
|
|
52
|
+
Changelog = "https://github.com/tickerdb/tickerdb-python/blob/main/CHANGELOG.md"
|
|
52
53
|
Issues = "https://github.com/tickerdb/tickerdb-python/issues"
|
|
53
54
|
|
|
54
55
|
[tool.pytest.ini_options]
|
|
@@ -40,20 +40,9 @@ from .types import (
|
|
|
40
40
|
OhlcvResponse,
|
|
41
41
|
RateLimits,
|
|
42
42
|
SchemaResponse,
|
|
43
|
-
Screener,
|
|
44
|
-
ScreenerFilter,
|
|
45
|
-
ScreenersResponse,
|
|
46
|
-
ScreenerSort,
|
|
47
43
|
SearchParams,
|
|
48
44
|
SearchResponse,
|
|
49
45
|
Stability,
|
|
50
|
-
Team,
|
|
51
|
-
TeamInvite,
|
|
52
|
-
TeamMember,
|
|
53
|
-
TeamPendingInvite,
|
|
54
|
-
TeamsResponse,
|
|
55
|
-
WebhookDeliveriesResponse,
|
|
56
|
-
WebhookDelivery,
|
|
57
46
|
)
|
|
58
47
|
|
|
59
48
|
__all__ = [
|
|
@@ -80,19 +69,8 @@ __all__ = [
|
|
|
80
69
|
"OhlcvResponse",
|
|
81
70
|
"RateLimits",
|
|
82
71
|
"SchemaResponse",
|
|
83
|
-
"Screener",
|
|
84
|
-
"ScreenerFilter",
|
|
85
|
-
"ScreenersResponse",
|
|
86
|
-
"ScreenerSort",
|
|
87
72
|
"SearchParams",
|
|
88
73
|
"SearchResponse",
|
|
89
74
|
"Stability",
|
|
90
|
-
"Team",
|
|
91
|
-
"TeamInvite",
|
|
92
|
-
"TeamMember",
|
|
93
|
-
"TeamPendingInvite",
|
|
94
|
-
"TeamsResponse",
|
|
95
|
-
"WebhookDeliveriesResponse",
|
|
96
|
-
"WebhookDelivery",
|
|
97
75
|
"__version__",
|
|
98
76
|
]
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"""Pure request builders for the TickerDB API.
|
|
2
|
+
|
|
3
|
+
Each function assembles the path, query params, and/or JSON body for one
|
|
4
|
+
endpoint and returns a :class:`RequestSpec`. They perform no I/O and are shared
|
|
5
|
+
by both the sync and async clients, so request shaping lives in exactly one
|
|
6
|
+
place. ``None`` query params are dropped later by the transport layer.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import json
|
|
10
|
+
from typing import Any, Dict, List, Optional
|
|
11
|
+
|
|
12
|
+
from ._transport import RequestSpec
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# ---------------------------------------------------------------------------
|
|
16
|
+
# Summary / search / schema
|
|
17
|
+
# ---------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def summary(
|
|
21
|
+
ticker: str,
|
|
22
|
+
*,
|
|
23
|
+
timeframe: Optional[str] = None,
|
|
24
|
+
date: Optional[str] = None,
|
|
25
|
+
start: Optional[str] = None,
|
|
26
|
+
end: Optional[str] = None,
|
|
27
|
+
fields: Optional[List[str]] = None,
|
|
28
|
+
meta: Optional[bool] = None,
|
|
29
|
+
sample: Optional[str] = None,
|
|
30
|
+
field: Optional[str] = None,
|
|
31
|
+
band: Optional[str] = None,
|
|
32
|
+
limit: Optional[int] = None,
|
|
33
|
+
offset: Optional[int] = None,
|
|
34
|
+
before: Optional[str] = None,
|
|
35
|
+
after: Optional[str] = None,
|
|
36
|
+
stats: Optional[bool] = None,
|
|
37
|
+
context_ticker: Optional[str] = None,
|
|
38
|
+
context_field: Optional[str] = None,
|
|
39
|
+
context_band: Optional[str] = None,
|
|
40
|
+
) -> RequestSpec:
|
|
41
|
+
params: Dict[str, Any] = {
|
|
42
|
+
"timeframe": timeframe,
|
|
43
|
+
"date": date,
|
|
44
|
+
"start": start,
|
|
45
|
+
"end": end,
|
|
46
|
+
"sample": sample,
|
|
47
|
+
"field": field,
|
|
48
|
+
"band": band,
|
|
49
|
+
"limit": limit,
|
|
50
|
+
"offset": offset,
|
|
51
|
+
"before": before,
|
|
52
|
+
"after": after,
|
|
53
|
+
"stats": "true" if stats else None,
|
|
54
|
+
"context_ticker": context_ticker,
|
|
55
|
+
"context_field": context_field,
|
|
56
|
+
"context_band": context_band,
|
|
57
|
+
}
|
|
58
|
+
if fields is not None:
|
|
59
|
+
params["fields"] = json.dumps(fields)
|
|
60
|
+
if meta is not None:
|
|
61
|
+
params["meta"] = "true" if meta else "false"
|
|
62
|
+
return RequestSpec("GET", f"/summary/{ticker}", params=params)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def search(
|
|
66
|
+
*,
|
|
67
|
+
filters: Optional[List[Dict[str, Any]]] = None,
|
|
68
|
+
timeframe: Optional[str] = None,
|
|
69
|
+
date: Optional[str] = None,
|
|
70
|
+
limit: Optional[int] = None,
|
|
71
|
+
offset: Optional[int] = None,
|
|
72
|
+
fields: Optional[List[str]] = None,
|
|
73
|
+
sort_by: Optional[str] = None,
|
|
74
|
+
sort_direction: Optional[str] = None,
|
|
75
|
+
) -> RequestSpec:
|
|
76
|
+
params: Dict[str, Any] = {
|
|
77
|
+
"timeframe": timeframe,
|
|
78
|
+
"date": date,
|
|
79
|
+
"limit": limit,
|
|
80
|
+
"offset": offset,
|
|
81
|
+
"sort_by": sort_by,
|
|
82
|
+
"sort_direction": sort_direction,
|
|
83
|
+
}
|
|
84
|
+
if filters is not None:
|
|
85
|
+
params["filters"] = json.dumps(filters)
|
|
86
|
+
if fields is not None:
|
|
87
|
+
params["fields"] = json.dumps(fields)
|
|
88
|
+
return RequestSpec("GET", "/search", params=params)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def schema() -> RequestSpec:
|
|
92
|
+
return RequestSpec("GET", "/schema/fields")
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
# ---------------------------------------------------------------------------
|
|
96
|
+
# Account / OHLCV
|
|
97
|
+
# ---------------------------------------------------------------------------
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def account() -> RequestSpec:
|
|
101
|
+
return RequestSpec("GET", "/account")
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def ohlcv(
|
|
105
|
+
ticker: str,
|
|
106
|
+
*,
|
|
107
|
+
start: Optional[str] = None,
|
|
108
|
+
end: Optional[str] = None,
|
|
109
|
+
cursor: Optional[str] = None,
|
|
110
|
+
order: Optional[str] = None,
|
|
111
|
+
limit: Optional[int] = None,
|
|
112
|
+
) -> RequestSpec:
|
|
113
|
+
return RequestSpec(
|
|
114
|
+
"GET",
|
|
115
|
+
f"/ohlcv/{ticker}",
|
|
116
|
+
params={
|
|
117
|
+
"start": start,
|
|
118
|
+
"end": end,
|
|
119
|
+
"cursor": cursor,
|
|
120
|
+
"order": order,
|
|
121
|
+
"limit": limit,
|
|
122
|
+
},
|
|
123
|
+
)
|
|
124
|
+
|