simudyne-pulse 0.9.0.dev5__tar.gz → 0.9.0.dev6__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.
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/PKG-INFO +2 -1
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/README.md +1 -0
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/pyproject.toml +1 -1
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/src/simudyne/resources/data.py +131 -118
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/src/simudyne_pulse.egg-info/PKG-INFO +2 -1
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/tests/test_new_resources.py +31 -5
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/LICENSE +0 -0
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/setup.cfg +0 -0
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/src/simudyne/__init__.py +0 -0
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/src/simudyne/client.py +0 -0
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/src/simudyne/exceptions.py +0 -0
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/src/simudyne/resources/__init__.py +0 -0
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/src/simudyne/resources/api_keys.py +0 -0
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/src/simudyne/resources/fix.py +0 -0
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/src/simudyne/resources/fm.py +0 -0
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/src/simudyne/resources/profile.py +0 -0
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/src/simudyne/resources/simulation.py +0 -0
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/src/simudyne/resources/validation.py +0 -0
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/src/simudyne_pulse.egg-info/SOURCES.txt +0 -0
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/src/simudyne_pulse.egg-info/dependency_links.txt +0 -0
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/src/simudyne_pulse.egg-info/requires.txt +0 -0
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/src/simudyne_pulse.egg-info/top_level.txt +0 -0
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/tests/test_api_contract.py +0 -0
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/tests/test_retries.py +0 -0
- {simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/tests/test_validation.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: simudyne-pulse
|
|
3
|
-
Version: 0.9.0.
|
|
3
|
+
Version: 0.9.0.dev6
|
|
4
4
|
Summary: Python SDK for the Simudyne Pulse synthetic market data API
|
|
5
5
|
Author-email: Simudyne <support@simudyne.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -195,6 +195,7 @@ client = PulseABM(api_key="pk_live_...") # or set SIMUDYNE_API_KEY
|
|
|
195
195
|
|
|
196
196
|
# Days the agent-based model can simulate
|
|
197
197
|
cal = client.data.calibrated_data(symbol="700.HK")
|
|
198
|
+
dates = [d["date"] for d in cal["symbols"][0]["dates"]]
|
|
198
199
|
|
|
199
200
|
# Run it, poll, read the generated book
|
|
200
201
|
job = client.simulation.run(
|
|
@@ -169,6 +169,7 @@ client = PulseABM(api_key="pk_live_...") # or set SIMUDYNE_API_KEY
|
|
|
169
169
|
|
|
170
170
|
# Days the agent-based model can simulate
|
|
171
171
|
cal = client.data.calibrated_data(symbol="700.HK")
|
|
172
|
+
dates = [d["date"] for d in cal["symbols"][0]["dates"]]
|
|
172
173
|
|
|
173
174
|
# Run it, poll, read the generated book
|
|
174
175
|
job = client.simulation.run(
|
|
@@ -9,12 +9,63 @@ Reached as ``client.data``. The three calls are one story:
|
|
|
9
9
|
|
|
10
10
|
A foundation-model run is prompted from anything in ``available_data``; an
|
|
11
11
|
agent-based run needs the day to appear in ``calibrated_data`` first.
|
|
12
|
+
|
|
13
|
+
``available_data`` and ``calibrated_data`` take the same filters and return the
|
|
14
|
+
same rows; the only difference is that the second keeps calibrated days only.
|
|
12
15
|
"""
|
|
13
16
|
|
|
14
17
|
AVAILABLE_DATA_PATH = "/data/available-data"
|
|
15
18
|
CALIBRATED_DATA_PATH = "/data/calibrated-data"
|
|
16
19
|
CALIBRATE_PATH = "/data/calibrate"
|
|
17
20
|
|
|
21
|
+
_FILTERS_DOC = """
|
|
22
|
+
symbol : str, optional
|
|
23
|
+
Exact symbol, e.g. "700" or "TSCO".
|
|
24
|
+
q : str, optional
|
|
25
|
+
Case-insensitive substring match over the symbol (and, for
|
|
26
|
+
calibrated days, the company name).
|
|
27
|
+
provider : str, optional
|
|
28
|
+
Data provider, e.g. "omd" or "bmll".
|
|
29
|
+
exchange : str, optional
|
|
30
|
+
Exchange protocol, e.g. "lse" or "hkex_securities".
|
|
31
|
+
date : str, optional
|
|
32
|
+
One trading date "YYYY-MM-DD". Keeps only instruments with that
|
|
33
|
+
day, and returns only that day. Not with ``date_from``/``date_to``.
|
|
34
|
+
date_from, date_to : str, optional
|
|
35
|
+
A date range "YYYY-MM-DD", inclusive.
|
|
36
|
+
calibration_status : {"calibrated", "failed", "in_progress"}, optional
|
|
37
|
+
Days whose LATEST calibration record says this. ``failed`` covers a
|
|
38
|
+
failure at any stage; the reason is in ``calibration_error``.
|
|
39
|
+
:meth:`calibrated_data` lists calibrated days only, so there
|
|
40
|
+
anything but "calibrated" matches nothing.
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
_ROWS_DOC = """
|
|
44
|
+
``{total, limit, offset, symbols}``, paged by instrument
|
|
45
|
+
(symbol, provider, exchange) so an instrument's dates are never
|
|
46
|
+
truncated; ``total`` is the match count before paging. Each
|
|
47
|
+
instrument has:
|
|
48
|
+
|
|
49
|
+
- symbol, provider, exchange
|
|
50
|
+
- company_name, instrument_type, currency, tick_size, lot_size
|
|
51
|
+
- date_count, calibrated_count, first_date, last_date
|
|
52
|
+
- avg_number_of_msgs, avg_volume_traded: over its calibrated days
|
|
53
|
+
- dates (list of dict), one per day:
|
|
54
|
+
|
|
55
|
+
- date (str), calibrated (bool)
|
|
56
|
+
- calibration_status: "calibrated", "failed", "in_progress", or
|
|
57
|
+
None if the day was never put through calibration, from the
|
|
58
|
+
day's LATEST calibration record
|
|
59
|
+
- calibration_stage, calibration_error, calibration_updated_at,
|
|
60
|
+
pulse_version, number_of_msgs, volume_traded, reference_price
|
|
61
|
+
"""
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _day_params(**filters) -> dict | None:
|
|
65
|
+
"""Query parameters for either catalog call, without unset filters."""
|
|
66
|
+
params = {k: v for k, v in filters.items() if v is not None}
|
|
67
|
+
return params or None
|
|
68
|
+
|
|
18
69
|
|
|
19
70
|
class DataResource:
|
|
20
71
|
"""Browse the market data catalogue and calibrate days in it.
|
|
@@ -27,7 +78,7 @@ class DataResource:
|
|
|
27
78
|
--------
|
|
28
79
|
>>> catalog = client.data.calibrated_data(exchange="hkex_securities")
|
|
29
80
|
>>> for instrument in catalog["symbols"][:3]:
|
|
30
|
-
... print(instrument["symbol"], instrument["
|
|
81
|
+
... print(instrument["symbol"], [d["date"] for d in instrument["dates"][:2]])
|
|
31
82
|
"""
|
|
32
83
|
|
|
33
84
|
def __init__(self, client):
|
|
@@ -41,21 +92,23 @@ class DataResource:
|
|
|
41
92
|
provider: str | None = None,
|
|
42
93
|
exchange: str | None = None,
|
|
43
94
|
date: str | None = None,
|
|
44
|
-
|
|
95
|
+
date_from: str | None = None,
|
|
96
|
+
date_to: str | None = None,
|
|
97
|
+
calibration_status: str | None = None,
|
|
45
98
|
limit: int | None = None,
|
|
46
99
|
offset: int | None = None,
|
|
47
100
|
):
|
|
48
|
-
"""Every symbol-day in the data registry: what EXISTS
|
|
101
|
+
"""Every symbol-day in the data registry: what EXISTS, with its
|
|
102
|
+
calibration state.
|
|
49
103
|
|
|
50
104
|
The raw-data catalogue, so it answers both "what can a foundation model
|
|
51
|
-
be prompted with?" and "what could I calibrate?".
|
|
52
|
-
|
|
53
|
-
|
|
105
|
+
be prompted with?" and "what could I calibrate?". :meth:`calibrated_data`
|
|
106
|
+
takes the same filters and returns the same rows, restricted to
|
|
107
|
+
calibrated days.
|
|
54
108
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
it.
|
|
109
|
+
The catalogue holds the whole vendor universe (~15k symbols) and is
|
|
110
|
+
never returned whole, so narrow it with filters and page through it
|
|
111
|
+
with ``limit`` and ``offset``.
|
|
59
112
|
|
|
60
113
|
Parameters
|
|
61
114
|
----------
|
|
@@ -67,52 +120,27 @@ class DataResource:
|
|
|
67
120
|
``engine="fm"``. A ``production_name`` (e.g. "flow-hkex-1-100M")
|
|
68
121
|
works too, matched as on ``run``. An unknown model raises (404),
|
|
69
122
|
and a name matching more than one model raises (400).
|
|
70
|
-
|
|
71
|
-
Exact symbol, e.g. "700" or "TSCO".
|
|
72
|
-
q : str, optional
|
|
73
|
-
Case-insensitive substring match over the symbol.
|
|
74
|
-
provider : str, optional
|
|
75
|
-
Data provider, e.g. "omd" or "bmll". Narrows further within
|
|
76
|
-
``model_id``'s markets when both are given.
|
|
77
|
-
exchange : str, optional
|
|
78
|
-
Exchange protocol, e.g. "lse" or "hkex_securities".
|
|
79
|
-
date : str, optional
|
|
80
|
-
Trading date "YYYY-MM-DD". Keeps only symbols with data on that
|
|
81
|
-
day, and returns only that day.
|
|
82
|
-
include_calibration_state : bool, default False
|
|
83
|
-
Also return ``calibrated_dates`` and ``calibrated_count`` per
|
|
84
|
-
symbol — which of its days the agent-based model has already
|
|
85
|
-
calibrated. Costs a second query, so it is off by default; it means
|
|
86
|
-
nothing to a foundation model.
|
|
123
|
+
{filters}
|
|
87
124
|
limit : int, optional
|
|
88
|
-
Max
|
|
125
|
+
Max instruments to return (1-200, default 50).
|
|
89
126
|
offset : int, optional
|
|
90
|
-
|
|
127
|
+
Instruments to skip, for paging alongside ``limit``.
|
|
91
128
|
|
|
92
129
|
Returns
|
|
93
130
|
-------
|
|
94
131
|
dict
|
|
95
|
-
|
|
96
|
-
rather than by row so a symbol's dates are never truncated.
|
|
97
|
-
``total`` is the match count before paging. Each symbol has:
|
|
98
|
-
|
|
99
|
-
- symbol (str): the ticker, e.g. "700"
|
|
100
|
-
- provider (str), exchange (str): the market it came from
|
|
101
|
-
- dates (list of str): trading days present, "YYYY-MM-DD"
|
|
102
|
-
- calibrated_dates (list of str), calibrated_count (int): only
|
|
103
|
-
with ``include_calibration_state``
|
|
104
|
-
|
|
105
|
-
``dates`` is always a list of strings, with or without calibration
|
|
106
|
-
state, so a caller never branches on the shape of the response.
|
|
132
|
+
{rows}
|
|
107
133
|
|
|
108
134
|
Raises
|
|
109
135
|
------
|
|
110
136
|
PulseAPIError
|
|
111
137
|
If the key is not pro or demo tier (403); ``model_id`` names a
|
|
112
|
-
model that is not registered (404) or matches more than one
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
138
|
+
model that is not registered (404) or matches more than one (400);
|
|
139
|
+
a date is not ``YYYY-MM-DD``, ``date`` is combined with a range,
|
|
140
|
+
``calibration_status`` is not one of the three values, ``limit`` is
|
|
141
|
+
outside 1-200 or ``offset`` is negative (422); or, with
|
|
142
|
+
``model_id``, the model registry (pulse-orchestrator) could not be
|
|
143
|
+
reached (502).
|
|
116
144
|
|
|
117
145
|
See Also
|
|
118
146
|
--------
|
|
@@ -131,32 +159,30 @@ class DataResource:
|
|
|
131
159
|
|
|
132
160
|
>>> page = client.data.available_data(model_id="pulse-lob-1", limit=20)
|
|
133
161
|
>>> first = page["symbols"][0]
|
|
134
|
-
>>> first["symbol"], first["dates"][:2]
|
|
162
|
+
>>> first["symbol"], [d["date"] for d in first["dates"][:2]]
|
|
135
163
|
('AZN', ['2026-06-22', '2026-06-23'])
|
|
136
164
|
|
|
137
|
-
Which of a symbol's days are
|
|
165
|
+
Which of a symbol's days are calibrated, and why the others failed:
|
|
166
|
+
|
|
167
|
+
>>> entry = client.data.available_data(symbol="700")["symbols"][0]
|
|
168
|
+
>>> entry["date_count"], entry["calibrated_count"]
|
|
169
|
+
(60, 4)
|
|
170
|
+
>>> [(d["date"], d["calibration_error"]) for d in entry["dates"]
|
|
171
|
+
... if d["calibration_status"] == "failed"]
|
|
172
|
+
|
|
173
|
+
Days in a month whose latest calibration failed:
|
|
138
174
|
|
|
139
175
|
>>> page = client.data.available_data(
|
|
140
|
-
...
|
|
176
|
+
... exchange="lse", date_from="2025-07-01", date_to="2025-07-31",
|
|
177
|
+
... calibration_status="failed",
|
|
141
178
|
... )
|
|
142
|
-
>>> entry = page["symbols"][0]
|
|
143
|
-
>>> len(entry["dates"]), entry["calibrated_count"]
|
|
144
|
-
(60, 4)
|
|
145
179
|
"""
|
|
146
|
-
params
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
"exchange": exchange,
|
|
153
|
-
"date": date,
|
|
154
|
-
"include_calibration_state": include_calibration_state or None,
|
|
155
|
-
"limit": limit,
|
|
156
|
-
"offset": offset,
|
|
157
|
-
}.items() if v is not None
|
|
158
|
-
}
|
|
159
|
-
return self._client._request("GET", AVAILABLE_DATA_PATH, params=params or None)
|
|
180
|
+
return self._client._request("GET", AVAILABLE_DATA_PATH, params=_day_params(
|
|
181
|
+
model_id=model_id, symbol=symbol, q=q, provider=provider, exchange=exchange,
|
|
182
|
+
date=date, date_from=date_from, date_to=date_to,
|
|
183
|
+
calibration_status=calibration_status,
|
|
184
|
+
limit=limit, offset=offset,
|
|
185
|
+
))
|
|
160
186
|
|
|
161
187
|
def calibrated_data(
|
|
162
188
|
self,
|
|
@@ -165,31 +191,25 @@ class DataResource:
|
|
|
165
191
|
provider: str | None = None,
|
|
166
192
|
date: str | None = None,
|
|
167
193
|
q: str | None = None,
|
|
194
|
+
date_from: str | None = None,
|
|
195
|
+
date_to: str | None = None,
|
|
196
|
+
calibration_status: str | None = None,
|
|
168
197
|
limit: int | None = None,
|
|
169
198
|
offset: int | None = None,
|
|
170
199
|
):
|
|
171
200
|
"""Symbol-days the agent-based model can simulate: what is CALIBRATED.
|
|
172
201
|
|
|
173
|
-
|
|
202
|
+
A day is calibrated when its LATEST calibration record is a complete
|
|
203
|
+
model calibration, so a later failed re-run takes it out. Every day
|
|
204
|
+
here is a valid ``symbol`` / ``provider`` / ``exchange`` /
|
|
174
205
|
``cal_date`` for
|
|
175
206
|
:meth:`~simudyne.resources.simulation.SimulationResource.run` with
|
|
176
|
-
``engine="abm"``.
|
|
177
|
-
|
|
178
|
-
what moves it across.
|
|
207
|
+
``engine="abm"``. Same filters and same rows as :meth:`available_data`;
|
|
208
|
+
:meth:`calibrate` is what moves a day from there to here.
|
|
179
209
|
|
|
180
210
|
Parameters
|
|
181
211
|
----------
|
|
182
|
-
|
|
183
|
-
Exact symbol, e.g. "700.HK".
|
|
184
|
-
exchange : str, optional
|
|
185
|
-
Exchange protocol, e.g. "hkex_securities".
|
|
186
|
-
provider : str, optional
|
|
187
|
-
Data provider, e.g. "omd" or "bmll".
|
|
188
|
-
date : str, optional
|
|
189
|
-
Calibration date "YYYY-MM-DD". Keeps only instruments calibrated
|
|
190
|
-
on that date, and narrows each one's ``available_dates`` to it.
|
|
191
|
-
q : str, optional
|
|
192
|
-
Case-insensitive substring match over ticker and company name.
|
|
212
|
+
{filters}
|
|
193
213
|
limit : int, optional
|
|
194
214
|
Max instruments to return, 1-1000. Omitted, the whole calibrated
|
|
195
215
|
catalogue comes back — it is far smaller than the registry.
|
|
@@ -199,27 +219,15 @@ class DataResource:
|
|
|
199
219
|
Returns
|
|
200
220
|
-------
|
|
201
221
|
dict
|
|
202
|
-
|
|
203
|
-
:meth:`available_data`, paged by instrument. Each entry has:
|
|
204
|
-
|
|
205
|
-
- symbol (str): the ticker, e.g. "700.HK"
|
|
206
|
-
- company_name (str or None): the issuer's name where the vendor
|
|
207
|
-
reports one
|
|
208
|
-
- provider (str), exchange (str): the market it came from
|
|
209
|
-
- instrument_type, currency, tick_size, lot_size
|
|
210
|
-
- available_dates (list of dict): one per calibrated day, each with
|
|
211
|
-
``date``, ``status``, ``stage``, ``number_of_msgs``,
|
|
212
|
-
``volume_traded`` and ``reference_price``. Any ``date`` here is a
|
|
213
|
-
valid ``cal_date`` to run against
|
|
214
|
-
- avg_number_of_msgs, avg_volume_traded: averaged over the dates
|
|
215
|
-
returned, so a ``date`` filter narrows them too
|
|
222
|
+
{rows}
|
|
216
223
|
|
|
217
224
|
Raises
|
|
218
225
|
------
|
|
219
226
|
PulseAPIError
|
|
220
|
-
If
|
|
221
|
-
|
|
222
|
-
|
|
227
|
+
If a date is not ``YYYY-MM-DD``, ``date`` is combined with a
|
|
228
|
+
range, ``calibration_status`` is not one of the three values,
|
|
229
|
+
``limit`` is outside 1-1000 or ``offset`` is negative (422).
|
|
230
|
+
Available on every tier.
|
|
223
231
|
|
|
224
232
|
See Also
|
|
225
233
|
--------
|
|
@@ -236,7 +244,7 @@ class DataResource:
|
|
|
236
244
|
One instrument, to see which dates it can be run for:
|
|
237
245
|
|
|
238
246
|
>>> hits = client.data.calibrated_data(symbol="700.HK")
|
|
239
|
-
>>> [d["date"] for d in hits["symbols"][0]["
|
|
247
|
+
>>> [d["date"] for d in hits["symbols"][0]["dates"]]
|
|
240
248
|
['2025-09-01', '2025-09-02', '2025-09-03']
|
|
241
249
|
|
|
242
250
|
Everything calibrated on one date, the usual way to pick a date that is
|
|
@@ -248,18 +256,21 @@ class DataResource:
|
|
|
248
256
|
|
|
249
257
|
>>> page = client.data.calibrated_data(q="tencent", limit=10)
|
|
250
258
|
"""
|
|
251
|
-
params
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
259
|
+
return self._client._request("GET", CALIBRATED_DATA_PATH, params=_day_params(
|
|
260
|
+
symbol=symbol, q=q, provider=provider, exchange=exchange,
|
|
261
|
+
date=date, date_from=date_from, date_to=date_to,
|
|
262
|
+
calibration_status=calibration_status,
|
|
263
|
+
limit=limit, offset=offset,
|
|
264
|
+
))
|
|
265
|
+
|
|
266
|
+
# The two calls share their filters and row shape, so their docs share the
|
|
267
|
+
# text too. (Docstrings are None under python -OO.)
|
|
268
|
+
for _method in (available_data, calibrated_data):
|
|
269
|
+
if _method.__doc__:
|
|
270
|
+
_method.__doc__ = _method.__doc__.replace(
|
|
271
|
+
"{filters}", _FILTERS_DOC.strip("\n").lstrip()
|
|
272
|
+
).replace("{rows}", _ROWS_DOC.strip("\n").lstrip())
|
|
273
|
+
del _method
|
|
263
274
|
|
|
264
275
|
def calibrate(
|
|
265
276
|
self,
|
|
@@ -309,18 +320,20 @@ class DataResource:
|
|
|
309
320
|
cal_date : str
|
|
310
321
|
The date as submitted.
|
|
311
322
|
|
|
312
|
-
There is no job id
|
|
313
|
-
|
|
323
|
+
There is no job id. Follow the day in :meth:`available_data`:
|
|
324
|
+
its ``calibration_status`` goes to "calibrated" when the pipeline
|
|
325
|
+
finishes, or to "failed" with the reason in ``calibration_error``.
|
|
314
326
|
|
|
315
327
|
Raises
|
|
316
328
|
------
|
|
317
329
|
PulseAPIError
|
|
318
|
-
If the key is not demo tier (403)
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
330
|
+
If the key is not demo tier (403); ``provider`` or ``exchange`` is
|
|
331
|
+
not a recognised value (422); the day has no market data — a
|
|
332
|
+
weekend, an exchange holiday, a day the vendor did not deliver
|
|
333
|
+
(422); or the calibration service is unreachable (503). A day that
|
|
334
|
+
is queued and then fails shows up in :meth:`available_data` with
|
|
335
|
+
``calibration_status`` "failed" and the reason in
|
|
336
|
+
``calibration_error``.
|
|
324
337
|
|
|
325
338
|
See Also
|
|
326
339
|
--------
|
{simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/src/simudyne_pulse.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: simudyne-pulse
|
|
3
|
-
Version: 0.9.0.
|
|
3
|
+
Version: 0.9.0.dev6
|
|
4
4
|
Summary: Python SDK for the Simudyne Pulse synthetic market data API
|
|
5
5
|
Author-email: Simudyne <support@simudyne.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -195,6 +195,7 @@ client = PulseABM(api_key="pk_live_...") # or set SIMUDYNE_API_KEY
|
|
|
195
195
|
|
|
196
196
|
# Days the agent-based model can simulate
|
|
197
197
|
cal = client.data.calibrated_data(symbol="700.HK")
|
|
198
|
+
dates = [d["date"] for d in cal["symbols"][0]["dates"]]
|
|
198
199
|
|
|
199
200
|
# Run it, poll, read the generated book
|
|
200
201
|
job = client.simulation.run(
|
|
@@ -123,12 +123,38 @@ class TestDataResource:
|
|
|
123
123
|
assert path == "/data/available-data"
|
|
124
124
|
assert kwargs["params"] == {"model_id": "tradefm-hkex", "limit": 5}
|
|
125
125
|
|
|
126
|
-
def
|
|
126
|
+
def test_shared_filters_are_sent(self):
|
|
127
127
|
client = FakeClient([{}, {}])
|
|
128
|
-
DataResource(client).available_data(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
DataResource(client).available_data(
|
|
129
|
+
symbol="700", date_from="2025-07-01", date_to="2025-07-31",
|
|
130
|
+
calibration_status="failed",
|
|
131
|
+
)
|
|
132
|
+
DataResource(client).calibrated_data(q="tencent", calibration_status="calibrated")
|
|
133
|
+
assert client.calls[0][2]["params"] == {
|
|
134
|
+
"symbol": "700", "date_from": "2025-07-01", "date_to": "2025-07-31",
|
|
135
|
+
"calibration_status": "failed",
|
|
136
|
+
}
|
|
137
|
+
assert client.calls[1][2]["params"] == {"q": "tencent", "calibration_status": "calibrated"}
|
|
138
|
+
|
|
139
|
+
def test_calibration_state_flag_is_gone(self):
|
|
140
|
+
# Calibration state is always on each date now, so the opt-in is gone.
|
|
141
|
+
with pytest.raises(TypeError):
|
|
142
|
+
DataResource(FakeClient([{}])).available_data(include_calibration_state=True)
|
|
143
|
+
|
|
144
|
+
def test_both_calls_take_the_same_filters(self):
|
|
145
|
+
import inspect
|
|
146
|
+
available = set(inspect.signature(DataResource.available_data).parameters)
|
|
147
|
+
calibrated = set(inspect.signature(DataResource.calibrated_data).parameters)
|
|
148
|
+
# model_id is the only difference: it narrows the raw registry to what
|
|
149
|
+
# one foundation model accepts.
|
|
150
|
+
assert available - calibrated == {"model_id"}
|
|
151
|
+
assert calibrated - available == set()
|
|
152
|
+
|
|
153
|
+
def test_shared_docs_are_filled_in(self):
|
|
154
|
+
for method in (DataResource.available_data, DataResource.calibrated_data):
|
|
155
|
+
assert "{filters}" not in method.__doc__ and "{rows}" not in method.__doc__
|
|
156
|
+
assert "calibration_status : " in method.__doc__
|
|
157
|
+
assert "calibration_error" in method.__doc__
|
|
132
158
|
|
|
133
159
|
def test_calibrated_data_path(self):
|
|
134
160
|
client = FakeClient([{}])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/src/simudyne/resources/simulation.py
RENAMED
|
File without changes
|
{simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/src/simudyne/resources/validation.py
RENAMED
|
File without changes
|
{simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/src/simudyne_pulse.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/src/simudyne_pulse.egg-info/requires.txt
RENAMED
|
File without changes
|
{simudyne_pulse-0.9.0.dev5 → simudyne_pulse-0.9.0.dev6}/src/simudyne_pulse.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|