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