HedgeTech 0.1.0__py3-none-any.whl → 0.2.2b0__py3-none-any.whl
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.
- HedgeTech/Auth/__AuthAsyncClient.py +16 -12
- HedgeTech/Auth/__AuthSyncClient.py +18 -14
- HedgeTech/Auth/__utils/__RetriableAsyncClient.py +63 -0
- HedgeTech/Auth/__utils/__RetriableSyncClient.py +65 -0
- HedgeTech/Auth/__utils/__init__.py +2 -0
- HedgeTech/DataEngine/__tse_ifb/__io_types/__init__.py +0 -5
- HedgeTech/EmsEngine/__init__.py +4 -0
- HedgeTech/EmsEngine/__tse_ifb/__AsyncClient.py +757 -0
- HedgeTech/EmsEngine/__tse_ifb/__SyncClient.py +790 -0
- HedgeTech/EmsEngine/__tse_ifb/__init__.py +2 -0
- HedgeTech/EmsEngine/__tse_ifb/__io_types/__init__.py +4 -0
- HedgeTech/EmsEngine/__tse_ifb/__io_types/__response.py +29 -0
- {hedgetech-0.1.0.dist-info → hedgetech-0.2.2b0.dist-info}/METADATA +92 -9
- hedgetech-0.2.2b0.dist-info/RECORD +24 -0
- {hedgetech-0.1.0.dist-info → hedgetech-0.2.2b0.dist-info}/WHEEL +1 -1
- HedgeTech/DataEngine/__tse_ifb/__io_types/__requests.py +0 -47
- hedgetech-0.1.0.dist-info/RECORD +0 -16
- {hedgetech-0.1.0.dist-info → hedgetech-0.2.2b0.dist-info}/licenses/LICENSE +0 -0
- {hedgetech-0.1.0.dist-info → hedgetech-0.2.2b0.dist-info}/licenses/NOTICE +0 -0
- {hedgetech-0.1.0.dist-info → hedgetech-0.2.2b0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# ========================================|======================================== #
|
|
2
|
+
# Imports #
|
|
3
|
+
# ========================================|======================================== #
|
|
4
|
+
|
|
5
|
+
from typing import (
|
|
6
|
+
NewType,
|
|
7
|
+
TypedDict,
|
|
8
|
+
Literal,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
# ========================================|======================================== #
|
|
12
|
+
# Class Definitions #
|
|
13
|
+
# ========================================|======================================== #
|
|
14
|
+
|
|
15
|
+
HexUUID = NewType("HexUUID", str)
|
|
16
|
+
|
|
17
|
+
# +--------------------------------------------------------------------------------------+ #
|
|
18
|
+
|
|
19
|
+
class OrderStatus(TypedDict):
|
|
20
|
+
|
|
21
|
+
order_uuid : HexUUID
|
|
22
|
+
order_status : Literal['InQueue','Cancelled','Broken','Settled']
|
|
23
|
+
Price : int
|
|
24
|
+
Volume : int
|
|
25
|
+
RemainedVolume : int
|
|
26
|
+
ExecutedVolume : int
|
|
27
|
+
OrderSide : Literal['Buy','Sell']
|
|
28
|
+
ValidityType : Literal['DAY','GTC','GTD']
|
|
29
|
+
ValidityDate : int
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: HedgeTech
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.2b0
|
|
4
4
|
Summary: A unified, high-performance API layer that powers all trading infrastructure across the HedgeTech ecosystem, providing modular, scalable, and real-time interfaces for market data, order management, and execution systems.
|
|
5
5
|
Author-email: "hedgetech.ir" <info@hedgetech.ir>
|
|
6
6
|
License: Apache License
|
|
@@ -212,6 +212,7 @@ Requires-Dist: brotli<=1.2.0
|
|
|
212
212
|
Requires-Dist: zstd<=1.5.7.2
|
|
213
213
|
Requires-Dist: PyJWT<=2.10.1
|
|
214
214
|
Requires-Dist: websockets<=15.0.1
|
|
215
|
+
Requires-Dist: pillow<=12.0.0
|
|
215
216
|
Dynamic: license-file
|
|
216
217
|
|
|
217
218
|
# HedgeTech Python SDK
|
|
@@ -224,6 +225,7 @@ HedgeTech Python SDK is a professional, lightweight, and modular Python package
|
|
|
224
225
|
|
|
225
226
|
* Secure authentication with both async and sync clients.
|
|
226
227
|
* Real-time and historical market data retrieval from TSE & IFB.
|
|
228
|
+
* Full EMS Engine order management (buy/sell, edit, status, delete) for both Sync and Async workflows.
|
|
227
229
|
* Modular and maintainable architecture, designed to support multiple engines (DataEngine engines, WebSocket clients, etc.).
|
|
228
230
|
* Structured request and response types for robust data handling.
|
|
229
231
|
* Fully asynchronous support for high-performance applications.
|
|
@@ -249,11 +251,11 @@ pip install --upgrade HedgeTech
|
|
|
249
251
|
|
|
250
252
|
The SDK exposes all major clients through the top-level modules, so you generally do **not** need to import internal implementation files directly.
|
|
251
253
|
|
|
252
|
-
|
|
254
|
+
## Authentication
|
|
253
255
|
|
|
254
256
|
> **Note:** Make sure to use the matching async or sync Auth client depending on your workflow.
|
|
255
257
|
|
|
256
|
-
|
|
258
|
+
### Async Authentication
|
|
257
259
|
|
|
258
260
|
```python
|
|
259
261
|
from HedgeTech.Auth import AuthAsyncClient
|
|
@@ -265,7 +267,7 @@ auth_async_client = await AuthAsyncClient.login(
|
|
|
265
267
|
print(auth_async_client.token)
|
|
266
268
|
```
|
|
267
269
|
|
|
268
|
-
|
|
270
|
+
### Sync Authentication
|
|
269
271
|
|
|
270
272
|
```python
|
|
271
273
|
from HedgeTech.Auth import AuthSyncClient
|
|
@@ -277,13 +279,13 @@ auth_sync_client = AuthSyncClient.login(
|
|
|
277
279
|
print(auth_sync_client.token)
|
|
278
280
|
```
|
|
279
281
|
|
|
280
|
-
|
|
282
|
+
## DataEngine / TSE IFB
|
|
281
283
|
|
|
282
284
|
The DataEngine is designed to support multiple engines in a modular way. Each engine provides its own async and sync clients, structured request and response types, and can be integrated with other engines such as WebSocket clients.
|
|
283
285
|
|
|
284
286
|
> **Important Note on Sync vs Async:** All clients have the **same method names and behavior** in both Sync and Async versions. The only difference is how they execute: Sync runs in a blocking manner, while Async requires `await` and an event loop. This design allows you to switch between Sync and Async without changing the logic or input/output of your code.
|
|
285
287
|
|
|
286
|
-
|
|
288
|
+
### Async Data Client
|
|
287
289
|
|
|
288
290
|
```python
|
|
289
291
|
from HedgeTech.DataEngine import DataEngine_TseIfb_AsyncClient
|
|
@@ -300,11 +302,10 @@ async for update in client.websocket_by_name(
|
|
|
300
302
|
channels=["best-limit", "order-book"],
|
|
301
303
|
symbol_names=["فملی","اطلس"]
|
|
302
304
|
):
|
|
303
|
-
|
|
304
305
|
print(update["data"])
|
|
305
306
|
```
|
|
306
307
|
|
|
307
|
-
|
|
308
|
+
### Sync Data Client
|
|
308
309
|
|
|
309
310
|
```python
|
|
310
311
|
from HedgeTech.DataEngine import DataEngine_TseIfb_SyncClient
|
|
@@ -325,10 +326,83 @@ for update in client.websocket_by_isin(
|
|
|
325
326
|
channels=["best-limit", "order-book"],
|
|
326
327
|
symbol_isins=["IR1234567890"]
|
|
327
328
|
):
|
|
328
|
-
|
|
329
329
|
print(update["data"])
|
|
330
330
|
```
|
|
331
331
|
|
|
332
|
+
## EMS Engine / Order Management
|
|
333
|
+
|
|
334
|
+
The SDK provides full **order lifecycle management** for TSE/IFB markets. You can create, edit, delete, and check the status of buy/sell orders with both Sync and Async clients.
|
|
335
|
+
|
|
336
|
+
### Features
|
|
337
|
+
|
|
338
|
+
* Create buy/sell orders by symbol name or ISIN.
|
|
339
|
+
* Edit orders (price, volume, validity type/date).
|
|
340
|
+
* Retrieve current order status including executed and remaining volume.
|
|
341
|
+
* Delete/cancel orders.
|
|
342
|
+
* Fully Async/Sync compatible with identical method names.
|
|
343
|
+
|
|
344
|
+
### Async Example
|
|
345
|
+
|
|
346
|
+
```python
|
|
347
|
+
from HedgeTech.EMSEngine import EmsEngine_TseIfb_AsyncClient
|
|
348
|
+
|
|
349
|
+
ems_client = EmsEngine_TseIfb_AsyncClient(auth_async_client)
|
|
350
|
+
|
|
351
|
+
# Login to OMS
|
|
352
|
+
await ems_client.oms_login("username", "password", "captcha_value")
|
|
353
|
+
|
|
354
|
+
# Create a buy order
|
|
355
|
+
order = await ems_client.Buy_by_Name(
|
|
356
|
+
symbolName="اطلس",
|
|
357
|
+
Price=100000,
|
|
358
|
+
Volume=10
|
|
359
|
+
)
|
|
360
|
+
await order.send()
|
|
361
|
+
|
|
362
|
+
# Check status
|
|
363
|
+
status = await order.Status()
|
|
364
|
+
print(status)
|
|
365
|
+
|
|
366
|
+
# Edit order
|
|
367
|
+
await order.Edit(Price=105000, Volume=12)
|
|
368
|
+
|
|
369
|
+
# Delete order
|
|
370
|
+
await order.Delete()
|
|
371
|
+
print(order.is_deleted) # True
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Sync Example
|
|
375
|
+
|
|
376
|
+
```python
|
|
377
|
+
from HedgeTech.EMSEngine import EmsEngine_TseIfb_SyncClient
|
|
378
|
+
|
|
379
|
+
ems_client = EmsEngine_TseIfb_SyncClient(auth_sync_client)
|
|
380
|
+
|
|
381
|
+
# Login to OMS
|
|
382
|
+
ems_client.oms_login("username", "password", "captcha_value")
|
|
383
|
+
|
|
384
|
+
# Create a sell order
|
|
385
|
+
order = ems_client.Sell_by_Name(
|
|
386
|
+
symbolName="فملی",
|
|
387
|
+
Price=50000,
|
|
388
|
+
Volume=5
|
|
389
|
+
)
|
|
390
|
+
order.send()
|
|
391
|
+
|
|
392
|
+
# Check status
|
|
393
|
+
status = order.Status()
|
|
394
|
+
print(status)
|
|
395
|
+
|
|
396
|
+
# Edit order
|
|
397
|
+
order.Edit(Price=52000, Volume=6)
|
|
398
|
+
|
|
399
|
+
# Delete order
|
|
400
|
+
order.Delete()
|
|
401
|
+
print(order.is_deleted) # True
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
> All methods for Async and Sync clients have the same parameters and naming for easy switching.
|
|
405
|
+
|
|
332
406
|
## Important Notes for Users
|
|
333
407
|
|
|
334
408
|
* This SDK requires Python >=3.10.
|
|
@@ -352,6 +426,15 @@ Handles interactions with the Tehran Stock Exchange IFB and other engines. Provi
|
|
|
352
426
|
* Structured request and response types for predictable and robust data handling.
|
|
353
427
|
* Modular design that allows integration of additional engines, such as WebSocket clients or future data engines, without modifying the main interface.
|
|
354
428
|
|
|
429
|
+
### HedgeTech.EMSEngine
|
|
430
|
+
|
|
431
|
+
Handles TSE/IFB order management (EMS Engine):
|
|
432
|
+
|
|
433
|
+
* `EmsEngine_TseIfb_AsyncClient` / `EmsEngine_TseIfb_SyncClient`
|
|
434
|
+
* `Order` class for individual order lifecycle
|
|
435
|
+
* Methods: `Buy_by_Name`, `Sell_by_Name`, `Buy_by_isin`, `Sell_by_isin`, `Edit`, `Status`, `Delete`
|
|
436
|
+
* Fully compatible with both Async and Sync workflows
|
|
437
|
+
|
|
355
438
|
## Contributing
|
|
356
439
|
|
|
357
440
|
We welcome contributions from the community! Please follow standard Python coding conventions, write clear documentation for any new features, and submit pull requests for improvements or bug fixes.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
HedgeTech/Auth/__AuthAsyncClient.py,sha256=IgV6f4bycGjIcyttmtqFLm4m_nzxH3S8QlQLKEHkyGQ,5050
|
|
2
|
+
HedgeTech/Auth/__AuthSyncClient.py,sha256=aSk_3q-AGTY4TFT_5q5pzteJVQk6yitw0liT5lkiNdg,4979
|
|
3
|
+
HedgeTech/Auth/__init__.py,sha256=2Ek8ZkhrRi0D7ewhMH4pyK0iqxe_FfpGBSEIu3-tsik,91
|
|
4
|
+
HedgeTech/Auth/__utils/__RetriableAsyncClient.py,sha256=TVaGrX1QdwKgsKUjBZFyBTyjGtgzBnH-TWkFhFG010Q,1899
|
|
5
|
+
HedgeTech/Auth/__utils/__RetriableSyncClient.py,sha256=dNq3SquxjDzvy3_zPz6nVU6Vv9SBIa-_neGg_mfY3qE,1880
|
|
6
|
+
HedgeTech/Auth/__utils/__init__.py,sha256=RV0K2gIq6ePb0he32i5x6HsU6kZ_8J3cqe5lxAqrov0,75
|
|
7
|
+
HedgeTech/DataEngine/__init__.py,sha256=qoIZgB8J3UFDDGr0-ViiyEirTzcOy0hhL4a6E6rl2d8,94
|
|
8
|
+
HedgeTech/DataEngine/__tse_ifb/__AsyncClient.py,sha256=8cBF_f5ekKyH9Xceb0fMdUK1sWyLQQlfp_LB1rMyrl0,60357
|
|
9
|
+
HedgeTech/DataEngine/__tse_ifb/__SyncClient.py,sha256=84yexoW7Vb_sMlT3VnXTDPA7HGEfmkiC7AEYbryJF4Y,58431
|
|
10
|
+
HedgeTech/DataEngine/__tse_ifb/__init__.py,sha256=fNfmOjNXiOYTAcOgIzSXP5J1XzyX4v5urviCSwYpoyY,111
|
|
11
|
+
HedgeTech/DataEngine/__tse_ifb/__io_types/__init__.py,sha256=k4ssbz6f_ZWwSPPkTCfZe9m-v8byzoUShGOcc1FSuWc,832
|
|
12
|
+
HedgeTech/DataEngine/__tse_ifb/__io_types/__response.py,sha256=pMzjM8biVuEya62MHGU4guUCqNmhOHOToGXLS21uxc0,70442
|
|
13
|
+
HedgeTech/EmsEngine/__init__.py,sha256=u8qT8zXvb7cV_tYL9G6YxIHMiM-KoYiTVjls1We5uLc,92
|
|
14
|
+
HedgeTech/EmsEngine/__tse_ifb/__AsyncClient.py,sha256=4MZH_RzhD99GiSqgD-Xb8ZCojDGu2PZ8TOzR6cMHBCk,23384
|
|
15
|
+
HedgeTech/EmsEngine/__tse_ifb/__SyncClient.py,sha256=7aMiHsxAQyWoEuqi62L-nYNUxGpHcfJG7-tgz1qHtxs,21699
|
|
16
|
+
HedgeTech/EmsEngine/__tse_ifb/__init__.py,sha256=7ibnB8BhijhBUP2jRAQosB-UZgbAOFHso6ih3Up_590,109
|
|
17
|
+
HedgeTech/EmsEngine/__tse_ifb/__io_types/__init__.py,sha256=yuU2_SgUzNJpbW8AWunZu4aUzA7-OgUjqCMZ22_wyys,57
|
|
18
|
+
HedgeTech/EmsEngine/__tse_ifb/__io_types/__response.py,sha256=TpMSMK9SsTwiVHofqdvhTP4E6bUdRpraNxJ9rdrETWk,1030
|
|
19
|
+
hedgetech-0.2.2b0.dist-info/licenses/LICENSE,sha256=RzVH4fFelGlKDPcfQUnkbkri8Xu-bsauTM5FpraQ4NM,10251
|
|
20
|
+
hedgetech-0.2.2b0.dist-info/licenses/NOTICE,sha256=as8VRMsbPsDe5W_cX1xPxPVHPDL8PqGGzHgn5IZF26U,171
|
|
21
|
+
hedgetech-0.2.2b0.dist-info/METADATA,sha256=7ebchgWE9Q1XQVrFQYYi1zNVLQD7rlDAhi9JqmLbTKE,21132
|
|
22
|
+
hedgetech-0.2.2b0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
23
|
+
hedgetech-0.2.2b0.dist-info/top_level.txt,sha256=dlpgpN4ktclL9B5cS_dchuncCOf5JYPs_bobRAw3-ng,10
|
|
24
|
+
hedgetech-0.2.2b0.dist-info/RECORD,,
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# ========================================|======================================== #
|
|
2
|
-
# Imports #
|
|
3
|
-
# ========================================|======================================== #
|
|
4
|
-
|
|
5
|
-
from typing import (
|
|
6
|
-
List,
|
|
7
|
-
TypedDict
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
# ========================================|======================================== #
|
|
12
|
-
# Class Definitions #
|
|
13
|
-
# ========================================|======================================== #
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class SymbolNames(TypedDict):
|
|
17
|
-
"""
|
|
18
|
-
Represents a collection of instrument symbol names for batch API requests.
|
|
19
|
-
|
|
20
|
-
Attributes:
|
|
21
|
-
symbol_names (List[str]): A list of instrument symbol names (strings) to be queried.
|
|
22
|
-
|
|
23
|
-
Example:
|
|
24
|
-
>>> symbols: SymbolNames = {"symbol_names": ["ETF001", "FUT002", "STK003"]}
|
|
25
|
-
>>> symbols["symbol_names"][0]
|
|
26
|
-
'ETF001'
|
|
27
|
-
"""
|
|
28
|
-
symbol_names: List[str]
|
|
29
|
-
|
|
30
|
-
# +--------------------------------------------------------------------------------------+ #
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
class SymbolIsins(TypedDict):
|
|
34
|
-
"""
|
|
35
|
-
Represents a collection of instrument ISIN identifiers for batch API requests.
|
|
36
|
-
|
|
37
|
-
Attributes:
|
|
38
|
-
symbol_isins (List[str]): A list of instrument ISIN codes (strings) to be queried.
|
|
39
|
-
|
|
40
|
-
Example:
|
|
41
|
-
>>> isins: SymbolIsins = {"symbol_isins": ["IR0001234567", "IR0009876543"]}
|
|
42
|
-
>>> isins["symbol_isins"][1]
|
|
43
|
-
'IR0009876543'
|
|
44
|
-
"""
|
|
45
|
-
symbol_isins: List[str]
|
|
46
|
-
|
|
47
|
-
# +--------------------------------------------------------------------------------------+ #
|
hedgetech-0.1.0.dist-info/RECORD
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
HedgeTech/Auth/__AuthAsyncClient.py,sha256=ZWYTxg-idzFxOChbVvHbEmfZRMyiinI-yzPuWZGQeag,4850
|
|
2
|
-
HedgeTech/Auth/__AuthSyncClient.py,sha256=e5KiQ9aQD-_ztUrLr_GP3EcCzCeS6_wLkdRzl_nQ8Y8,4804
|
|
3
|
-
HedgeTech/Auth/__init__.py,sha256=2Ek8ZkhrRi0D7ewhMH4pyK0iqxe_FfpGBSEIu3-tsik,91
|
|
4
|
-
HedgeTech/DataEngine/__init__.py,sha256=qoIZgB8J3UFDDGr0-ViiyEirTzcOy0hhL4a6E6rl2d8,94
|
|
5
|
-
HedgeTech/DataEngine/__tse_ifb/__AsyncClient.py,sha256=8cBF_f5ekKyH9Xceb0fMdUK1sWyLQQlfp_LB1rMyrl0,60357
|
|
6
|
-
HedgeTech/DataEngine/__tse_ifb/__SyncClient.py,sha256=84yexoW7Vb_sMlT3VnXTDPA7HGEfmkiC7AEYbryJF4Y,58431
|
|
7
|
-
HedgeTech/DataEngine/__tse_ifb/__init__.py,sha256=fNfmOjNXiOYTAcOgIzSXP5J1XzyX4v5urviCSwYpoyY,111
|
|
8
|
-
HedgeTech/DataEngine/__tse_ifb/__io_types/__init__.py,sha256=MRShofLnx6Qm0-olFt5CrJjjoNk-785BxUnO8VC1Clo,895
|
|
9
|
-
HedgeTech/DataEngine/__tse_ifb/__io_types/__requests.py,sha256=x_Rc7afQahJpIq4beKctmmqRmTvipnViHICUZRj0Z-I,1601
|
|
10
|
-
HedgeTech/DataEngine/__tse_ifb/__io_types/__response.py,sha256=pMzjM8biVuEya62MHGU4guUCqNmhOHOToGXLS21uxc0,70442
|
|
11
|
-
hedgetech-0.1.0.dist-info/licenses/LICENSE,sha256=RzVH4fFelGlKDPcfQUnkbkri8Xu-bsauTM5FpraQ4NM,10251
|
|
12
|
-
hedgetech-0.1.0.dist-info/licenses/NOTICE,sha256=as8VRMsbPsDe5W_cX1xPxPVHPDL8PqGGzHgn5IZF26U,171
|
|
13
|
-
hedgetech-0.1.0.dist-info/METADATA,sha256=RCgXBFSp729u9TpsOsOHNoJ3LgKWnfL741iOKMiGnHo,18993
|
|
14
|
-
hedgetech-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
15
|
-
hedgetech-0.1.0.dist-info/top_level.txt,sha256=dlpgpN4ktclL9B5cS_dchuncCOf5JYPs_bobRAw3-ng,10
|
|
16
|
-
hedgetech-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|