HedgeTech 0.2.2b0__tar.gz → 0.2.4__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 (30) hide show
  1. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/HedgeTech/DataEngine/__tse_ifb/__AsyncClient.py +24 -11
  2. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/HedgeTech/DataEngine/__tse_ifb/__SyncClient.py +10 -11
  3. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/HedgeTech/EmsEngine/__tse_ifb/__AsyncClient.py +40 -6
  4. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/HedgeTech/EmsEngine/__tse_ifb/__SyncClient.py +24 -6
  5. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/HedgeTech.egg-info/PKG-INFO +239 -94
  6. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/PKG-INFO +239 -94
  7. hedgetech-0.2.4/README.md +376 -0
  8. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/pyproject.toml +2 -2
  9. hedgetech-0.2.2b0/README.md +0 -231
  10. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/HedgeTech/Auth/__AuthAsyncClient.py +0 -0
  11. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/HedgeTech/Auth/__AuthSyncClient.py +0 -0
  12. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/HedgeTech/Auth/__init__.py +0 -0
  13. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/HedgeTech/Auth/__utils/__RetriableAsyncClient.py +0 -0
  14. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/HedgeTech/Auth/__utils/__RetriableSyncClient.py +0 -0
  15. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/HedgeTech/Auth/__utils/__init__.py +0 -0
  16. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/HedgeTech/DataEngine/__init__.py +0 -0
  17. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/HedgeTech/DataEngine/__tse_ifb/__init__.py +0 -0
  18. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/HedgeTech/DataEngine/__tse_ifb/__io_types/__init__.py +0 -0
  19. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/HedgeTech/DataEngine/__tse_ifb/__io_types/__response.py +0 -0
  20. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/HedgeTech/EmsEngine/__init__.py +0 -0
  21. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/HedgeTech/EmsEngine/__tse_ifb/__init__.py +0 -0
  22. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/HedgeTech/EmsEngine/__tse_ifb/__io_types/__init__.py +0 -0
  23. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/HedgeTech/EmsEngine/__tse_ifb/__io_types/__response.py +0 -0
  24. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/HedgeTech.egg-info/SOURCES.txt +0 -0
  25. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/HedgeTech.egg-info/dependency_links.txt +0 -0
  26. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/HedgeTech.egg-info/requires.txt +0 -0
  27. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/HedgeTech.egg-info/top_level.txt +0 -0
  28. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/LICENSE +0 -0
  29. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/NOTICE +0 -0
  30. {hedgetech-0.2.2b0 → hedgetech-0.2.4}/setup.cfg +0 -0
@@ -2,7 +2,12 @@
2
2
  # Imports #
3
3
  # ========================================|======================================== #
4
4
 
5
- from asyncio import Event
5
+ from asyncio import (
6
+ Event,
7
+ wait_for,
8
+ TimeoutError,
9
+ sleep,
10
+ )
6
11
  from websockets.asyncio.client import connect
7
12
  from json import loads
8
13
  from HedgeTech.Auth import AuthAsyncClient
@@ -1461,7 +1466,7 @@ class DataEngine_TseIfb_AsyncClient:
1461
1466
  ... print(update["data"])
1462
1467
  """
1463
1468
 
1464
- if event is None :
1469
+ if not isinstance(event,Event):
1465
1470
  event = Event()
1466
1471
  event.set()
1467
1472
 
@@ -1473,12 +1478,16 @@ class DataEngine_TseIfb_AsyncClient:
1473
1478
  ),
1474
1479
  additional_headers=self.__AuthAsyncClient.token
1475
1480
  ) as ws:
1476
-
1481
+
1477
1482
  while event.is_set():
1478
1483
 
1479
- try:
1480
- yield loads(await ws.recv())
1481
- except :
1484
+ try : yield loads(await wait_for(ws.recv(), timeout=2))
1485
+
1486
+ except TimeoutError:
1487
+ await sleep(0)
1488
+ continue
1489
+
1490
+ except Exception:
1482
1491
  await ws.close()
1483
1492
  break
1484
1493
 
@@ -1566,10 +1575,10 @@ class DataEngine_TseIfb_AsyncClient:
1566
1575
  ... print(update["data"])
1567
1576
  """
1568
1577
 
1569
- if event is None :
1578
+ if not isinstance(event,Event):
1570
1579
  event = Event()
1571
1580
  event.set()
1572
-
1581
+
1573
1582
  async with connect(
1574
1583
  uri=(
1575
1584
  f"wss://core.hedgetech.ir/data-engine/tse-ifb/live/data/websocket/symbol/isin?"
@@ -1581,8 +1590,12 @@ class DataEngine_TseIfb_AsyncClient:
1581
1590
 
1582
1591
  while event.is_set():
1583
1592
 
1584
- try:
1585
- yield loads(await ws.recv())
1586
- except :
1593
+ try: yield loads(await wait_for(ws.recv(), timeout=2))
1594
+
1595
+ except TimeoutError:
1596
+ await sleep(0)
1597
+ continue
1598
+
1599
+ except Exception:
1587
1600
  await ws.close()
1588
1601
  break
@@ -1425,10 +1425,10 @@ class DataEngine_TseIfb_SyncClient:
1425
1425
  ... print(update) # This will not run; method is not implemented
1426
1426
  """
1427
1427
 
1428
- if event is None :
1428
+ if not isinstance(event,Event):
1429
1429
  event = Event()
1430
1430
  event.set()
1431
-
1431
+
1432
1432
  with connect(
1433
1433
  uri=(
1434
1434
  f"wss://core.hedgetech.ir/data-engine/tse-ifb/live/data/websocket/symbol/name?"
@@ -1440,13 +1440,12 @@ class DataEngine_TseIfb_SyncClient:
1440
1440
 
1441
1441
  while event.is_set():
1442
1442
 
1443
- try :
1444
- yield loads(ws.recv())
1445
- except :
1443
+ try : yield loads(ws.recv(timeout=2))
1444
+ except TimeoutError : continue
1445
+ except Exception:
1446
1446
  ws.close()
1447
1447
  break
1448
1448
 
1449
-
1450
1449
  # +--------------------------------------------------------------------------------------+ #
1451
1450
 
1452
1451
  def websocket_by_isin(
@@ -1520,10 +1519,10 @@ class DataEngine_TseIfb_SyncClient:
1520
1519
  ... print(update) # This will not run; method is not implemented
1521
1520
  """
1522
1521
 
1523
- if event is None :
1522
+ if not isinstance(event,Event):
1524
1523
  event = Event()
1525
1524
  event.set()
1526
-
1525
+
1527
1526
  with connect(
1528
1527
  uri=(
1529
1528
  f"wss://core.hedgetech.ir/data-engine/tse-ifb/live/data/websocket/symbol/isin?"
@@ -1535,8 +1534,8 @@ class DataEngine_TseIfb_SyncClient:
1535
1534
 
1536
1535
  while event.is_set():
1537
1536
 
1538
- try :
1539
- yield loads(ws.recv())
1540
- except :
1537
+ try : yield loads(ws.recv(timeout=2))
1538
+ except TimeoutError : continue
1539
+ except Exception:
1541
1540
  ws.close()
1542
1541
  break
@@ -169,7 +169,12 @@ class Order:
169
169
 
170
170
  Example
171
171
  -------
172
- >>> await order.Edit(Price=105, Volume=15)
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("user123", "pass123", "abcd")
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(symbolName="اطلس", Price=100000, Volume=10)
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(symbolName="اطلس", Price=100000, Volume=10)
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(symbolIsin="اطلس", Price=100000, Volume=10)
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(symbolIsin="اطلس", Price=100000, Volume=10)
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(Price=12500, Volume=800)
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("user1", "pass123", "A7B9")
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
  """