realmarketapi-python-sdk-beta 0.1.0b1__tar.gz → 0.1.0b3__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 (19) hide show
  1. realmarketapi_python_sdk_beta-0.1.0b3/PKG-INFO +422 -0
  2. realmarketapi_python_sdk_beta-0.1.0b3/README.md +411 -0
  3. {realmarketapi_python_sdk_beta-0.1.0b1 → realmarketapi_python_sdk_beta-0.1.0b3}/pyproject.toml +1 -1
  4. realmarketapi_python_sdk_beta-0.1.0b3/realmarketapi_python_sdk_beta.egg-info/PKG-INFO +422 -0
  5. {realmarketapi_python_sdk_beta-0.1.0b1 → realmarketapi_python_sdk_beta-0.1.0b3}/realmarketapi_python_sdk_beta.egg-info/SOURCES.txt +3 -1
  6. realmarketapi_python_sdk_beta-0.1.0b3/realmarketapi_sdk/client.py +464 -0
  7. {realmarketapi_python_sdk_beta-0.1.0b1 → realmarketapi_python_sdk_beta-0.1.0b3}/realmarketapi_sdk/websocket.py +16 -2
  8. realmarketapi_python_sdk_beta-0.1.0b3/tests/test_client.py +182 -0
  9. realmarketapi_python_sdk_beta-0.1.0b3/tests/test_websocket.py +73 -0
  10. realmarketapi_python_sdk_beta-0.1.0b1/PKG-INFO +0 -252
  11. realmarketapi_python_sdk_beta-0.1.0b1/README.md +0 -241
  12. realmarketapi_python_sdk_beta-0.1.0b1/realmarketapi_python_sdk_beta.egg-info/PKG-INFO +0 -252
  13. realmarketapi_python_sdk_beta-0.1.0b1/realmarketapi_sdk/client.py +0 -65
  14. {realmarketapi_python_sdk_beta-0.1.0b1 → realmarketapi_python_sdk_beta-0.1.0b3}/LICENSE +0 -0
  15. {realmarketapi_python_sdk_beta-0.1.0b1 → realmarketapi_python_sdk_beta-0.1.0b3}/realmarketapi_python_sdk_beta.egg-info/dependency_links.txt +0 -0
  16. {realmarketapi_python_sdk_beta-0.1.0b1 → realmarketapi_python_sdk_beta-0.1.0b3}/realmarketapi_python_sdk_beta.egg-info/requires.txt +0 -0
  17. {realmarketapi_python_sdk_beta-0.1.0b1 → realmarketapi_python_sdk_beta-0.1.0b3}/realmarketapi_python_sdk_beta.egg-info/top_level.txt +0 -0
  18. {realmarketapi_python_sdk_beta-0.1.0b1 → realmarketapi_python_sdk_beta-0.1.0b3}/realmarketapi_sdk/__init__.py +0 -0
  19. {realmarketapi_python_sdk_beta-0.1.0b1 → realmarketapi_python_sdk_beta-0.1.0b3}/setup.cfg +0 -0
@@ -0,0 +1,422 @@
1
+ Metadata-Version: 2.4
2
+ Name: realmarketapi-python-sdk-beta
3
+ Version: 0.1.0b3
4
+ Summary: RealMarketAPI Python SDK beta
5
+ Requires-Python: >=3.9
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: httpx>=0.27.0
9
+ Requires-Dist: websockets>=12.0
10
+ Dynamic: license-file
11
+
12
+ # RealMarketAPI Python SDK (Beta)
13
+
14
+ Official beta Python SDK for RealMarketAPI REST and WebSocket market data endpoints.
15
+
16
+ Website: [https://realmarketapi.com/](https://realmarketapi.com/)
17
+
18
+ ## Why use this SDK
19
+
20
+ - Thin Python wrapper for RealMarketAPI HTTP and streaming APIs.
21
+ - Simple class-based client for request/response usage.
22
+ - Async WebSocket streams with automatic reconnect behavior.
23
+ - Small dependency footprint (`httpx`, `websockets`).
24
+
25
+ ## Requirements
26
+
27
+ - Python 3.9+
28
+ - RealMarketAPI API key
29
+
30
+ ## Install
31
+
32
+ ```bash
33
+ pip install realmarketapi-python-sdk-beta
34
+ ```
35
+
36
+ ## Quick start
37
+
38
+ ### REST client
39
+
40
+ ```python
41
+ from realmarketapi_sdk import RealMarketApiClient
42
+
43
+ client = RealMarketApiClient(api_key="YOUR_API_KEY")
44
+
45
+ try:
46
+ price = client.get_price("EURUSD", "M1")
47
+ print("Close:", price.get("closePrice"))
48
+ finally:
49
+ client.close()
50
+ ```
51
+
52
+ ### WebSocket client
53
+
54
+ ```python
55
+ import asyncio
56
+ from realmarketapi_sdk import RealMarketApiWebSocket
57
+
58
+ ws = RealMarketApiWebSocket(api_key="YOUR_API_KEY")
59
+
60
+ async def main() -> None:
61
+ async for tick in ws.stream_price("BTCUSDT", "M1"):
62
+ print(tick)
63
+
64
+ asyncio.run(main())
65
+ ```
66
+
67
+ ## REST API methods
68
+
69
+ All REST methods return a Python `dict` parsed from JSON and include your API key as query parameter.
70
+
71
+ ### `get_price(symbol_code, time_frame)`
72
+
73
+ Example:
74
+
75
+ ```python
76
+ price = client.get_price("EURUSD", "M1")
77
+ ```
78
+
79
+ Example response payload:
80
+
81
+ ```json
82
+ {
83
+ "symbolCode": "EURUSD",
84
+ "openPrice": 1.07874,
85
+ "highPrice": 1.07882,
86
+ "lowPrice": 1.07868,
87
+ "closePrice": 1.07879,
88
+ "volume": 152.0,
89
+ "openTime": "2026-05-21T09:12:00Z",
90
+ "bid": 1.07877,
91
+ "ask": 1.07881
92
+ }
93
+ ```
94
+
95
+ ### `get_cross_price(symbol_code, time_frame)`
96
+
97
+ Latest price of a pair that isn't listed directly, derived from listed pairs (XAUVND = XAUUSD × USDVND, VNDUSD = 1 / USDVND). Every leg must be on your plan. High, low and volume are not available.
98
+
99
+ ```python
100
+ xau_vnd = client.get_cross_price("XAUVND", "M1")
101
+ ```
102
+
103
+ Example response payload:
104
+
105
+ ```json
106
+ {
107
+ "symbolCode": "XAUVND",
108
+ "baseCurrency": "XAU",
109
+ "quoteCurrency": "VND",
110
+ "timeFrame": "M1",
111
+ "bid": 106558131.0,
112
+ "ask": 106647032.0,
113
+ "openPrice": 106540000.0,
114
+ "closePrice": 106600000.0,
115
+ "openTime": "2026-11-21T09:12:00Z",
116
+ "legs": [
117
+ {"symbolCode": "XAUUSD", "from": "XAU", "to": "USD", "inverted": false, "bid": 4050.1, "ask": 4050.4, "openPrice": 4049.5, "closePrice": 4050.2, "openTime": "2026-11-21T09:12:00Z"},
118
+ {"symbolCode": "USDVND", "from": "USD", "to": "VND", "inverted": false, "bid": 26310.0, "ask": 26330.0, "openPrice": 26309.0, "closePrice": 26320.0, "openTime": "2026-11-21T09:12:00Z"}
119
+ ]
120
+ }
121
+ ```
122
+
123
+ ### `get_market_prices()`, `get_price_by_category(category)`, `get_24hr_stats()`
124
+
125
+ Snapshots for every symbol on your plan (or one category such as `"Forex"`), and rolling 24-hour stats.
126
+
127
+ ```python
128
+ market = client.get_market_prices() # {"data": [...], "totalCount": n}
129
+ forex = client.get_price_by_category("Forex")
130
+ stats = client.get_24hr_stats()
131
+ ```
132
+
133
+ ### `get_candles(symbol_code, time_frame)`
134
+
135
+ Example:
136
+
137
+ ```python
138
+ candles = client.get_candles("BTCUSDT", "M5")
139
+ ```
140
+
141
+ Example response payload:
142
+
143
+ ```json
144
+ {
145
+ "data": [
146
+ {
147
+ "symbolCode": "BTCUSDT",
148
+ "openTime": "2026-05-21T09:10:00Z",
149
+ "openPrice": 68620.3,
150
+ "highPrice": 68690.1,
151
+ "lowPrice": 68588.7,
152
+ "closePrice": 68655.8,
153
+ "volume": 128.42
154
+ }
155
+ ],
156
+ "totalCount": 1
157
+ }
158
+ ```
159
+
160
+ ### `get_history(symbol_code, start_time, end_time, page_number=1, page_size=20)`
161
+
162
+ Example:
163
+
164
+ ```python
165
+ history = client.get_history(
166
+ symbol_code="EURUSD",
167
+ start_time="2026-05-20T00:00:00Z",
168
+ end_time="2026-05-21T00:00:00Z",
169
+ page_number=1,
170
+ page_size=20,
171
+ )
172
+ ```
173
+
174
+ Example response payload:
175
+
176
+ ```json
177
+ {
178
+ "currentPage": 1,
179
+ "pageSize": 20,
180
+ "totalPages": 14,
181
+ "totalCount": 280,
182
+ "data": [
183
+ {
184
+ "openTime": "2026-05-20T00:00:00Z",
185
+ "openPrice": 1.07913,
186
+ "highPrice": 1.07942,
187
+ "lowPrice": 1.07898,
188
+ "closePrice": 1.07920,
189
+ "volume": 241.11
190
+ }
191
+ ]
192
+ }
193
+ ```
194
+
195
+ ### `get_symbols(market_class=None)`
196
+
197
+ Example:
198
+
199
+ ```python
200
+ symbols = client.get_symbols()
201
+ crypto = client.get_symbols(market_class="Crypto")
202
+ ```
203
+
204
+ Example response payload:
205
+
206
+ ```json
207
+ {
208
+ "data": [
209
+ {"symbolCode": "XAUUSD", "displayName": "Gold / US Dollar", "marketClass": "Commodity"}
210
+ ],
211
+ "totalCount": 1
212
+ }
213
+ ```
214
+
215
+ ### `get_cross_symbols(base_currency=None, quote_currency=None)`
216
+
217
+ Cross pairs `get_cross_price` can derive, with the listed symbols each one is built from. Listed symbols themselves are not included.
218
+
219
+ ```python
220
+ crosses = client.get_cross_symbols(base_currency="XAU", quote_currency="VND")
221
+ ```
222
+
223
+ Example response payload:
224
+
225
+ ```json
226
+ {
227
+ "data": [
228
+ {"symbolCode": "XAUVND", "displayName": "XAU/VND", "baseCurrency": "XAU", "quoteCurrency": "VND", "legs": ["XAUUSD", "USDVND"]}
229
+ ],
230
+ "totalCount": 1
231
+ }
232
+ ```
233
+
234
+ ### `get_me()`
235
+
236
+ Plan code, request count/limit, usage percentage and WebSocket limits for your API key.
237
+
238
+ ### `get_sma(symbol_code, time_frame, period=20)`
239
+
240
+ Example:
241
+
242
+ ```python
243
+ sma = client.get_sma("EURUSD", "M15", period=50)
244
+ ```
245
+
246
+ Example response payload:
247
+
248
+ ```json
249
+ {
250
+ "data": [
251
+ {"openTime": "2026-05-21T09:00:00Z", "value": 1.08024}
252
+ ],
253
+ "totalCount": 1
254
+ }
255
+ ```
256
+
257
+ ### Other indicators
258
+
259
+ All take `(symbol_code, time_frame, ...)`; defaults match the API.
260
+
261
+ | Method | Extra params (default) |
262
+ |---|---|
263
+ | `get_ema` | `period=20` |
264
+ | `get_wma` | `period=20` |
265
+ | `get_rsi` | `period=14` |
266
+ | `get_macd` | `fast_period=12, slow_period=26, signal_period=9` |
267
+ | `get_bollinger_bands` | `period=20, multiplier=2.0` |
268
+ | `get_stochastic` | `k_period=14, d_period=3` |
269
+ | `get_atr` | `period=14` |
270
+ | `get_cci` | `period=20` |
271
+ | `get_williams_r` | `period=14` |
272
+ | `get_adx` | `period=14` |
273
+ | `get_fibonacci` | `lookback=100` |
274
+ | `get_support_resistance` | none |
275
+ | `get_sentiment` | none |
276
+
277
+ ```python
278
+ macd = client.get_macd("XAUUSD", "H1")
279
+ bands = client.get_bollinger_bands("BTCUSD", "M15", multiplier=2.5)
280
+ ```
281
+
282
+ ### Volatility
283
+
284
+ | Method | Extra params (default) |
285
+ |---|---|
286
+ | `get_volatility(symbol_code, time_frame, period=14)` | `period` |
287
+ | `get_volatility_spikes(symbol_code, time_frame, period=14, spike_multiplier=2.0)` | `period`, `spike_multiplier` |
288
+ | `get_volatility_heatmap(symbol_code, time_frame)` | none |
289
+
290
+ ### Market analysis
291
+
292
+ - `get_anomaly(symbol_code, time_frame)`
293
+ - `get_liquidity_zones(symbol_code, time_frame)`
294
+ - `get_manipulation_risk(symbol_code, time_frame)`
295
+ - `get_order_flow_imbalance(symbol_code, time_frame)`
296
+ - `get_stop_hunt_zones(symbol_code, time_frame)`
297
+ - `get_multi_timeframe(symbol_code)`: trend label per timeframe
298
+
299
+ ### Insight
300
+
301
+ - `get_insight_next(symbol_code, time_frame)`: bias, bull/bear score, targets, signals
302
+ - `get_insight_trend(symbol_code, time_frame)`
303
+ - `get_insight_setup(symbol_code, time_frame)`
304
+ - `get_insight_confluence(symbol_code, time_frame)`
305
+ - `get_insight_score(symbol_code, time_frame)`: 0–100 score and label
306
+
307
+ ```python
308
+ nxt = client.get_insight_next("XAUUSD", "H1")
309
+ print(nxt["bias"], nxt["targetUp"], nxt["targetDown"])
310
+ ```
311
+
312
+ ### `create_alert(symbol_code, time_frame, rule_type, threshold, cooldown_seconds=300, channels=None)`
313
+
314
+ Creates a new alert rule.
315
+
316
+ ### `get_alerts(status=None)`
317
+
318
+ Returns alert rules, optionally filtered by status.
319
+
320
+ ### `delete_alert(alert_id)`
321
+
322
+ Deletes an alert rule by id.
323
+
324
+ ### `query_screener(time_frame, trend=None, min_rsi=None, max_volatility_pct=None, min_liquidity_score=None, sort_field="SignalScore", sort_direction="Desc", size=25)`
325
+
326
+ Queries symbols by screener filters.
327
+
328
+ ### `get_strategy_signal(symbol_code, time_frame)`
329
+
330
+ Returns composite strategy signal payload.
331
+
332
+ ### `create_watchlist(name, tags=None, notes=None)`
333
+
334
+ Creates a cloud watchlist.
335
+
336
+ ### `get_watchlists()`
337
+
338
+ Returns watchlist collection.
339
+
340
+ ### `add_watchlist_item(watchlist_id, symbol_code, order=0)`
341
+
342
+ Adds a symbol to a watchlist.
343
+
344
+ ### `remove_watchlist_item(watchlist_id, symbol_code)`
345
+
346
+ Removes a symbol from a watchlist.
347
+
348
+ ### `get_market_calendar(date=None, timezone="UTC")`
349
+
350
+ Returns sessions and high-impact market events.
351
+
352
+ ## WebSocket streaming methods
353
+
354
+ The WebSocket client exposes async generators and reconnects after transient failures.
355
+
356
+ ### `stream_price(symbol_code, time_frame)`
357
+
358
+ Example:
359
+
360
+ ```python
361
+ async for event in ws.stream_price("EURUSD", "M1"):
362
+ print(event)
363
+ ```
364
+
365
+ Example message payload:
366
+
367
+ ```json
368
+ {
369
+ "symbolCode": "EURUSD",
370
+ "closePrice": 1.07879,
371
+ "openTime": "2026-05-21T09:12:00Z"
372
+ }
373
+ ```
374
+
375
+ ### `stream_candles(symbol_code, time_frame)`
376
+
377
+ Example:
378
+
379
+ ```python
380
+ async for event in ws.stream_candles("BTCUSDT", "M5"):
381
+ print(event)
382
+ ```
383
+
384
+ Example message payload:
385
+
386
+ ```json
387
+ {
388
+ "symbolCode": "BTCUSDT",
389
+ "openTime": "2026-05-21T09:10:00Z",
390
+ "openPrice": 68620.3,
391
+ "highPrice": 68690.1,
392
+ "lowPrice": 68588.7,
393
+ "closePrice": 68655.8,
394
+ "volume": 128.42
395
+ }
396
+ ```
397
+
398
+ ### `stream_order_flow_imbalance(symbol_code, time_frame)`, `stream_multi_timeframe(symbol_code)`, `stream_market()`
399
+
400
+ Order flow imbalance updates, multi-timeframe trend updates, and full-market snapshots (each `stream_market` message is a list with one entry per symbol).
401
+
402
+ ```python
403
+ async for snapshot in ws.stream_market():
404
+ print(len(snapshot), "symbols")
405
+ ```
406
+
407
+ ## Error handling notes
408
+
409
+ - REST methods call `response.raise_for_status()`, so HTTP 4xx/5xx responses raise `httpx.HTTPStatusError`.
410
+ - WebSocket streams retry on connection errors using `reconnect_delay_seconds` (default `2.0`).
411
+ - Cancel the async task to stop streaming cleanly.
412
+
413
+ ## Beta scope and compatibility
414
+
415
+ - REST coverage matches the .NET SDK: prices (single, market, category, 24h), candles, history, symbols, account (`get_me`), all indicators, volatility, anomaly, liquidity, manipulation risk, order flow, stop hunt, multi-timeframe, insight, alerts, screener, strategy signal, watchlists and market calendar.
416
+ - WebSocket coverage: price, candles, order flow imbalance, multi-timeframe and market.
417
+ - Not included: the MCP client (use any MCP client against the RealMarketAPI MCP server).
418
+ - This package is beta and may receive additive changes before stable `1.0`.
419
+
420
+ ## Links
421
+
422
+ - RealMarketAPI homepage: [https://realmarketapi.com/](https://realmarketapi.com/)