sharketo-sdk 0.1.14b3__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.
- sharketo_sdk-0.1.14b3/.claude-plugin/plugin.json +6 -0
- sharketo_sdk-0.1.14b3/LICENSE +21 -0
- sharketo_sdk-0.1.14b3/PKG-INFO +120 -0
- sharketo_sdk-0.1.14b3/PYPI_README.md +91 -0
- sharketo_sdk-0.1.14b3/hatch_build.py +15 -0
- sharketo_sdk-0.1.14b3/plugin.json +7 -0
- sharketo_sdk-0.1.14b3/pyproject.toml +62 -0
- sharketo_sdk-0.1.14b3/skills/sharketo-python/LICENSE +21 -0
- sharketo_sdk-0.1.14b3/skills/sharketo-python/SKILL.md +59 -0
- sharketo_sdk-0.1.14b3/skills/sharketo-python/references/crypto-inventory.md +140 -0
- sharketo_sdk-0.1.14b3/skills/sharketo-python/references/cta-flow.md +119 -0
- sharketo_sdk-0.1.14b3/skills/sharketo-python/references/daily-history.md +132 -0
- sharketo_sdk-0.1.14b3/skills/sharketo-python/references/dealer-exposures.md +208 -0
- sharketo_sdk-0.1.14b3/skills/sharketo-python/references/expiry-flow.md +138 -0
- sharketo_sdk-0.1.14b3/skills/sharketo-python/references/install.md +80 -0
- sharketo_sdk-0.1.14b3/skills/sharketo-python/references/integration.md +236 -0
- sharketo_sdk-0.1.14b3/skills/sharketo-python/references/inventory-rendering.md +126 -0
- sharketo_sdk-0.1.14b3/skills/sharketo-python/references/prices.md +122 -0
- sharketo_sdk-0.1.14b3/skills/sharketo-python/references/profiles.md +67 -0
- sharketo_sdk-0.1.14b3/skills/sharketo-python/references/rrg.md +43 -0
- sharketo_sdk-0.1.14b3/skills/sharketo-python/references/rrg_fixture.py +222 -0
- sharketo_sdk-0.1.14b3/skills/sharketo-python/references/sdk.md +110 -0
- sharketo_sdk-0.1.14b3/skills/sharketo-python/references/seasonality.md +187 -0
- sharketo_sdk-0.1.14b3/skills/sharketo-python/references/seasonality_asset_fixture.py +165 -0
- sharketo_sdk-0.1.14b3/skills/sharketo-python/references/setup.md +88 -0
- sharketo_sdk-0.1.14b3/skills/sharketo-python/references/volatility.md +57 -0
- sharketo_sdk-0.1.14b3/skills/sharketo-python/references/volatility_fixture.py +330 -0
- sharketo_sdk-0.1.14b3/skills/sharketo-python/references/workflow.md +23 -0
- sharketo_sdk-0.1.14b3/src/sharketo/__init__.py +174 -0
- sharketo_sdk-0.1.14b3/src/sharketo/_config.py +90 -0
- sharketo_sdk-0.1.14b3/src/sharketo/_crypto_inventory.py +107 -0
- sharketo_sdk-0.1.14b3/src/sharketo/_dealer_exposures.py +200 -0
- sharketo_sdk-0.1.14b3/src/sharketo/_expiry_flow.py +176 -0
- sharketo_sdk-0.1.14b3/src/sharketo/_generated.py +3803 -0
- sharketo_sdk-0.1.14b3/src/sharketo/_http.py +333 -0
- sharketo_sdk-0.1.14b3/src/sharketo/_inventory.py +372 -0
- sharketo_sdk-0.1.14b3/src/sharketo/_rrg.py +303 -0
- sharketo_sdk-0.1.14b3/src/sharketo/_stream.py +1054 -0
- sharketo_sdk-0.1.14b3/src/sharketo/_volatility.py +401 -0
- sharketo_sdk-0.1.14b3/src/sharketo/client.py +694 -0
- sharketo_sdk-0.1.14b3/src/sharketo/errors.py +78 -0
- sharketo_sdk-0.1.14b3/src/sharketo/models.py +1110 -0
- sharketo_sdk-0.1.14b3/src/sharketo/py.typed +0 -0
- sharketo_sdk-0.1.14b3/src/sharketo/quickstart.py +64 -0
- sharketo_sdk-0.1.14b3/src/sharketo/skills.py +185 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sharketo-python",
|
|
3
|
+
"version": "0.1.14b3",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "Python SDK integration, cache-only Dealer Exposures, bounded BTC/ETH current crypto exposure, prices, expiry flow, daily history, inventory rendering/exposure profiles and full-asset/compact Seasonality, curated Volatility/RRG and CTA Flow guidance; mock first, server-side credentials only."
|
|
6
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sharketo Market Intelligence
|
|
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.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: sharketo-sdk
|
|
3
|
+
Version: 0.1.14b3
|
|
4
|
+
Summary: Server-side Sharketo Python client for cache-only Dealer Exposures, BTC/ETH current crypto inventory, prices, Index Inventory, Seasonality, curated Volatility, RRG and CTA Flow
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Requires-Dist: httpx<1,>=0.28
|
|
9
|
+
Requires-Dist: pydantic<3,>=2.10
|
|
10
|
+
Requires-Dist: websockets<17,>=15
|
|
11
|
+
Provides-Extra: dashboard
|
|
12
|
+
Requires-Dist: altair<7,>=5.5; extra == 'dashboard'
|
|
13
|
+
Requires-Dist: streamlit<2,>=1.49; extra == 'dashboard'
|
|
14
|
+
Provides-Extra: dev
|
|
15
|
+
Requires-Dist: build<2,>=1.2; extra == 'dev'
|
|
16
|
+
Requires-Dist: datamodel-code-generator==0.53.0; extra == 'dev'
|
|
17
|
+
Requires-Dist: hatchling<2,>=1.27; extra == 'dev'
|
|
18
|
+
Requires-Dist: jsonschema<5,>=4.23; extra == 'dev'
|
|
19
|
+
Requires-Dist: mypy<2,>=1.15; extra == 'dev'
|
|
20
|
+
Requires-Dist: packaging<27,>=26.1; extra == 'dev'
|
|
21
|
+
Requires-Dist: pytest-asyncio<2,>=0.25; extra == 'dev'
|
|
22
|
+
Requires-Dist: pytest<10,>=8; extra == 'dev'
|
|
23
|
+
Requires-Dist: pyyaml<7,>=6; extra == 'dev'
|
|
24
|
+
Requires-Dist: ruff==0.16.10; extra == 'dev'
|
|
25
|
+
Requires-Dist: twine<8,>=7; extra == 'dev'
|
|
26
|
+
Provides-Extra: notebook
|
|
27
|
+
Requires-Dist: jupyterlab<5,>=4; extra == 'notebook'
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# Sharketo Python SDK
|
|
31
|
+
|
|
32
|
+
Server-side Python 3.11+ client for Sharketo developer APIs. Supported products include
|
|
33
|
+
Index Inventory, prices, daily inventory history, expiry flow, Seasonality, CTA Flow,
|
|
34
|
+
RRG, crypto inventory, Dealer Exposures and curated Volatility.
|
|
35
|
+
|
|
36
|
+
Version **0.1.14b3** matches the bundled coding-agent skill. SDK installation does not
|
|
37
|
+
grant API access or establish live product availability. Obtain authorized credentials
|
|
38
|
+
and approval for live use separately. All SDK Developer data access requires effective
|
|
39
|
+
Apex access, including live prices and `get_access()` diagnostics. A usable API key or
|
|
40
|
+
Pro portal/integration access alone does not grant Developer data access. The server
|
|
41
|
+
evaluates effective access, including valid existing grants; other access requirements
|
|
42
|
+
and service availability still apply.
|
|
43
|
+
|
|
44
|
+
## Install and try it offline
|
|
45
|
+
|
|
46
|
+
In your application's Python 3.11+ virtual environment, install the SDK from PyPI:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
python -m pip install --index-url https://pypi.org/simple/ sharketo-sdk==0.1.14b3
|
|
50
|
+
python -m sharketo.quickstart
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Use an environment without configured extra package indexes. If the matching release is
|
|
54
|
+
unavailable on PyPI, stop and report the unavailable version. Do not substitute another
|
|
55
|
+
version, package index or source checkout.
|
|
56
|
+
|
|
57
|
+
For a uv project, use `uv add --default-index https://pypi.org/simple/ sharketo-sdk==0.1.14b3`,
|
|
58
|
+
then `uv run python -m sharketo.quickstart`.
|
|
59
|
+
|
|
60
|
+
The quickstart uses invented data through an in-memory HTTP transport. It reads no
|
|
61
|
+
credentials, opens no network sockets and does not validate API entitlements or service
|
|
62
|
+
health.
|
|
63
|
+
|
|
64
|
+
## Configure an authorized application
|
|
65
|
+
|
|
66
|
+
Constructors take an explicit server-side key and do not read environment variables:
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from sharketo import SharketoClient
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def read_summary(api_key, ticker):
|
|
73
|
+
with SharketoClient(api_key) as client:
|
|
74
|
+
return client.index_inventory.get_summary(ticker)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Omitted/`None` `api_url` selects `https://api.sharketo.com`.
|
|
78
|
+
`AsyncSharketoClient(api_key)` uses that API and `wss://socket.sharketo.com/v1/ws`;
|
|
79
|
+
use `async with` and await HTTP methods. A custom API alone is HTTP-only: subscribing
|
|
80
|
+
raises `ValueError` until an explicit `websocket_url` is supplied. A custom WebSocket URL
|
|
81
|
+
with an omitted/`None` API URL raises `ValueError`. Explicit API/WS pairs are accepted
|
|
82
|
+
without inferring hosts or ports.
|
|
83
|
+
|
|
84
|
+
For environment-based switching, provision `SHARKETO_API_KEY` through server-side secret
|
|
85
|
+
tooling, then use `SharketoClient.from_env()` or `AsyncSharketoClient.from_env()` in the
|
|
86
|
+
corresponding context manager. Both read `SHARKETO_API_KEY`/`SHARKETO_API_URL` once at
|
|
87
|
+
construction; only the async factory reads `SHARKETO_WEBSOCKET_URL`. Missing URL variables
|
|
88
|
+
use defaults; a missing/invalid key or blank/invalid URL variable raises `ValueError`.
|
|
89
|
+
The factories accept constructor limits/transport options, but no key/endpoint overrides;
|
|
90
|
+
use constructors for explicit values.
|
|
91
|
+
|
|
92
|
+
Leave both URL variables unset for production defaults. Use overrides only for a
|
|
93
|
+
configuration supplied by Sharketo, with a key authorized for that service. Environment
|
|
94
|
+
changes affect new clients only. The SDK does not scan dotenv files or fall back to
|
|
95
|
+
production on failure. HTTPS/WSS retain verified TLS; plain HTTP/WS are loopback-only.
|
|
96
|
+
|
|
97
|
+
## Optional coding-agent skill
|
|
98
|
+
|
|
99
|
+
The package bundles version-matched SDK usage guidance and synthetic examples.
|
|
100
|
+
Installation into an agent is explicit; pip does not change agent configuration. If a
|
|
101
|
+
matching skill is already installed, use it without creating a duplicate.
|
|
102
|
+
|
|
103
|
+
From your application directory, with the SDK's Python environment active:
|
|
104
|
+
|
|
105
|
+
```sh
|
|
106
|
+
python -m sharketo.skills install --agent claude-code --scope project
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Use `--agent codex` instead for Codex. Run `python -m sharketo.skills --help` for installation
|
|
110
|
+
and export options. Installing the skill does not install Python dependencies, configure
|
|
111
|
+
credentials or grant API access. Keep credentials in server-side environment/secret
|
|
112
|
+
storage, not source code or agent instructions.
|
|
113
|
+
|
|
114
|
+
## Distribution and license
|
|
115
|
+
|
|
116
|
+
Distributions contain the SDK source, bundled usage guides and synthetic fixtures,
|
|
117
|
+
plugin resources, license and package/build metadata.
|
|
118
|
+
|
|
119
|
+
SDK and bundled skill code are MIT-licensed. This license does not grant access to
|
|
120
|
+
Sharketo services.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Sharketo Python SDK
|
|
2
|
+
|
|
3
|
+
Server-side Python 3.11+ client for Sharketo developer APIs. Supported products include
|
|
4
|
+
Index Inventory, prices, daily inventory history, expiry flow, Seasonality, CTA Flow,
|
|
5
|
+
RRG, crypto inventory, Dealer Exposures and curated Volatility.
|
|
6
|
+
|
|
7
|
+
Version **0.1.14b3** matches the bundled coding-agent skill. SDK installation does not
|
|
8
|
+
grant API access or establish live product availability. Obtain authorized credentials
|
|
9
|
+
and approval for live use separately. All SDK Developer data access requires effective
|
|
10
|
+
Apex access, including live prices and `get_access()` diagnostics. A usable API key or
|
|
11
|
+
Pro portal/integration access alone does not grant Developer data access. The server
|
|
12
|
+
evaluates effective access, including valid existing grants; other access requirements
|
|
13
|
+
and service availability still apply.
|
|
14
|
+
|
|
15
|
+
## Install and try it offline
|
|
16
|
+
|
|
17
|
+
In your application's Python 3.11+ virtual environment, install the SDK from PyPI:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
python -m pip install --index-url https://pypi.org/simple/ sharketo-sdk==0.1.14b3
|
|
21
|
+
python -m sharketo.quickstart
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Use an environment without configured extra package indexes. If the matching release is
|
|
25
|
+
unavailable on PyPI, stop and report the unavailable version. Do not substitute another
|
|
26
|
+
version, package index or source checkout.
|
|
27
|
+
|
|
28
|
+
For a uv project, use `uv add --default-index https://pypi.org/simple/ sharketo-sdk==0.1.14b3`,
|
|
29
|
+
then `uv run python -m sharketo.quickstart`.
|
|
30
|
+
|
|
31
|
+
The quickstart uses invented data through an in-memory HTTP transport. It reads no
|
|
32
|
+
credentials, opens no network sockets and does not validate API entitlements or service
|
|
33
|
+
health.
|
|
34
|
+
|
|
35
|
+
## Configure an authorized application
|
|
36
|
+
|
|
37
|
+
Constructors take an explicit server-side key and do not read environment variables:
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from sharketo import SharketoClient
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def read_summary(api_key, ticker):
|
|
44
|
+
with SharketoClient(api_key) as client:
|
|
45
|
+
return client.index_inventory.get_summary(ticker)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Omitted/`None` `api_url` selects `https://api.sharketo.com`.
|
|
49
|
+
`AsyncSharketoClient(api_key)` uses that API and `wss://socket.sharketo.com/v1/ws`;
|
|
50
|
+
use `async with` and await HTTP methods. A custom API alone is HTTP-only: subscribing
|
|
51
|
+
raises `ValueError` until an explicit `websocket_url` is supplied. A custom WebSocket URL
|
|
52
|
+
with an omitted/`None` API URL raises `ValueError`. Explicit API/WS pairs are accepted
|
|
53
|
+
without inferring hosts or ports.
|
|
54
|
+
|
|
55
|
+
For environment-based switching, provision `SHARKETO_API_KEY` through server-side secret
|
|
56
|
+
tooling, then use `SharketoClient.from_env()` or `AsyncSharketoClient.from_env()` in the
|
|
57
|
+
corresponding context manager. Both read `SHARKETO_API_KEY`/`SHARKETO_API_URL` once at
|
|
58
|
+
construction; only the async factory reads `SHARKETO_WEBSOCKET_URL`. Missing URL variables
|
|
59
|
+
use defaults; a missing/invalid key or blank/invalid URL variable raises `ValueError`.
|
|
60
|
+
The factories accept constructor limits/transport options, but no key/endpoint overrides;
|
|
61
|
+
use constructors for explicit values.
|
|
62
|
+
|
|
63
|
+
Leave both URL variables unset for production defaults. Use overrides only for a
|
|
64
|
+
configuration supplied by Sharketo, with a key authorized for that service. Environment
|
|
65
|
+
changes affect new clients only. The SDK does not scan dotenv files or fall back to
|
|
66
|
+
production on failure. HTTPS/WSS retain verified TLS; plain HTTP/WS are loopback-only.
|
|
67
|
+
|
|
68
|
+
## Optional coding-agent skill
|
|
69
|
+
|
|
70
|
+
The package bundles version-matched SDK usage guidance and synthetic examples.
|
|
71
|
+
Installation into an agent is explicit; pip does not change agent configuration. If a
|
|
72
|
+
matching skill is already installed, use it without creating a duplicate.
|
|
73
|
+
|
|
74
|
+
From your application directory, with the SDK's Python environment active:
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
python -m sharketo.skills install --agent claude-code --scope project
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Use `--agent codex` instead for Codex. Run `python -m sharketo.skills --help` for installation
|
|
81
|
+
and export options. Installing the skill does not install Python dependencies, configure
|
|
82
|
+
credentials or grant API access. Keep credentials in server-side environment/secret
|
|
83
|
+
storage, not source code or agent instructions.
|
|
84
|
+
|
|
85
|
+
## Distribution and license
|
|
86
|
+
|
|
87
|
+
Distributions contain the SDK source, bundled usage guides and synthetic fixtures,
|
|
88
|
+
plugin resources, license and package/build metadata.
|
|
89
|
+
|
|
90
|
+
SDK and bundled skill code are MIT-licensed. This license does not grant access to
|
|
91
|
+
Sharketo services.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Keep Hatchling from automatically appending VCS ignore files to source archives."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class CustomBuildHook(BuildHookInterface):
|
|
11
|
+
def initialize(self, version: str, build_data: dict[str, Any]) -> None:
|
|
12
|
+
forced = build_data["force_include"]
|
|
13
|
+
for source, target in tuple(forced.items()):
|
|
14
|
+
if target in {".gitignore", ".hgignore"}:
|
|
15
|
+
del forced[source]
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
|
+
"name": "sharketo-python",
|
|
4
|
+
"version": "0.1.14b3",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"description": "Python SDK integration, cache-only Dealer Exposures, bounded BTC/ETH current crypto exposure, prices, expiry flow, daily history, inventory rendering/exposure profiles and full-asset/compact Seasonality, curated Volatility/RRG and CTA Flow guidance; mock first, server-side credentials only."
|
|
7
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.27,<2"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "sharketo-sdk"
|
|
7
|
+
version = "0.1.14b3"
|
|
8
|
+
description = "Server-side Sharketo Python client for cache-only Dealer Exposures, BTC/ETH current crypto inventory, prices, Index Inventory, Seasonality, curated Volatility, RRG and CTA Flow"
|
|
9
|
+
readme = "PYPI_README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
requires-python = ">=3.11"
|
|
13
|
+
dependencies = ["httpx>=0.28,<1", "pydantic>=2.10,<3", "websockets>=15,<17"]
|
|
14
|
+
|
|
15
|
+
[project.optional-dependencies]
|
|
16
|
+
dev = ["pytest>=8,<10", "pytest-asyncio>=0.25,<2", "ruff==0.16.10", "mypy>=1.15,<2", "datamodel-code-generator==0.53.0", "jsonschema>=4.23,<5", "build>=1.2,<2", "hatchling>=1.27,<2", "twine>=7,<8", "packaging>=26.1,<27", "PyYAML>=6,<7"]
|
|
17
|
+
dashboard = ["streamlit>=1.49,<2", "altair>=5.5,<7"]
|
|
18
|
+
notebook = ["jupyterlab>=4,<5"]
|
|
19
|
+
|
|
20
|
+
[tool.hatch.build.targets.wheel]
|
|
21
|
+
packages = ["src/sharketo"]
|
|
22
|
+
|
|
23
|
+
[tool.hatch.build.targets.wheel.force-include]
|
|
24
|
+
"skills/sharketo-python" = "sharketo/_skills/sharketo-python"
|
|
25
|
+
"plugin.json" = "sharketo/_skills/openai-plugin.json"
|
|
26
|
+
".claude-plugin/plugin.json" = "sharketo/_skills/claude-plugin.json"
|
|
27
|
+
|
|
28
|
+
[tool.hatch.build.targets.sdist]
|
|
29
|
+
only-include = [
|
|
30
|
+
"src/sharketo",
|
|
31
|
+
"skills/sharketo-python",
|
|
32
|
+
"plugin.json",
|
|
33
|
+
".claude-plugin/plugin.json",
|
|
34
|
+
"pyproject.toml",
|
|
35
|
+
"hatch_build.py",
|
|
36
|
+
"PYPI_README.md",
|
|
37
|
+
"LICENSE",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[tool.hatch.build.targets.sdist.hooks.custom]
|
|
41
|
+
path = "hatch_build.py"
|
|
42
|
+
|
|
43
|
+
[tool.pytest.ini_options]
|
|
44
|
+
asyncio_mode = "auto"
|
|
45
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
46
|
+
testpaths = ["tests"]
|
|
47
|
+
markers = ["live: opt-in read-only tests against an explicitly configured local dev stack"]
|
|
48
|
+
|
|
49
|
+
[tool.ruff]
|
|
50
|
+
target-version = "py311"
|
|
51
|
+
line-length = 100
|
|
52
|
+
|
|
53
|
+
[tool.ruff.lint]
|
|
54
|
+
select = ["E", "F", "I", "UP", "B", "ASYNC"]
|
|
55
|
+
|
|
56
|
+
[tool.ruff.lint.per-file-ignores]
|
|
57
|
+
"_generated.py" = ["E501"]
|
|
58
|
+
|
|
59
|
+
[tool.mypy]
|
|
60
|
+
python_version = "3.11"
|
|
61
|
+
strict = true
|
|
62
|
+
files = ["src/sharketo"]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sharketo Market Intelligence
|
|
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.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sharketo-python
|
|
3
|
+
description: Use when integrating the Sharketo Python SDK into an application, service, report, notebook or dashboard. Covers Index Inventory, prices, crypto inventory, Dealer Exposures, expiry flow, daily history, Seasonality, Volatility, RRG and CTA Flow APIs, async streams, data interpretation, installation, first-time API key setup and read-only access diagnostics.
|
|
4
|
+
license: LICENSE
|
|
5
|
+
metadata:
|
|
6
|
+
version: "0.1.14b3"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Sharketo Python SDK
|
|
10
|
+
|
|
11
|
+
## Developer API access
|
|
12
|
+
|
|
13
|
+
All SDK data access requires effective Apex access, including live prices and
|
|
14
|
+
`get_access()` diagnostics. A usable key or Pro portal/integration access is insufficient.
|
|
15
|
+
The backend evaluates effective access, including valid existing grants; do not infer it
|
|
16
|
+
from a billing label or add a client-side plan gate/preflight. For denied access, preserve
|
|
17
|
+
sanitized capability/plan metadata and follow [terminal diagnostics](references/sdk.md#read-only-diagnostics-and-terminal-errors).
|
|
18
|
+
|
|
19
|
+
## Personal-use scope
|
|
20
|
+
|
|
21
|
+
Developer access covers private, noncommercial applications used only by the subscriber.
|
|
22
|
+
Work for an employer or client is outside this scope. See
|
|
23
|
+
[personal-use boundaries](references/integration.md#personal-use-boundaries) for hosting,
|
|
24
|
+
sharing and code publication.
|
|
25
|
+
|
|
26
|
+
## Start from the user's application
|
|
27
|
+
|
|
28
|
+
1. If the SDK is missing or its version is uncertain, follow [installation](references/install.md) for the matching PyPI release and offline verification. Skill installation alone does not install the SDK.
|
|
29
|
+
2. Select a family below and read its API and data semantics before coding. For client options, summary models, errors or stream limits, read the relevant section of the [SDK reference](references/sdk.md).
|
|
30
|
+
3. Use [application integration](references/integration.md) for client reuse, stream lifecycle, status refresh and error handling.
|
|
31
|
+
4. Check the changed behavior with the application's tests and the relevant guide's offline fixture. For agent-run live checks, follow the [validation workflow](references/workflow.md).
|
|
32
|
+
|
|
33
|
+
## Select a capability
|
|
34
|
+
|
|
35
|
+
| Requested data | Reference |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| SPX/NDX compact inventory summaries | [SDK clients and summary models](references/sdk.md#clients-and-subscriptions) |
|
|
38
|
+
| SPX/NDX strike contributions, exposure/spot/IV history, session Bookmap | [Inventory rendering](references/inventory-rendering.md) |
|
|
39
|
+
| Opt-in conditional-price exposure profiles | [Profiles](references/profiles.md) |
|
|
40
|
+
| SPX/NDX replacement quotes | [Prices](references/prices.md) |
|
|
41
|
+
| BTC/ETH current crypto exposure state | [Crypto inventory](references/crypto-inventory.md) |
|
|
42
|
+
| SPX/NDX/SPY/QQQ cache-only dealer snapshots | [Dealer Exposures](references/dealer-exposures.md) |
|
|
43
|
+
| SPX/NDX expiry-flow latest and selected hourly history | [Expiry flow](references/expiry-flow.md) |
|
|
44
|
+
| Bounded daily reconstructed inventory history | [Daily history](references/daily-history.md) |
|
|
45
|
+
| Full per-asset seasonal analysis and compact seasonal tables | [Seasonality](references/seasonality.md) |
|
|
46
|
+
| Curated volatility catalog, asset and term-structure snapshots | [Volatility](references/volatility.md) |
|
|
47
|
+
| Curated relative-rotation catalog, group and screener snapshots | [RRG](references/rrg.md) |
|
|
48
|
+
| Modeled positioning and scenario-flow snapshot | [CTA Flow](references/cta-flow.md) |
|
|
49
|
+
| SDK/skill installation, version matching, host discovery or export | [Installation](references/install.md) |
|
|
50
|
+
| Portal API key creation or first-time server-side credential configuration | [First-time API key setup](references/setup.md) |
|
|
51
|
+
| Access failures and sanitized diagnostics | [SDK error boundary](references/sdk.md#read-only-diagnostics-and-terminal-errors) |
|
|
52
|
+
|
|
53
|
+
## Common boundaries
|
|
54
|
+
|
|
55
|
+
- Consume complete replacement states instead of handling raw full, delta or tail messages.
|
|
56
|
+
- Preserve supplied financial values, classifications, units, signs, provenance and null versus zero. Label application calculations separately.
|
|
57
|
+
- Keep source time, publication time, receipt time and transport status separate. If source freshness is unknown, leave it unknown. For calendar-date fields, follow [date-only display](references/integration.md#calendar-date-display).
|
|
58
|
+
- Keep API keys server-side and out of browser inputs, frontend bundles, notebook cells and outputs, URLs and logs.
|
|
59
|
+
- For production defaults or custom environments, follow [endpoint configuration](references/integration.md#endpoints-and-environment-configuration).
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Crypto current inventory, SDK 0.1.14b3
|
|
2
|
+
|
|
3
|
+
For stream lifecycle and status refresh, see [application integration](integration.md#streams).
|
|
4
|
+
|
|
5
|
+
## Public usage
|
|
6
|
+
|
|
7
|
+
`client.crypto_inventory.subscribe_inventory("BTC", time_window="24h")` is an async-only,
|
|
8
|
+
nonawaitable lazy factory. Use `async with ... as sub` and `async for snapshot in sub`.
|
|
9
|
+
Close the subscription and client on cancellation. A resolved `websocket_url` is required.
|
|
10
|
+
Use the documented production default or an explicitly approved custom URL, as described in
|
|
11
|
+
[configuration](integration.md#endpoints-and-environment-configuration).
|
|
12
|
+
|
|
13
|
+
Only canonical BTC and ETH are supported. The windows are 1h, 4h, 8h, 24h (default), 7d,
|
|
14
|
+
1m, 3m, 6m, 1y and max. Currency and window identify a subscription on `cryptoInventory.v1`.
|
|
15
|
+
One async client shares its socket with SPX and NDX inventory and prices. This stream has
|
|
16
|
+
no HTTP endpoint, polling API or optional section parameters. It needs no access or catalog preflight.
|
|
17
|
+
Browser credentials are unsupported. `get_access()` remains index-specific.
|
|
18
|
+
|
|
19
|
+
`CryptoInventorySubscription` exposes currency, time_window, status, latest and `aclose()`.
|
|
20
|
+
Every `CryptoInventoryStreamSnapshot.inventory` is a complete `CryptoInventoryState`.
|
|
21
|
+
It contains read-only entries with opaque keys, frozen leaves and a tracked_expirations tuple.
|
|
22
|
+
Totals and market metadata replace the previous values. The SDK applies full resets, then
|
|
23
|
+
removals, then whole-entry upserts before latest-only delivery. Applications consume the
|
|
24
|
+
complete state rather than accumulate deltas. Reconnect requires a new baseline. There is
|
|
25
|
+
no sequence, replay or every-provider-event guarantee. Never parse entry map keys.
|
|
26
|
+
|
|
27
|
+
The window identifies the selector and its history metadata, not a rolling position interval.
|
|
28
|
+
Every window exposes the current active flow-formed book. `window_duration_ms` is fixed
|
|
29
|
+
selector metadata (max=None), not coverage. Preserve backend-computed financial values.
|
|
30
|
+
Python formulas are not a substitute for missing SDK fields.
|
|
31
|
+
|
|
32
|
+
## Display and units
|
|
33
|
+
|
|
34
|
+
- Entry position and OI are underlying BTC or ETH coin quantities, not contracts multiplied
|
|
35
|
+
by 100 or dollar amounts. OI is nullable as a whole. Null means unknown, not zero.
|
|
36
|
+
Positions and exposures are signed, and zero is valid. Spot and strike are USD per
|
|
37
|
+
underlying coin.
|
|
38
|
+
- Entry `iv.call/put`, `atm_iv` and IV buckets are annualized decimals (0.65 = 65%).
|
|
39
|
+
`dvol` is a percentage-index level (65 = 65%). Preserve explicit nulls in IV buckets.
|
|
40
|
+
- The server computes `entry.exposures.call/put` and `exposure_totals.all/by_category`.
|
|
41
|
+
Preserve all supplied exposure fields and their backend dollar-scaled sensitivity
|
|
42
|
+
conventions. Do not re-dollarize them or infer shock normalization. Raw delta is a
|
|
43
|
+
signed delta measure. Raw theta is USD/year, not per day. Some higher-order measures
|
|
44
|
+
can be zero when not computed. Use the supplied server totals rather than summing
|
|
45
|
+
displayed rows.
|
|
46
|
+
- The IV accessors are `.field_0_dte`, `.field_1_dte`, `.weekly`, `.monthly` and `.all`.
|
|
47
|
+
Category totals also have `.long`. Tracked expirations have `.expiration`,
|
|
48
|
+
`.expiration_timestamp` and nullable `.primary_bucket`. Crypto settlement is 08:00 UTC.
|
|
49
|
+
- `reference_timestamp_ms` is server reference time and can advance without new market
|
|
50
|
+
observations. `emitted_at_ms` is publication time. Neither measures per-metric
|
|
51
|
+
provider freshness. `received_at_ms` and monotonic `receipt_age_seconds` measure local
|
|
52
|
+
receipt. `disconnected` means retained data is transport-stale. Old wrappers remain
|
|
53
|
+
disconnected after reconnect. Keep retained values marked disconnected until replacement.
|
|
54
|
+
Do not infer a TTL, stale property, source-age SLA, timestamp ordering, readiness or source
|
|
55
|
+
freshness. Empty startup zero market values are not live quotes.
|
|
56
|
+
- The SDK rejects data that exceeds its bounds rather than cropping it. The limits are
|
|
57
|
+
10,000 accumulated entries, 10,000 removals per frame, 10,000 tracked expirations,
|
|
58
|
+
128-byte opaque keys, 32-byte expiration text and 8 MiB decoded envelopes.
|
|
59
|
+
The materialized payload reserves 1 KiB. Slow consumers may close.
|
|
60
|
+
|
|
61
|
+
Access requires effective Apex access through `developer_api` and an API key with
|
|
62
|
+
verified email, ApiKeys and InventoryCrypto. Existing
|
|
63
|
+
quotas and policy apply. For agent-run live checks, follow the
|
|
64
|
+
[validation workflow](workflow.md).
|
|
65
|
+
|
|
66
|
+
## Offline validation fixture (installed package)
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from types import MappingProxyType
|
|
70
|
+
from dataclasses import FrozenInstanceError
|
|
71
|
+
from pydantic import ValidationError
|
|
72
|
+
from sharketo import (
|
|
73
|
+
CryptoFullExposures,
|
|
74
|
+
CryptoInventoryEntry,
|
|
75
|
+
CryptoInventoryState,
|
|
76
|
+
CryptoExposureTotals,
|
|
77
|
+
CryptoAtmIvByBucket,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
metrics = tuple(CryptoFullExposures.model_fields)
|
|
81
|
+
zero = dict.fromkeys(metrics, 0.0) # Invented values, not computed finance.
|
|
82
|
+
entry = CryptoInventoryEntry.model_validate(
|
|
83
|
+
{
|
|
84
|
+
"strike": 60000.0,
|
|
85
|
+
"expiration": "2026-01-31",
|
|
86
|
+
"expirationTimestampMs": 1769846400000,
|
|
87
|
+
"position": {"call": -2.0, "put": 0.0},
|
|
88
|
+
"exposures": {"call": {**zero, "gex": -2500.0}, "put": zero},
|
|
89
|
+
"iv": {"call": 0.65, "put": 0.0},
|
|
90
|
+
"openInterest": None,
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
totals = CryptoExposureTotals.model_validate(
|
|
94
|
+
{
|
|
95
|
+
"all": {**zero, "gex": -2500.0},
|
|
96
|
+
"byCategory": {key: zero for key in ("0DTE", "1DTE", "WEEKLY", "MONTHLY", "LONG")},
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
iv = CryptoAtmIvByBucket.model_validate(
|
|
100
|
+
{
|
|
101
|
+
"0DTE": None,
|
|
102
|
+
"1DTE": 0.0,
|
|
103
|
+
"WEEKLY": None,
|
|
104
|
+
"MONTHLY": 0.65,
|
|
105
|
+
"ALL": 0.65,
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
state = CryptoInventoryState(
|
|
109
|
+
currency="BTC",
|
|
110
|
+
time_window="24h",
|
|
111
|
+
reference_timestamp_ms=1769760000000,
|
|
112
|
+
emitted_at_ms=1769760001000,
|
|
113
|
+
window_duration_ms=86400000,
|
|
114
|
+
entries=MappingProxyType({"opaque": entry}),
|
|
115
|
+
exposure_totals=totals,
|
|
116
|
+
spot_price=60000.0,
|
|
117
|
+
dvol=65.0,
|
|
118
|
+
atm_iv=0.65,
|
|
119
|
+
atm_iv_by_bucket=iv,
|
|
120
|
+
tracked_expirations=(),
|
|
121
|
+
)
|
|
122
|
+
assert state.entries["opaque"].position.call == -2.0
|
|
123
|
+
assert state.entries["opaque"].position.put == 0.0
|
|
124
|
+
assert state.entries["opaque"].open_interest is None
|
|
125
|
+
assert state.atm_iv_by_bucket.field_0_dte is None
|
|
126
|
+
assert state.atm_iv_by_bucket.field_1_dte == 0.0
|
|
127
|
+
assert state.exposure_totals.all.gex == -2500.0
|
|
128
|
+
for mutate, error in (
|
|
129
|
+
(lambda: state.entries.__setitem__("bad", entry), AttributeError),
|
|
130
|
+
(lambda: setattr(entry.position, "call", 99), ValidationError),
|
|
131
|
+
(lambda: setattr(state, "currency", "ETH"), FrozenInstanceError),
|
|
132
|
+
):
|
|
133
|
+
try:
|
|
134
|
+
mutate()
|
|
135
|
+
except error:
|
|
136
|
+
pass
|
|
137
|
+
else:
|
|
138
|
+
raise AssertionError("Synthetic public state lost immutability")
|
|
139
|
+
print("Synthetic BTC current book: signed/zero/null and frozen state preserved")
|
|
140
|
+
```
|