realmarketapi-python-sdk-beta 0.1.0b1__tar.gz → 0.1.0b2__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 (14) hide show
  1. {realmarketapi_python_sdk_beta-0.1.0b1/realmarketapi_python_sdk_beta.egg-info → realmarketapi_python_sdk_beta-0.1.0b2}/PKG-INFO +42 -1
  2. {realmarketapi_python_sdk_beta-0.1.0b1 → realmarketapi_python_sdk_beta-0.1.0b2}/README.md +41 -0
  3. {realmarketapi_python_sdk_beta-0.1.0b1 → realmarketapi_python_sdk_beta-0.1.0b2}/pyproject.toml +1 -1
  4. {realmarketapi_python_sdk_beta-0.1.0b1 → realmarketapi_python_sdk_beta-0.1.0b2/realmarketapi_python_sdk_beta.egg-info}/PKG-INFO +42 -1
  5. realmarketapi_python_sdk_beta-0.1.0b2/realmarketapi_sdk/client.py +168 -0
  6. realmarketapi_python_sdk_beta-0.1.0b1/realmarketapi_sdk/client.py +0 -65
  7. {realmarketapi_python_sdk_beta-0.1.0b1 → realmarketapi_python_sdk_beta-0.1.0b2}/LICENSE +0 -0
  8. {realmarketapi_python_sdk_beta-0.1.0b1 → realmarketapi_python_sdk_beta-0.1.0b2}/realmarketapi_python_sdk_beta.egg-info/SOURCES.txt +0 -0
  9. {realmarketapi_python_sdk_beta-0.1.0b1 → realmarketapi_python_sdk_beta-0.1.0b2}/realmarketapi_python_sdk_beta.egg-info/dependency_links.txt +0 -0
  10. {realmarketapi_python_sdk_beta-0.1.0b1 → realmarketapi_python_sdk_beta-0.1.0b2}/realmarketapi_python_sdk_beta.egg-info/requires.txt +0 -0
  11. {realmarketapi_python_sdk_beta-0.1.0b1 → realmarketapi_python_sdk_beta-0.1.0b2}/realmarketapi_python_sdk_beta.egg-info/top_level.txt +0 -0
  12. {realmarketapi_python_sdk_beta-0.1.0b1 → realmarketapi_python_sdk_beta-0.1.0b2}/realmarketapi_sdk/__init__.py +0 -0
  13. {realmarketapi_python_sdk_beta-0.1.0b1 → realmarketapi_python_sdk_beta-0.1.0b2}/realmarketapi_sdk/websocket.py +0 -0
  14. {realmarketapi_python_sdk_beta-0.1.0b1 → realmarketapi_python_sdk_beta-0.1.0b2}/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.0b1
3
+ Version: 0.1.0b2
4
4
  Summary: RealMarketAPI Python SDK beta
5
5
  Requires-Python: >=3.9
6
6
  Description-Content-Type: text/markdown
@@ -187,6 +187,46 @@ Example response payload:
187
187
  }
188
188
  ```
189
189
 
190
+ ### `create_alert(symbol_code, time_frame, rule_type, threshold, cooldown_seconds=300, channels=None)`
191
+
192
+ Creates a new alert rule.
193
+
194
+ ### `get_alerts(status=None)`
195
+
196
+ Returns alert rules, optionally filtered by status.
197
+
198
+ ### `delete_alert(alert_id)`
199
+
200
+ Deletes an alert rule by id.
201
+
202
+ ### `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)`
203
+
204
+ Queries symbols by screener filters.
205
+
206
+ ### `get_strategy_signal(symbol_code, time_frame)`
207
+
208
+ Returns composite strategy signal payload.
209
+
210
+ ### `create_watchlist(name, tags=None, notes=None)`
211
+
212
+ Creates a cloud watchlist.
213
+
214
+ ### `get_watchlists()`
215
+
216
+ Returns watchlist collection.
217
+
218
+ ### `add_watchlist_item(watchlist_id, symbol_code, order=0)`
219
+
220
+ Adds a symbol to a watchlist.
221
+
222
+ ### `remove_watchlist_item(watchlist_id, symbol_code)`
223
+
224
+ Removes a symbol from a watchlist.
225
+
226
+ ### `get_market_calendar(date=None, timezone="UTC")`
227
+
228
+ Returns sessions and high-impact market events.
229
+
190
230
  ## WebSocket streaming methods
191
231
 
192
232
  The WebSocket client exposes async generators and reconnects after transient failures.
@@ -244,6 +284,7 @@ Example message payload:
244
284
  ## Beta scope and compatibility
245
285
 
246
286
  - Current REST coverage: price, candles, history, symbols, SMA.
287
+ - Expanded REST coverage: alerts, screener, strategy signal, watchlist, and market calendar.
247
288
  - Current WebSocket coverage: price and candles.
248
289
  - This package is beta and may receive additive changes before stable `1.0`.
249
290
 
@@ -176,6 +176,46 @@ Example response payload:
176
176
  }
177
177
  ```
178
178
 
179
+ ### `create_alert(symbol_code, time_frame, rule_type, threshold, cooldown_seconds=300, channels=None)`
180
+
181
+ Creates a new alert rule.
182
+
183
+ ### `get_alerts(status=None)`
184
+
185
+ Returns alert rules, optionally filtered by status.
186
+
187
+ ### `delete_alert(alert_id)`
188
+
189
+ Deletes an alert rule by id.
190
+
191
+ ### `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)`
192
+
193
+ Queries symbols by screener filters.
194
+
195
+ ### `get_strategy_signal(symbol_code, time_frame)`
196
+
197
+ Returns composite strategy signal payload.
198
+
199
+ ### `create_watchlist(name, tags=None, notes=None)`
200
+
201
+ Creates a cloud watchlist.
202
+
203
+ ### `get_watchlists()`
204
+
205
+ Returns watchlist collection.
206
+
207
+ ### `add_watchlist_item(watchlist_id, symbol_code, order=0)`
208
+
209
+ Adds a symbol to a watchlist.
210
+
211
+ ### `remove_watchlist_item(watchlist_id, symbol_code)`
212
+
213
+ Removes a symbol from a watchlist.
214
+
215
+ ### `get_market_calendar(date=None, timezone="UTC")`
216
+
217
+ Returns sessions and high-impact market events.
218
+
179
219
  ## WebSocket streaming methods
180
220
 
181
221
  The WebSocket client exposes async generators and reconnects after transient failures.
@@ -233,6 +273,7 @@ Example message payload:
233
273
  ## Beta scope and compatibility
234
274
 
235
275
  - Current REST coverage: price, candles, history, symbols, SMA.
276
+ - Expanded REST coverage: alerts, screener, strategy signal, watchlist, and market calendar.
236
277
  - Current WebSocket coverage: price and candles.
237
278
  - This package is beta and may receive additive changes before stable `1.0`.
238
279
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "realmarketapi-python-sdk-beta"
7
- version = "0.1.0b1"
7
+ version = "0.1.0b2"
8
8
  description = "RealMarketAPI Python SDK beta"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: realmarketapi-python-sdk-beta
3
- Version: 0.1.0b1
3
+ Version: 0.1.0b2
4
4
  Summary: RealMarketAPI Python SDK beta
5
5
  Requires-Python: >=3.9
6
6
  Description-Content-Type: text/markdown
@@ -187,6 +187,46 @@ Example response payload:
187
187
  }
188
188
  ```
189
189
 
190
+ ### `create_alert(symbol_code, time_frame, rule_type, threshold, cooldown_seconds=300, channels=None)`
191
+
192
+ Creates a new alert rule.
193
+
194
+ ### `get_alerts(status=None)`
195
+
196
+ Returns alert rules, optionally filtered by status.
197
+
198
+ ### `delete_alert(alert_id)`
199
+
200
+ Deletes an alert rule by id.
201
+
202
+ ### `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)`
203
+
204
+ Queries symbols by screener filters.
205
+
206
+ ### `get_strategy_signal(symbol_code, time_frame)`
207
+
208
+ Returns composite strategy signal payload.
209
+
210
+ ### `create_watchlist(name, tags=None, notes=None)`
211
+
212
+ Creates a cloud watchlist.
213
+
214
+ ### `get_watchlists()`
215
+
216
+ Returns watchlist collection.
217
+
218
+ ### `add_watchlist_item(watchlist_id, symbol_code, order=0)`
219
+
220
+ Adds a symbol to a watchlist.
221
+
222
+ ### `remove_watchlist_item(watchlist_id, symbol_code)`
223
+
224
+ Removes a symbol from a watchlist.
225
+
226
+ ### `get_market_calendar(date=None, timezone="UTC")`
227
+
228
+ Returns sessions and high-impact market events.
229
+
190
230
  ## WebSocket streaming methods
191
231
 
192
232
  The WebSocket client exposes async generators and reconnects after transient failures.
@@ -244,6 +284,7 @@ Example message payload:
244
284
  ## Beta scope and compatibility
245
285
 
246
286
  - Current REST coverage: price, candles, history, symbols, SMA.
287
+ - Expanded REST coverage: alerts, screener, strategy signal, watchlist, and market calendar.
247
288
  - Current WebSocket coverage: price and candles.
248
289
  - This package is beta and may receive additive changes before stable `1.0`.
249
290
 
@@ -0,0 +1,168 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from typing import Any, Dict, Optional
5
+ from urllib.parse import urlencode
6
+
7
+ import httpx
8
+
9
+
10
+ @dataclass
11
+ class RealMarketApiClient:
12
+ api_key: str
13
+ base_url: str = "https://api.realmarketapi.com"
14
+ timeout_seconds: float = 20.0
15
+
16
+ def __post_init__(self) -> None:
17
+ self.base_url = self.base_url.rstrip("/")
18
+ self._http = httpx.Client(timeout=self.timeout_seconds)
19
+
20
+ def close(self) -> None:
21
+ self._http.close()
22
+
23
+ def get_price(self, symbol_code: str, time_frame: str) -> Dict[str, Any]:
24
+ return self._get("/api/v1/price", {"symbolCode": symbol_code, "timeFrame": time_frame})
25
+
26
+ def get_candles(self, symbol_code: str, time_frame: str) -> Dict[str, Any]:
27
+ return self._get("/api/v1/candle", {"symbolCode": symbol_code, "timeFrame": time_frame})
28
+
29
+ def get_history(
30
+ self,
31
+ symbol_code: str,
32
+ start_time: str,
33
+ end_time: str,
34
+ page_number: int = 1,
35
+ page_size: int = 20,
36
+ ) -> Dict[str, Any]:
37
+ return self._get(
38
+ "/api/v1/history",
39
+ {
40
+ "symbolCode": symbol_code,
41
+ "startTime": start_time,
42
+ "endTime": end_time,
43
+ "pageNumber": str(page_number),
44
+ "pageSize": str(page_size),
45
+ },
46
+ )
47
+
48
+ def get_symbols(self) -> Dict[str, Any]:
49
+ return self._get("/api/v1/symbol", None)
50
+
51
+ def get_sma(self, symbol_code: str, time_frame: str, period: int = 20) -> Dict[str, Any]:
52
+ return self._get(
53
+ "/api/v1/indicator/sma",
54
+ {"symbolCode": symbol_code, "timeFrame": time_frame, "period": str(period)},
55
+ )
56
+
57
+ def create_alert(
58
+ self,
59
+ symbol_code: str,
60
+ time_frame: str,
61
+ rule_type: str,
62
+ threshold: float,
63
+ cooldown_seconds: int = 300,
64
+ channels: Optional[list[str]] = None,
65
+ ) -> Dict[str, Any]:
66
+ return self._post(
67
+ "/api/v1/alerts",
68
+ {
69
+ "symbolCode": symbol_code,
70
+ "timeFrame": time_frame,
71
+ "ruleType": rule_type,
72
+ "threshold": threshold,
73
+ "cooldownSeconds": cooldown_seconds,
74
+ "channels": channels or [],
75
+ },
76
+ )
77
+
78
+ def get_alerts(self, status: Optional[str] = None) -> Dict[str, Any]:
79
+ query: Dict[str, str] = {}
80
+ if status:
81
+ query["status"] = status
82
+ return self._get("/api/v1/alerts", query)
83
+
84
+ def delete_alert(self, alert_id: str) -> Dict[str, Any]:
85
+ return self._delete(f"/api/v1/alerts/{alert_id}")
86
+
87
+ def query_screener(
88
+ self,
89
+ time_frame: str,
90
+ trend: Optional[str] = None,
91
+ min_rsi: Optional[float] = None,
92
+ max_volatility_pct: Optional[float] = None,
93
+ min_liquidity_score: Optional[float] = None,
94
+ sort_field: str = "SignalScore",
95
+ sort_direction: str = "Desc",
96
+ size: int = 25,
97
+ ) -> Dict[str, Any]:
98
+ payload: Dict[str, Any] = {
99
+ "timeFrame": time_frame,
100
+ "sortField": sort_field,
101
+ "sortDirection": sort_direction,
102
+ "size": size,
103
+ }
104
+ if trend is not None:
105
+ payload["trend"] = trend
106
+ if min_rsi is not None:
107
+ payload["minRsi"] = min_rsi
108
+ if max_volatility_pct is not None:
109
+ payload["maxVolatilityPct"] = max_volatility_pct
110
+ if min_liquidity_score is not None:
111
+ payload["minLiquidityScore"] = min_liquidity_score
112
+ return self._post("/api/v1/screener/query", payload)
113
+
114
+ def get_strategy_signal(self, symbol_code: str, time_frame: str) -> Dict[str, Any]:
115
+ return self._get(
116
+ "/api/v1/signals/strategy",
117
+ {"symbolCode": symbol_code, "timeFrame": time_frame},
118
+ )
119
+
120
+ def create_watchlist(
121
+ self, name: str, tags: Optional[list[str]] = None, notes: Optional[str] = None
122
+ ) -> Dict[str, Any]:
123
+ payload: Dict[str, Any] = {"name": name, "tags": tags or []}
124
+ if notes is not None:
125
+ payload["notes"] = notes
126
+ return self._post("/api/v1/watchlists", payload)
127
+
128
+ def get_watchlists(self) -> Dict[str, Any]:
129
+ return self._get("/api/v1/watchlists", None)
130
+
131
+ def add_watchlist_item(self, watchlist_id: str, symbol_code: str, order: int = 0) -> Dict[str, Any]:
132
+ return self._post(
133
+ f"/api/v1/watchlists/{watchlist_id}/items",
134
+ {"symbolCode": symbol_code, "order": order},
135
+ )
136
+
137
+ def remove_watchlist_item(self, watchlist_id: str, symbol_code: str) -> Dict[str, Any]:
138
+ return self._delete(f"/api/v1/watchlists/{watchlist_id}/items/{symbol_code}")
139
+
140
+ def get_market_calendar(self, date: Optional[str] = None, timezone: str = "UTC") -> Dict[str, Any]:
141
+ query: Dict[str, str] = {"timezone": timezone}
142
+ if date:
143
+ query["date"] = date
144
+ return self._get("/api/v1/market-calendar", query)
145
+
146
+ def _get(self, path: str, query: Optional[Dict[str, str]]) -> Dict[str, Any]:
147
+ params: Dict[str, str] = {"apiKey": self.api_key}
148
+ if query:
149
+ params.update(query)
150
+
151
+ url = f"{self.base_url}{path}?{urlencode(params)}"
152
+ response = self._http.get(url)
153
+ response.raise_for_status()
154
+ return response.json()
155
+
156
+ def _post(self, path: str, payload: Dict[str, Any]) -> Dict[str, Any]:
157
+ params: Dict[str, str] = {"apiKey": self.api_key}
158
+ url = f"{self.base_url}{path}?{urlencode(params)}"
159
+ response = self._http.post(url, json=payload)
160
+ response.raise_for_status()
161
+ return response.json()
162
+
163
+ def _delete(self, path: str) -> Dict[str, Any]:
164
+ params: Dict[str, str] = {"apiKey": self.api_key}
165
+ url = f"{self.base_url}{path}?{urlencode(params)}"
166
+ response = self._http.delete(url)
167
+ response.raise_for_status()
168
+ return response.json()
@@ -1,65 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from dataclasses import dataclass
4
- from typing import Any, Dict, Optional
5
- from urllib.parse import urlencode
6
-
7
- import httpx
8
-
9
-
10
- @dataclass
11
- class RealMarketApiClient:
12
- api_key: str
13
- base_url: str = "https://api.realmarketapi.com"
14
- timeout_seconds: float = 20.0
15
-
16
- def __post_init__(self) -> None:
17
- self.base_url = self.base_url.rstrip("/")
18
- self._http = httpx.Client(timeout=self.timeout_seconds)
19
-
20
- def close(self) -> None:
21
- self._http.close()
22
-
23
- def get_price(self, symbol_code: str, time_frame: str) -> Dict[str, Any]:
24
- return self._get("/api/v1/price", {"symbolCode": symbol_code, "timeFrame": time_frame})
25
-
26
- def get_candles(self, symbol_code: str, time_frame: str) -> Dict[str, Any]:
27
- return self._get("/api/v1/candle", {"symbolCode": symbol_code, "timeFrame": time_frame})
28
-
29
- def get_history(
30
- self,
31
- symbol_code: str,
32
- start_time: str,
33
- end_time: str,
34
- page_number: int = 1,
35
- page_size: int = 20,
36
- ) -> Dict[str, Any]:
37
- return self._get(
38
- "/api/v1/history",
39
- {
40
- "symbolCode": symbol_code,
41
- "startTime": start_time,
42
- "endTime": end_time,
43
- "pageNumber": str(page_number),
44
- "pageSize": str(page_size),
45
- },
46
- )
47
-
48
- def get_symbols(self) -> Dict[str, Any]:
49
- return self._get("/api/v1/symbol", None)
50
-
51
- def get_sma(self, symbol_code: str, time_frame: str, period: int = 20) -> Dict[str, Any]:
52
- return self._get(
53
- "/api/v1/indicator/sma",
54
- {"symbolCode": symbol_code, "timeFrame": time_frame, "period": str(period)},
55
- )
56
-
57
- def _get(self, path: str, query: Optional[Dict[str, str]]) -> Dict[str, Any]:
58
- params: Dict[str, str] = {"apiKey": self.api_key}
59
- if query:
60
- params.update(query)
61
-
62
- url = f"{self.base_url}{path}?{urlencode(params)}"
63
- response = self._http.get(url)
64
- response.raise_for_status()
65
- return response.json()