HedgeTech 0.2.2b0__tar.gz → 0.2.3__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.
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/HedgeTech/EmsEngine/__tse_ifb/__AsyncClient.py +40 -6
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/HedgeTech/EmsEngine/__tse_ifb/__SyncClient.py +24 -6
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/HedgeTech.egg-info/PKG-INFO +239 -94
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/PKG-INFO +239 -94
- hedgetech-0.2.3/README.md +376 -0
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/pyproject.toml +2 -2
- hedgetech-0.2.2b0/README.md +0 -231
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/HedgeTech/Auth/__AuthAsyncClient.py +0 -0
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/HedgeTech/Auth/__AuthSyncClient.py +0 -0
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/HedgeTech/Auth/__init__.py +0 -0
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/HedgeTech/Auth/__utils/__RetriableAsyncClient.py +0 -0
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/HedgeTech/Auth/__utils/__RetriableSyncClient.py +0 -0
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/HedgeTech/Auth/__utils/__init__.py +0 -0
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/HedgeTech/DataEngine/__init__.py +0 -0
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/HedgeTech/DataEngine/__tse_ifb/__AsyncClient.py +0 -0
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/HedgeTech/DataEngine/__tse_ifb/__SyncClient.py +0 -0
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/HedgeTech/DataEngine/__tse_ifb/__init__.py +0 -0
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/HedgeTech/DataEngine/__tse_ifb/__io_types/__init__.py +0 -0
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/HedgeTech/DataEngine/__tse_ifb/__io_types/__response.py +0 -0
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/HedgeTech/EmsEngine/__init__.py +0 -0
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/HedgeTech/EmsEngine/__tse_ifb/__init__.py +0 -0
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/HedgeTech/EmsEngine/__tse_ifb/__io_types/__init__.py +0 -0
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/HedgeTech/EmsEngine/__tse_ifb/__io_types/__response.py +0 -0
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/HedgeTech.egg-info/SOURCES.txt +0 -0
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/HedgeTech.egg-info/dependency_links.txt +0 -0
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/HedgeTech.egg-info/requires.txt +0 -0
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/HedgeTech.egg-info/top_level.txt +0 -0
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/LICENSE +0 -0
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/NOTICE +0 -0
- {hedgetech-0.2.2b0 → hedgetech-0.2.3}/setup.cfg +0 -0
|
@@ -169,7 +169,12 @@ class Order:
|
|
|
169
169
|
|
|
170
170
|
Example
|
|
171
171
|
-------
|
|
172
|
-
>>> await order.Edit(
|
|
172
|
+
>>> await order.Edit(
|
|
173
|
+
Price = 105,
|
|
174
|
+
Volume = 15,
|
|
175
|
+
Order_ValidityType = 'GTD',
|
|
176
|
+
ValidityDate = 20271206
|
|
177
|
+
)
|
|
173
178
|
"""
|
|
174
179
|
|
|
175
180
|
if self.OrderId is not None:
|
|
@@ -405,6 +410,7 @@ class EmsEngine_TseIfb_AsyncClient:
|
|
|
405
410
|
|
|
406
411
|
async def oms_login(
|
|
407
412
|
self,
|
|
413
|
+
*,
|
|
408
414
|
username: str,
|
|
409
415
|
password: str,
|
|
410
416
|
captcha_value: str,
|
|
@@ -433,7 +439,11 @@ class EmsEngine_TseIfb_AsyncClient:
|
|
|
433
439
|
|
|
434
440
|
Example
|
|
435
441
|
-------
|
|
436
|
-
>>> await client.oms_login(
|
|
442
|
+
>>> await client.oms_login(
|
|
443
|
+
username = "user123",
|
|
444
|
+
password = "pass123",
|
|
445
|
+
captcha_value = "abcd"
|
|
446
|
+
)
|
|
437
447
|
>>> print(client.oms_session)
|
|
438
448
|
'session_token_here'
|
|
439
449
|
"""
|
|
@@ -509,7 +519,13 @@ class EmsEngine_TseIfb_AsyncClient:
|
|
|
509
519
|
|
|
510
520
|
Example
|
|
511
521
|
-------
|
|
512
|
-
>>> order = await client.Buy_by_Name(
|
|
522
|
+
>>> order = await client.Buy_by_Name(
|
|
523
|
+
symbolName="اطلس",
|
|
524
|
+
Price=100000,
|
|
525
|
+
Volume=10,
|
|
526
|
+
Order_ValidityType = 'DAY',
|
|
527
|
+
ValidityDate = 0
|
|
528
|
+
)
|
|
513
529
|
>>> await order.send()
|
|
514
530
|
"""
|
|
515
531
|
|
|
@@ -581,7 +597,13 @@ class EmsEngine_TseIfb_AsyncClient:
|
|
|
581
597
|
|
|
582
598
|
Example
|
|
583
599
|
-------
|
|
584
|
-
>>> order = await client.Sell_by_Name(
|
|
600
|
+
>>> order = await client.Sell_by_Name(
|
|
601
|
+
symbolName="اطلس",
|
|
602
|
+
Price=100000,
|
|
603
|
+
Volume=10,
|
|
604
|
+
Order_ValidityType = 'DAY',
|
|
605
|
+
ValidityDate = 0
|
|
606
|
+
)
|
|
585
607
|
>>> await order.send()
|
|
586
608
|
"""
|
|
587
609
|
|
|
@@ -652,7 +674,13 @@ class EmsEngine_TseIfb_AsyncClient:
|
|
|
652
674
|
|
|
653
675
|
Example
|
|
654
676
|
-------
|
|
655
|
-
>>> order = await client.Buy_by_isin(
|
|
677
|
+
>>> order = await client.Buy_by_isin(
|
|
678
|
+
symbolName="اطلس",
|
|
679
|
+
Price=100000,
|
|
680
|
+
Volume=10,
|
|
681
|
+
Order_ValidityType = 'DAY',
|
|
682
|
+
ValidityDate = 0
|
|
683
|
+
)
|
|
656
684
|
>>> await order.send()
|
|
657
685
|
"""
|
|
658
686
|
|
|
@@ -723,7 +751,13 @@ class EmsEngine_TseIfb_AsyncClient:
|
|
|
723
751
|
|
|
724
752
|
Example
|
|
725
753
|
-------
|
|
726
|
-
>>> order = await client.Sell_by_isin(
|
|
754
|
+
>>> order = await client.Sell_by_isin(
|
|
755
|
+
symbolName="اطلس",
|
|
756
|
+
Price=100000,
|
|
757
|
+
Volume=10,
|
|
758
|
+
Order_ValidityType = 'DAY',
|
|
759
|
+
ValidityDate = 0
|
|
760
|
+
)
|
|
727
761
|
>>> await order.send()
|
|
728
762
|
"""
|
|
729
763
|
|
|
@@ -181,7 +181,12 @@ class Order:
|
|
|
181
181
|
|
|
182
182
|
Examples
|
|
183
183
|
--------
|
|
184
|
-
>>> order.Edit(
|
|
184
|
+
>>> order.Edit(
|
|
185
|
+
Price = 105,
|
|
186
|
+
Volume = 15,
|
|
187
|
+
Order_ValidityType = 'GTD',
|
|
188
|
+
ValidityDate = 20271206
|
|
189
|
+
)
|
|
185
190
|
"""
|
|
186
191
|
|
|
187
192
|
if self.OrderId is not None:
|
|
@@ -436,6 +441,7 @@ class EmsEngine_TseIfb_SyncClient:
|
|
|
436
441
|
|
|
437
442
|
def oms_login(
|
|
438
443
|
self,
|
|
444
|
+
*,
|
|
439
445
|
username: str,
|
|
440
446
|
password: str,
|
|
441
447
|
captcha_value: str,
|
|
@@ -465,7 +471,11 @@ class EmsEngine_TseIfb_SyncClient:
|
|
|
465
471
|
|
|
466
472
|
Examples
|
|
467
473
|
--------
|
|
468
|
-
>>> client.oms_login(
|
|
474
|
+
>>> client.oms_login(
|
|
475
|
+
username = "user123",
|
|
476
|
+
password = "pass123",
|
|
477
|
+
captcha_value = "abcd"
|
|
478
|
+
)
|
|
469
479
|
"""
|
|
470
480
|
|
|
471
481
|
response = self.__AuthSyncClient.httpx_Client.post(
|
|
@@ -542,7 +552,9 @@ class EmsEngine_TseIfb_SyncClient:
|
|
|
542
552
|
>>> order = client.Buy_by_Name(
|
|
543
553
|
... symbolName="اهرم",
|
|
544
554
|
... Price=12000,
|
|
545
|
-
... Volume=1000
|
|
555
|
+
... Volume=1000,
|
|
556
|
+
... Order_ValidityType = 'DAY',
|
|
557
|
+
... ValidityDate = 0
|
|
546
558
|
... )
|
|
547
559
|
>>> order.send()
|
|
548
560
|
"""
|
|
@@ -615,7 +627,9 @@ class EmsEngine_TseIfb_SyncClient:
|
|
|
615
627
|
>>> order = client.Sell_by_Name(
|
|
616
628
|
... symbolName="اهرم",
|
|
617
629
|
... Price=12000,
|
|
618
|
-
... Volume=1000
|
|
630
|
+
... Volume=1000,
|
|
631
|
+
... Order_ValidityType = 'DAY',
|
|
632
|
+
... ValidityDate = 0
|
|
619
633
|
... )
|
|
620
634
|
>>> order.send()
|
|
621
635
|
"""
|
|
@@ -686,7 +700,9 @@ class EmsEngine_TseIfb_SyncClient:
|
|
|
686
700
|
>>> order = client.Buy_by_isin(
|
|
687
701
|
... symbolName="اهرم",
|
|
688
702
|
... Price=12000,
|
|
689
|
-
... Volume=1000
|
|
703
|
+
... Volume=1000,
|
|
704
|
+
... Order_ValidityType = 'DAY',
|
|
705
|
+
... ValidityDate = 0
|
|
690
706
|
... )
|
|
691
707
|
>>> order.send()
|
|
692
708
|
"""
|
|
@@ -757,7 +773,9 @@ class EmsEngine_TseIfb_SyncClient:
|
|
|
757
773
|
>>> order = client.Sell_by_isin(
|
|
758
774
|
... symbolName="اهرم",
|
|
759
775
|
... Price=12000,
|
|
760
|
-
... Volume=1000
|
|
776
|
+
... Volume=1000,
|
|
777
|
+
... Order_ValidityType = 'DAY',
|
|
778
|
+
... ValidityDate = 0
|
|
761
779
|
... )
|
|
762
780
|
>>> order.send()
|
|
763
781
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: HedgeTech
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
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
|
|
@@ -193,7 +193,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
193
193
|
Classifier: Programming Language :: Python :: 3.13
|
|
194
194
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
195
195
|
Classifier: Operating System :: OS Independent
|
|
196
|
-
Classifier: Development Status ::
|
|
196
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
197
197
|
Classifier: Intended Audience :: Developers
|
|
198
198
|
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
199
199
|
Classifier: Topic :: Office/Business :: Financial
|
|
@@ -217,232 +217,377 @@ Dynamic: license-file
|
|
|
217
217
|
|
|
218
218
|
# HedgeTech Python SDK
|
|
219
219
|
|
|
220
|
-
HedgeTech Python SDK is a professional, lightweight, and modular Python
|
|
220
|
+
HedgeTech Python SDK is a professional, lightweight, and modular Python
|
|
221
|
+
package designed to provide seamless access to HedgeTech services. The
|
|
222
|
+
SDK is crafted for developers, data analysts, and algorithmic traders
|
|
223
|
+
who want to interact with the Tehran Stock Exchange (TSE & IFB) using a
|
|
224
|
+
clean, reliable, and easy-to-use API.
|
|
221
225
|
|
|
222
|
-
|
|
226
|
+
It supports both synchronous and asynchronous workflows, offering
|
|
227
|
+
maximum flexibility and performance for different application scenarios.
|
|
228
|
+
|
|
229
|
+
> **Note:** This SDK requires Python >= 3.10 and is production-ready.
|
|
230
|
+
> Development Status: **5 - Production/Stable**.
|
|
231
|
+
> The public APIs are stable and safe for long-term use.
|
|
232
|
+
|
|
233
|
+
------------------------------------------------------------------------
|
|
223
234
|
|
|
224
235
|
## Features
|
|
225
236
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
237
|
+
- Secure authentication with async and sync clients.
|
|
238
|
+
- Real-time and historical market data from TSE & IFB.
|
|
239
|
+
- Full EMS Engine order lifecycle management.
|
|
240
|
+
- Modular architecture (Auth, DataEngine, EMSEngine).
|
|
241
|
+
- Structured request/response types.
|
|
242
|
+
- High-performance asyncio support.
|
|
243
|
+
- Easy integration with trading bots and dashboards.
|
|
244
|
+
|
|
245
|
+
------------------------------------------------------------------------
|
|
233
246
|
|
|
234
247
|
## Installation
|
|
235
248
|
|
|
236
|
-
Install
|
|
249
|
+
Install via PyPI:
|
|
237
250
|
|
|
238
|
-
```
|
|
251
|
+
``` bash
|
|
239
252
|
pip install HedgeTech
|
|
240
253
|
```
|
|
241
254
|
|
|
242
|
-
###
|
|
243
|
-
|
|
244
|
-
To update HedgeTech SDK to the latest version in your environment, use:
|
|
255
|
+
### Update
|
|
245
256
|
|
|
246
|
-
```
|
|
257
|
+
``` bash
|
|
247
258
|
pip install --upgrade HedgeTech
|
|
248
259
|
```
|
|
249
260
|
|
|
250
|
-
|
|
261
|
+
------------------------------------------------------------------------
|
|
262
|
+
|
|
263
|
+
## Package Structure
|
|
251
264
|
|
|
252
|
-
|
|
265
|
+
HedgeTech/
|
|
266
|
+
├── Auth/
|
|
267
|
+
├── DataEngine/
|
|
268
|
+
├── EMSEngine/
|
|
269
|
+
└── __init__.py
|
|
270
|
+
|
|
271
|
+
------------------------------------------------------------------------
|
|
253
272
|
|
|
254
273
|
## Authentication
|
|
255
274
|
|
|
256
|
-
|
|
275
|
+
All services require authentication.
|
|
276
|
+
|
|
277
|
+
> Use matching Sync/Async clients.
|
|
257
278
|
|
|
258
279
|
### Async Authentication
|
|
259
280
|
|
|
260
|
-
```python
|
|
281
|
+
``` python
|
|
261
282
|
from HedgeTech.Auth import AuthAsyncClient
|
|
262
283
|
|
|
263
284
|
auth_async_client = await AuthAsyncClient.login(
|
|
264
|
-
UserName_or_Email=
|
|
265
|
-
Password=
|
|
285
|
+
UserName_or_Email="user@example.com",
|
|
286
|
+
Password="password"
|
|
266
287
|
)
|
|
288
|
+
|
|
267
289
|
print(auth_async_client.token)
|
|
268
290
|
```
|
|
269
291
|
|
|
270
292
|
### Sync Authentication
|
|
271
293
|
|
|
272
|
-
```python
|
|
294
|
+
``` python
|
|
273
295
|
from HedgeTech.Auth import AuthSyncClient
|
|
274
296
|
|
|
275
297
|
auth_sync_client = AuthSyncClient.login(
|
|
276
|
-
UserName_or_Email=
|
|
277
|
-
Password=
|
|
298
|
+
UserName_or_Email="user@example.com",
|
|
299
|
+
Password="password"
|
|
278
300
|
)
|
|
301
|
+
|
|
279
302
|
print(auth_sync_client.token)
|
|
280
303
|
```
|
|
281
304
|
|
|
282
|
-
|
|
305
|
+
------------------------------------------------------------------------
|
|
306
|
+
|
|
307
|
+
## DataEngine (Market Data)
|
|
308
|
+
|
|
309
|
+
The DataEngine module provides unified access to:
|
|
283
310
|
|
|
284
|
-
|
|
311
|
+
- Live market data
|
|
312
|
+
- Historical OHLCV
|
|
313
|
+
- Order books
|
|
314
|
+
- Best limits
|
|
315
|
+
- WebSocket streams
|
|
285
316
|
|
|
286
|
-
|
|
317
|
+
All engines follow identical Sync/Async APIs.
|
|
287
318
|
|
|
288
|
-
|
|
319
|
+
------------------------------------------------------------------------
|
|
289
320
|
|
|
290
|
-
|
|
321
|
+
### Async Data Example
|
|
322
|
+
|
|
323
|
+
``` python
|
|
291
324
|
from HedgeTech.DataEngine import DataEngine_TseIfb_AsyncClient
|
|
292
325
|
|
|
293
326
|
client = DataEngine_TseIfb_AsyncClient(auth_async_client)
|
|
327
|
+
|
|
294
328
|
data = await client.live_best_limit_by_isin(
|
|
295
|
-
symbol_isins=[
|
|
329
|
+
symbol_isins=["IRT1AHRM0001","IRO1IKCO0001"]
|
|
296
330
|
)
|
|
297
|
-
print(data)
|
|
298
331
|
|
|
299
|
-
|
|
332
|
+
print(data)
|
|
300
333
|
|
|
301
334
|
async for update in client.websocket_by_name(
|
|
302
|
-
channels=["best-limit",
|
|
335
|
+
channels=["best-limit","order-book"],
|
|
303
336
|
symbol_names=["فملی","اطلس"]
|
|
304
337
|
):
|
|
305
338
|
print(update["data"])
|
|
306
339
|
```
|
|
307
340
|
|
|
308
|
-
|
|
341
|
+
------------------------------------------------------------------------
|
|
309
342
|
|
|
310
|
-
|
|
343
|
+
### Sync Data Example
|
|
344
|
+
|
|
345
|
+
``` python
|
|
311
346
|
from HedgeTech.DataEngine import DataEngine_TseIfb_SyncClient
|
|
312
347
|
|
|
313
348
|
client = DataEngine_TseIfb_SyncClient(auth_sync_client)
|
|
349
|
+
|
|
314
350
|
data = client.historical_ohlcv_by_name(
|
|
315
|
-
symbolName=
|
|
351
|
+
symbolName="مهرگان",
|
|
316
352
|
start_timestamp=0,
|
|
317
|
-
end_timestamp=
|
|
353
|
+
end_timestamp="1763411432",
|
|
318
354
|
AdjustedPrice=True,
|
|
319
|
-
Resolution=
|
|
355
|
+
Resolution="D"
|
|
320
356
|
)
|
|
321
|
-
print(data)
|
|
322
357
|
|
|
323
|
-
|
|
358
|
+
print(data)
|
|
324
359
|
|
|
325
360
|
for update in client.websocket_by_isin(
|
|
326
|
-
channels=["best-limit",
|
|
361
|
+
channels=["best-limit","order-book"],
|
|
327
362
|
symbol_isins=["IR1234567890"]
|
|
328
363
|
):
|
|
329
364
|
print(update["data"])
|
|
330
365
|
```
|
|
331
366
|
|
|
332
|
-
|
|
367
|
+
------------------------------------------------------------------------
|
|
368
|
+
|
|
369
|
+
## EMSEngine (Order Management)
|
|
370
|
+
|
|
371
|
+
The EMSEngine module handles complete order management.
|
|
372
|
+
|
|
373
|
+
Supported markets: - TSE - IFB
|
|
374
|
+
|
|
375
|
+
------------------------------------------------------------------------
|
|
376
|
+
|
|
377
|
+
### EMSEngine Features
|
|
333
378
|
|
|
334
|
-
|
|
379
|
+
- Buy/Sell by Name or ISIN
|
|
380
|
+
- Edit Orders
|
|
381
|
+
- Cancel/Delete Orders
|
|
382
|
+
- Real-time Status
|
|
383
|
+
- Async/Sync Compatibility
|
|
384
|
+
- Order Object Lifecycle
|
|
335
385
|
|
|
336
|
-
|
|
386
|
+
------------------------------------------------------------------------
|
|
337
387
|
|
|
338
|
-
|
|
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.
|
|
388
|
+
## Order Lifecycle
|
|
343
389
|
|
|
344
|
-
|
|
390
|
+
1. Create Order
|
|
391
|
+
2. Send
|
|
392
|
+
3. Monitor Status
|
|
393
|
+
4. Edit (Optional)
|
|
394
|
+
5. Settle or Delete
|
|
345
395
|
|
|
346
|
-
|
|
396
|
+
------------------------------------------------------------------------
|
|
397
|
+
|
|
398
|
+
## Async Trading Example
|
|
399
|
+
|
|
400
|
+
``` python
|
|
347
401
|
from HedgeTech.EMSEngine import EmsEngine_TseIfb_AsyncClient
|
|
348
402
|
|
|
349
|
-
|
|
403
|
+
ems = EmsEngine_TseIfb_AsyncClient(auth_async_client)
|
|
350
404
|
|
|
351
|
-
|
|
352
|
-
|
|
405
|
+
captcha = await ems.Get_Captcha("Omex | Parsian")
|
|
406
|
+
captcha.show()
|
|
407
|
+
|
|
408
|
+
await ems.oms_login(
|
|
409
|
+
username="user",
|
|
410
|
+
password="pass",
|
|
411
|
+
captcha_value="1234"
|
|
412
|
+
)
|
|
353
413
|
|
|
354
|
-
|
|
355
|
-
order = await ems_client.Buy_by_Name(
|
|
414
|
+
order = await ems.Buy_by_Name(
|
|
356
415
|
symbolName="اطلس",
|
|
357
416
|
Price=100000,
|
|
358
417
|
Volume=10
|
|
359
418
|
)
|
|
419
|
+
|
|
360
420
|
await order.send()
|
|
361
421
|
|
|
362
|
-
# Check status
|
|
363
422
|
status = await order.Status()
|
|
364
423
|
print(status)
|
|
365
424
|
|
|
366
|
-
# Edit order
|
|
367
425
|
await order.Edit(Price=105000, Volume=12)
|
|
368
426
|
|
|
369
|
-
# Delete order
|
|
370
427
|
await order.Delete()
|
|
371
|
-
print(order.is_deleted) # True
|
|
372
428
|
```
|
|
373
429
|
|
|
374
|
-
|
|
430
|
+
------------------------------------------------------------------------
|
|
431
|
+
|
|
432
|
+
## Sync Trading Example
|
|
375
433
|
|
|
376
|
-
```python
|
|
434
|
+
``` python
|
|
377
435
|
from HedgeTech.EMSEngine import EmsEngine_TseIfb_SyncClient
|
|
378
436
|
|
|
379
|
-
|
|
437
|
+
ems = EmsEngine_TseIfb_SyncClient(auth_sync_client)
|
|
380
438
|
|
|
381
|
-
|
|
382
|
-
|
|
439
|
+
captcha = ems.Get_Captcha("Omex | Parsian")
|
|
440
|
+
captcha.show()
|
|
441
|
+
|
|
442
|
+
ems.oms_login(
|
|
443
|
+
username="user",
|
|
444
|
+
password="pass",
|
|
445
|
+
captcha_value="1234"
|
|
446
|
+
)
|
|
383
447
|
|
|
384
|
-
|
|
385
|
-
order = ems_client.Sell_by_Name(
|
|
448
|
+
order = ems.Sell_by_Name(
|
|
386
449
|
symbolName="فملی",
|
|
387
450
|
Price=50000,
|
|
388
451
|
Volume=5
|
|
389
452
|
)
|
|
453
|
+
|
|
390
454
|
order.send()
|
|
391
455
|
|
|
392
|
-
# Check status
|
|
393
456
|
status = order.Status()
|
|
394
457
|
print(status)
|
|
395
458
|
|
|
396
|
-
# Edit order
|
|
397
459
|
order.Edit(Price=52000, Volume=6)
|
|
398
460
|
|
|
399
|
-
# Delete order
|
|
400
461
|
order.Delete()
|
|
401
|
-
print(order.is_deleted) # True
|
|
402
462
|
```
|
|
403
463
|
|
|
404
|
-
|
|
464
|
+
------------------------------------------------------------------------
|
|
465
|
+
|
|
466
|
+
## Unified API Design
|
|
467
|
+
|
|
468
|
+
All Sync and Async clients share:
|
|
469
|
+
|
|
470
|
+
- Same method names
|
|
471
|
+
- Same parameters
|
|
472
|
+
- Same return types
|
|
473
|
+
|
|
474
|
+
Only execution model differs.
|
|
475
|
+
|
|
476
|
+
This enables seamless switching between modes.
|
|
477
|
+
|
|
478
|
+
------------------------------------------------------------------------
|
|
479
|
+
|
|
480
|
+
## Error Handling
|
|
481
|
+
|
|
482
|
+
- Invalid credentials raise ValueError
|
|
483
|
+
- Network errors should be handled by user
|
|
484
|
+
- Failed requests may return None
|
|
485
|
+
|
|
486
|
+
Recommended: wrap calls in try/except.
|
|
487
|
+
|
|
488
|
+
------------------------------------------------------------------------
|
|
489
|
+
|
|
490
|
+
## Performance
|
|
491
|
+
|
|
492
|
+
- Non-blocking Async I/O
|
|
493
|
+
- Connection pooling
|
|
494
|
+
- Optimized request batching
|
|
495
|
+
- Suitable for HFT and Algo Trading
|
|
496
|
+
|
|
497
|
+
------------------------------------------------------------------------
|
|
498
|
+
|
|
499
|
+
## Security
|
|
500
|
+
|
|
501
|
+
- JWT Authentication
|
|
502
|
+
- Encrypted Transport (HTTPS)
|
|
503
|
+
- No password storage
|
|
504
|
+
- Session isolation
|
|
505
|
+
|
|
506
|
+
------------------------------------------------------------------------
|
|
405
507
|
|
|
406
|
-
##
|
|
508
|
+
## Best Practices
|
|
407
509
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
510
|
+
- Refresh tokens regularly
|
|
511
|
+
- Monitor order status
|
|
512
|
+
- Avoid duplicate send()
|
|
513
|
+
- Validate inputs
|
|
514
|
+
- Log critical operations
|
|
515
|
+
|
|
516
|
+
------------------------------------------------------------------------
|
|
414
517
|
|
|
415
518
|
## Modules Overview
|
|
416
519
|
|
|
417
520
|
### HedgeTech.Auth
|
|
418
521
|
|
|
419
|
-
|
|
522
|
+
Provides:
|
|
523
|
+
|
|
524
|
+
- AuthAsyncClient
|
|
525
|
+
- AuthSyncClient
|
|
526
|
+
- Token management
|
|
527
|
+
- Session handling
|
|
528
|
+
|
|
529
|
+
------------------------------------------------------------------------
|
|
420
530
|
|
|
421
531
|
### HedgeTech.DataEngine
|
|
422
532
|
|
|
423
|
-
|
|
533
|
+
Provides:
|
|
534
|
+
|
|
535
|
+
- Market data APIs
|
|
536
|
+
- Historical data
|
|
537
|
+
- WebSocket feeds
|
|
538
|
+
- Modular engine design
|
|
424
539
|
|
|
425
|
-
|
|
426
|
-
* Structured request and response types for predictable and robust data handling.
|
|
427
|
-
* Modular design that allows integration of additional engines, such as WebSocket clients or future data engines, without modifying the main interface.
|
|
540
|
+
------------------------------------------------------------------------
|
|
428
541
|
|
|
429
542
|
### HedgeTech.EMSEngine
|
|
430
543
|
|
|
431
|
-
|
|
544
|
+
Provides:
|
|
545
|
+
|
|
546
|
+
- EmsEngine_TseIfb_AsyncClient
|
|
547
|
+
- EmsEngine_TseIfb_SyncClient
|
|
548
|
+
- Order class
|
|
549
|
+
- Lifecycle management
|
|
550
|
+
|
|
551
|
+
------------------------------------------------------------------------
|
|
552
|
+
|
|
553
|
+
## Roadmap
|
|
554
|
+
|
|
555
|
+
- Auto session refresh
|
|
556
|
+
- Smart retry system
|
|
557
|
+
- Risk control module
|
|
558
|
+
- Order batching
|
|
559
|
+
- Metrics & Monitoring
|
|
560
|
+
- Strategy framework
|
|
432
561
|
|
|
433
|
-
|
|
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
|
|
562
|
+
------------------------------------------------------------------------
|
|
437
563
|
|
|
438
564
|
## Contributing
|
|
439
565
|
|
|
440
|
-
We welcome contributions
|
|
566
|
+
We welcome contributions.
|
|
567
|
+
|
|
568
|
+
Guidelines:
|
|
569
|
+
|
|
570
|
+
- Follow PEP8
|
|
571
|
+
- Add tests
|
|
572
|
+
- Update documentation
|
|
573
|
+
- Submit Pull Requests
|
|
574
|
+
|
|
575
|
+
------------------------------------------------------------------------
|
|
441
576
|
|
|
442
577
|
## License
|
|
443
578
|
|
|
444
|
-
|
|
579
|
+
Licensed under Apache License 2.0.
|
|
580
|
+
|
|
581
|
+
See LICENSE file.
|
|
582
|
+
|
|
583
|
+
------------------------------------------------------------------------
|
|
445
584
|
|
|
446
585
|
## Support
|
|
447
586
|
|
|
448
|
-
|
|
587
|
+
GitHub Issues: https://github.com/HedgeTech-ir/HedgeTech/issues
|
|
588
|
+
|
|
589
|
+
Email: info@hedgetech.ir
|
|
590
|
+
|
|
591
|
+
------------------------------------------------------------------------
|
|
592
|
+
|
|
593
|
+
© 2026 HedgeTech. All rights reserved.
|