qtsurfer-api-client 0.98.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 (75) hide show
  1. qtsurfer_api_client-0.98.0/.gitignore +38 -0
  2. qtsurfer_api_client-0.98.0/LICENSE +201 -0
  3. qtsurfer_api_client-0.98.0/PKG-INFO +238 -0
  4. qtsurfer_api_client-0.98.0/README.md +207 -0
  5. qtsurfer_api_client-0.98.0/pyproject.toml +116 -0
  6. qtsurfer_api_client-0.98.0/src/qtsurfer/__init__.py +0 -0
  7. qtsurfer_api_client-0.98.0/src/qtsurfer/api/__init__.py +0 -0
  8. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/__init__.py +38 -0
  9. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/__init__.py +8 -0
  10. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/api/__init__.py +1 -0
  11. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/api/auth/__init__.py +1 -0
  12. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/api/auth/auth.py +174 -0
  13. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/api/backtesting/__init__.py +1 -0
  14. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/api/backtesting/cancel_execution.py +214 -0
  15. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/api/backtesting/execute_backtesting.py +251 -0
  16. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/api/backtesting/get_execution_result.py +211 -0
  17. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/api/backtesting/get_preparation_status.py +211 -0
  18. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/api/backtesting/prepare_backtesting.py +235 -0
  19. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/api/exchange/__init__.py +1 -0
  20. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/api/exchange/get_exchange_klines_hour.py +269 -0
  21. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/api/exchange/get_exchange_tickers_hour.py +349 -0
  22. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/api/exchange/get_exchanges.py +129 -0
  23. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/api/exchange/get_instruments.py +181 -0
  24. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/api/exchange/get_segment_instruments.py +196 -0
  25. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/api/strategy/__init__.py +1 -0
  26. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/api/strategy/get_strategy_status.py +173 -0
  27. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/client.py +268 -0
  28. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/errors.py +16 -0
  29. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/__init__.py +79 -0
  30. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/accepted_job.py +66 -0
  31. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/auth_token_error.py +72 -0
  32. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/auth_token_error_code.py +10 -0
  33. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/auth_token_response.py +101 -0
  34. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/auth_token_response_tier.py +11 -0
  35. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/auth_token_response_token_type.py +8 -0
  36. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/backtest_job_result.py +80 -0
  37. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/cancel_execution_response_200.py +78 -0
  38. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/cancel_execution_response_200_status.py +8 -0
  39. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/coverage_window.py +105 -0
  40. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/data_source_type.py +8 -0
  41. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/equity_point.py +71 -0
  42. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/exchange.py +81 -0
  43. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/execute_backtesting_body.py +83 -0
  44. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/get_exchange_klines_hour_format.py +9 -0
  45. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/get_exchange_tickers_hour_format.py +9 -0
  46. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/get_segment_instruments_segment.py +9 -0
  47. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/get_strategy_status_response_200.py +102 -0
  48. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/get_strategy_status_response_200_status.py +12 -0
  49. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/hal_link.py +74 -0
  50. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/instrument_coverage.py +91 -0
  51. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/instrument_detail.py +120 -0
  52. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/instrument_links.py +102 -0
  53. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/instrument_list_meta.py +82 -0
  54. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/instrument_list_meta_segment.py +9 -0
  55. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/instrument_list_response.py +96 -0
  56. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/job_state.py +178 -0
  57. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/job_state_status.py +12 -0
  58. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/post_strategy_response_200.py +61 -0
  59. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/prepare_backtesting_body.py +110 -0
  60. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/prepare_backtesting_body_cadence.py +15 -0
  61. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/prepare_job_state.py +302 -0
  62. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/prepare_job_state_hours_without_data_item.py +101 -0
  63. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/prepare_job_state_hours_without_data_item_rationale.py +10 -0
  64. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/response_error.py +70 -0
  65. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/result_map.py +286 -0
  66. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/models/result_map_signals_upload.py +10 -0
  67. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/py.typed +1 -0
  68. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/_generated/types.py +54 -0
  69. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/api/__init__.py +11 -0
  70. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/api/auth.py +5 -0
  71. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/api/backtesting.py +17 -0
  72. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/api/exchange.py +15 -0
  73. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/api/strategy.py +11 -0
  74. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/models/__init__.py +9 -0
  75. qtsurfer_api_client-0.98.0/src/qtsurfer/api/client/py.typed +0 -0
@@ -0,0 +1,38 @@
1
+ # Byte-compiled / optimized
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Distribution / packaging
7
+ build/
8
+ dist/
9
+ *.egg-info/
10
+ *.egg
11
+ wheels/
12
+ .eggs/
13
+
14
+ # Virtual environments
15
+ .venv/
16
+ venv/
17
+ env/
18
+
19
+ # Tooling caches
20
+ .ruff_cache/
21
+ .mypy_cache/
22
+ .pytest_cache/
23
+ .coverage
24
+ .coverage.*
25
+ htmlcov/
26
+ coverage.xml
27
+
28
+ # Editor / OS
29
+ .idea/
30
+ .vscode/
31
+ .DS_Store
32
+ *.swp
33
+
34
+ # Codegen scratch
35
+ /tmp/qtsurfer-client-gen/
36
+
37
+ # OpenAPI spec is fetched by scripts/regenerate.sh, not committed
38
+ openapi.yaml
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Support. While redistributing the Work or
166
+ Derivative Works thereof, You may choose to offer, and charge a
167
+ fee for, acceptance of support, warranty, indemnity, or other
168
+ liability obligations and/or rights consistent with this License.
169
+ However, in accepting such obligations, You may act only on Your
170
+ own behalf and on Your sole responsibility, not on behalf of any
171
+ other Contributor, and only if You agree to indemnify, defend,
172
+ and hold each Contributor harmless for any liability incurred by,
173
+ or claims asserted against, such Contributor by reason of your
174
+ accepting any such warranty or support.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Wualabs LTD
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
200
+ implied. See the License for the specific language governing
201
+ permissions and limitations under the License.
@@ -0,0 +1,238 @@
1
+ Metadata-Version: 2.4
2
+ Name: qtsurfer-api-client
3
+ Version: 0.98.0
4
+ Summary: Auto-generated Python client for the QTSurfer API.
5
+ Project-URL: Homepage, https://github.com/QTSurfer/api-client-python
6
+ Project-URL: Repository, https://github.com/QTSurfer/api-client-python
7
+ Project-URL: Issues, https://github.com/QTSurfer/api-client-python/issues
8
+ Project-URL: OpenAPI Spec, https://github.com/QTSurfer/qtsurfer-api
9
+ Project-URL: SDK (Java), https://github.com/QTSurfer/sdk-java
10
+ Project-URL: SDK (TypeScript), https://github.com/QTSurfer/sdk-ts
11
+ Author-email: Manuel Polo <mrmx@users.noreply.github.com>
12
+ License-Expression: Apache-2.0
13
+ License-File: LICENSE
14
+ Keywords: api,backtest,client,openapi,qtsurfer,trading
15
+ Classifier: Development Status :: 3 - Alpha
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Intended Audience :: Financial and Insurance Industry
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Office/Business :: Financial :: Investment
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Classifier: Typing :: Typed
26
+ Requires-Python: >=3.11
27
+ Requires-Dist: attrs>=22.2.0
28
+ Requires-Dist: httpx<1,>=0.23
29
+ Requires-Dist: python-dateutil>=2.8.0
30
+ Description-Content-Type: text/markdown
31
+
32
+ <h1 align="center">QTSurfer API Client · Python</h1>
33
+
34
+ <p align="center">
35
+ <a href="https://github.com/QTSurfer/api-client-python/actions/workflows/ci.yml"><img src="https://github.com/QTSurfer/api-client-python/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
36
+ <a href="https://pypi.org/project/qtsurfer-api-client/"><img src="https://img.shields.io/pypi/v/qtsurfer-api-client.svg" alt="PyPI"></a>
37
+ <a href="https://pypi.org/project/qtsurfer-api-client/"><img src="https://img.shields.io/pypi/pyversions/qtsurfer-api-client.svg" alt="Python versions"></a>
38
+ <a href="LICENSE"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License"></a>
39
+ </p>
40
+
41
+ <p align="center">
42
+ Auto-generated Python client for the <a href="https://github.com/QTSurfer/qtsurfer-api">QTSurfer API</a>, built from the OpenAPI 3.1 spec with <a href="https://github.com/openapi-generators/openapi-python-client">openapi-python-client</a> on top of <a href="https://www.python-httpx.org/">httpx</a>.
43
+ </p>
44
+
45
+ <p align="center">
46
+ <code>pip install qtsurfer-api-client</code>
47
+ </p>
48
+
49
+ ---
50
+
51
+ Intentionally thin: one function per endpoint, 1:1 with the spec. For workflow orchestration (polling, retries, domain objects, unified errors), use [`qtsurfer-sdk`](https://github.com/QTSurfer/sdk-python) (coming soon).
52
+
53
+ - **Sync-first, httpx-powered** — same call site shape as the Java/TS siblings.
54
+ - **Spec-driven** — generated sources fetched from [`QTSurfer/qtsurfer-api`](https://github.com/QTSurfer/qtsurfer-api) by `scripts/regenerate.sh`.
55
+ - **Fully typed** — `py.typed` marker, `mypy --strict` clean (consumers see precise types for every request/response).
56
+ - **Python 3.11+** — modern type hints, no compat shims.
57
+
58
+ ## Installation
59
+
60
+ ```bash
61
+ pip install qtsurfer-api-client
62
+ ```
63
+
64
+ Or with [uv](https://docs.astral.sh/uv/):
65
+
66
+ ```bash
67
+ uv add qtsurfer-api-client
68
+ ```
69
+
70
+ ## Quick start
71
+
72
+ ```python
73
+ import os
74
+
75
+ from qtsurfer.api.client import AuthenticatedClient
76
+ from qtsurfer.api.client.api.exchange import get_exchanges, get_instruments
77
+
78
+ client = AuthenticatedClient(
79
+ base_url="https://api.qtsurfer.com/v1",
80
+ token=os.environ["QTSURFER_TOKEN"],
81
+ )
82
+
83
+ exchanges = get_exchanges.sync(client=client)
84
+ for ex in exchanges or []:
85
+ print(ex.id, ex.name)
86
+
87
+ instruments = get_instruments.sync(client=client, exchange_id="binance")
88
+ print(f"{len(instruments.data)} instruments on binance ({instruments.meta.segment.value})")
89
+ ```
90
+
91
+ ### API key → JWT
92
+
93
+ Every endpoint above expects a short-lived JWT in the `Authorization: Bearer …`
94
+ header. Exchange a long-lived API key for one via `auth`:
95
+
96
+ ```python
97
+ import os
98
+
99
+ from qtsurfer.api.client import AuthenticatedClient
100
+ from qtsurfer.api.client.api.auth import auth
101
+
102
+ # AuthenticatedClient also drives the apikey header — set prefix="" so it
103
+ # sends `X-API-Key: <key>` instead of `Authorization: Bearer <key>`.
104
+ apikey_client = AuthenticatedClient(
105
+ base_url="https://api.qtsurfer.com/v1",
106
+ token=os.environ["QTSURFER_APIKEY"],
107
+ prefix="",
108
+ auth_header_name="X-API-Key",
109
+ )
110
+
111
+ token_response = auth.sync(client=apikey_client)
112
+ jwt = token_response.access_token # use this in subsequent calls
113
+ ```
114
+
115
+ For production use, prefer the [`qtsurfer-sdk`](https://github.com/QTSurfer/sdk-python)
116
+ `auth(apikey)` helper — it handles token refresh, env-var pickup
117
+ (`QTSURFER_APIKEY`), and pluggable token storage so callers don't reinvent any
118
+ of it on top of the raw client.
119
+
120
+ Each generated endpoint module exposes four entrypoints:
121
+
122
+ | Function | Returns |
123
+ | --- | --- |
124
+ | `sync(...)` | parsed model (or `None` on a defined error response) |
125
+ | `sync_detailed(...)` | full `Response[...]` (status, headers, parsed, content) |
126
+ | `asyncio(...)` | parsed model, awaitable |
127
+ | `asyncio_detailed(...)` | full `Response[...]`, awaitable |
128
+
129
+ ## API surface
130
+
131
+ | Module | Operation | Method · Path |
132
+ | --- | --- | --- |
133
+ | `api.auth` | `auth` | `POST /auth/token` — exchange API key for a short-lived JWT |
134
+ | `api.exchange` | `get_exchanges` | `GET /exchanges` |
135
+ | `api.exchange` | `get_instruments` | `GET /exchange/{exchangeId}/instruments` (default `spot` segment) |
136
+ | `api.exchange` | `get_segment_instruments` | `GET /exchange/{exchangeId}/{segment}/instruments` |
137
+ | `api.exchange` | `get_exchange_tickers_hour` | `GET /exchange/{exchangeId}/tickers/{base}/{quote}` |
138
+ | `api.exchange` | `get_exchange_klines_hour` | `GET /exchange/{exchangeId}/klines/{base}/{quote}` |
139
+ | `api.strategy` | `get_strategy_status` | `GET /strategy/{strategyId}` |
140
+ | `api.backtesting` | `prepare_backtesting` | `POST /backtesting/prepare` |
141
+ | `api.backtesting` | `get_preparation_status` | `GET /backtesting/prepare/{jobId}` |
142
+ | `api.backtesting` | `execute_backtesting` | `POST /backtesting/execute` |
143
+ | `api.backtesting` | `cancel_execution` | `POST /backtesting/execute/{jobId}/cancel` |
144
+ | `api.backtesting` | `get_execution_result` | `GET /backtesting/execute/{jobId}` |
145
+
146
+ > Exact module/function names are produced from `operationId` in the OpenAPI spec. Run `scripts/regenerate.sh` to refresh and check `src/qtsurfer/api/client/_generated/api/` for the authoritative listing.
147
+
148
+ All generated model types (`Exchange`, `InstrumentDetail`, `InstrumentCoverage`, `CoverageWindow`, `JobState`, `PrepareJobState`, `BacktestJobResult`, `ResultMap`, `ResponseError`, …) live under `qtsurfer.api.client.models`. `get_instruments`/`get_segment_instruments` return an `InstrumentListResponse` (HAL envelope: `data` + `meta` + `_links`), not a bare list — each `InstrumentDetail.coverage` carries per-data-type `CoverageWindow`s instead of flat `dataFrom`/`dataTo`. A single-instrument `get_preparation_status` returns a `PrepareJobState` — always terminal (`status: Completed`), with a `coverage_ratio` and a per-hour `hours_without_data` breakdown to act on instead of polling.
149
+
150
+ > **`POST /strategy` (`postStrategy`)** is currently omitted by the generator because the spec declares its request body as `text/plain` and `openapi-python-client` only emits JSON / form / multipart bodies. Call it directly via the underlying `httpx` client (`client.get_httpx_client().post("/strategy", content=src, headers={"Content-Type": "text/plain"})`) until the spec is restructured.
151
+
152
+ ### Binary downloads (`/exchange/{ex}/tickers|klines/{base}/{quote}`)
153
+
154
+ These endpoints return raw [Lastra](https://github.com/QTSurfer/lastra-java) bytes (default) or Parquet (`format=parquet`). The generated `sync()` helpers parse the response body as JSON and will raise on binary payloads; use `sync_detailed()` and read `response.content` directly:
155
+
156
+ ```python
157
+ from qtsurfer.api.client import AuthenticatedClient
158
+ from qtsurfer.api.client.api.exchange import get_exchange_tickers_hour
159
+
160
+ client = AuthenticatedClient(base_url="https://api.qtsurfer.com/v1", token=token)
161
+
162
+ response = get_exchange_tickers_hour.sync_detailed(
163
+ client=client,
164
+ exchange_id="binance",
165
+ base="BTC",
166
+ quote="USDT",
167
+ hour="2026-01-15T10",
168
+ )
169
+ with open("BTC_USDT_2026-01-15_h10.lastra", "wb") as f:
170
+ f.write(response.content)
171
+ ```
172
+
173
+ For very large segments, drop down to the underlying `httpx.Client` (`client.get_httpx_client()`) and stream:
174
+
175
+ ```python
176
+ with client.get_httpx_client().stream(
177
+ "GET",
178
+ "/exchange/binance/klines/BTC/USDT",
179
+ params={"hour": "2026-01-15T10", "format": "parquet"},
180
+ ) as r:
181
+ r.raise_for_status()
182
+ with open("out.parquet", "wb") as f:
183
+ for chunk in r.iter_bytes():
184
+ f.write(chunk)
185
+ ```
186
+
187
+ ## Configuring the client
188
+
189
+ Both `Client` and `AuthenticatedClient` accept the standard hooks of the upstream generator:
190
+
191
+ ```python
192
+ from qtsurfer.api.client import AuthenticatedClient
193
+
194
+ client = AuthenticatedClient(
195
+ base_url="https://api.qtsurfer.com/v1",
196
+ token=token,
197
+ timeout=httpx.Timeout(30.0),
198
+ verify_ssl=True,
199
+ headers={"X-Request-Id": "..."},
200
+ raise_on_unexpected_status=True,
201
+ )
202
+ ```
203
+
204
+ Need per-call customisation (e.g. swap the underlying `httpx.Client` for one with a custom transport)? Use `client.with_httpx_client(my_httpx_client)` or `client.set_httpx_client(...)`.
205
+
206
+ ## Regenerating the client
207
+
208
+ The `src/qtsurfer/api/client/_generated/` directory is a committed build artifact produced from the OpenAPI spec hosted at [`QTSurfer/qtsurfer-api`](https://github.com/QTSurfer/qtsurfer-api/blob/main/openapi.yaml). Never hand-edit it.
209
+
210
+ ```bash
211
+ uv sync # install pinned dev deps
212
+ ./scripts/regenerate.sh # fetch spec + regenerate + sync pyproject version
213
+ uv run ruff check src/ tests/
214
+ uv run mypy src/
215
+ uv run pytest -v
216
+ ```
217
+
218
+ Generator configuration lives in `codegen.config.yaml`. The spec URL is hard-coded in `scripts/regenerate.sh`; point it at a tag/commit for fully reproducible builds.
219
+
220
+ ## Development
221
+
222
+ | Command | Description |
223
+ | ------ | ----------- |
224
+ | `uv sync` | Install dependencies from `uv.lock` |
225
+ | `./scripts/regenerate.sh` | Re-fetch spec + regenerate client |
226
+ | `uv run ruff check src/ tests/` | Lint |
227
+ | `uv run ruff format src/ tests/` | Format |
228
+ | `uv run mypy src/` | Type-check (`--strict`) |
229
+ | `uv run pytest -v` | Run tests |
230
+ | `uv run python -m build` | Build wheel + sdist into `dist/` |
231
+
232
+ ## Versioning
233
+
234
+ `pyproject.toml`'s `version` field is kept in lockstep with the `info.version` of the OpenAPI spec by `scripts/regenerate.sh`. Tags pushed to `main` (`vX.Y.Z`) trigger the PyPI publish workflow via OIDC trusted publishing.
235
+
236
+ ## License
237
+
238
+ Apache-2.0 — see [LICENSE](./LICENSE).