Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88359c882f | ||
|
|
420ebda323 | ||
|
|
83314e0074 |
No files matched your search
@@ -2,7 +2,12 @@
|
||||
# Imports #
|
||||
# ========================================|======================================== #
|
||||
|
||||
from asyncio import Event
|
||||
from asyncio import (
|
||||
Event,
|
||||
wait_for,
|
||||
TimeoutError,
|
||||
sleep,
|
||||
)
|
||||
from websockets.asyncio.client import connect
|
||||
from json import loads
|
||||
from HedgeTech.Auth import AuthAsyncClient
|
||||
@@ -1461,7 +1466,7 @@ class DataEngine_TseIfb_AsyncClient:
|
||||
... print(update["data"])
|
||||
"""
|
||||
|
||||
if event is None :
|
||||
if not isinstance(event,Event):
|
||||
event = Event()
|
||||
event.set()
|
||||
|
||||
@@ -1473,12 +1478,16 @@ class DataEngine_TseIfb_AsyncClient:
|
||||
),
|
||||
additional_headers=self.__AuthAsyncClient.token
|
||||
) as ws:
|
||||
|
||||
|
||||
while event.is_set():
|
||||
|
||||
try:
|
||||
yield loads(await ws.recv())
|
||||
except :
|
||||
try : yield loads(await wait_for(ws.recv(), timeout=2))
|
||||
|
||||
except TimeoutError:
|
||||
await sleep(0)
|
||||
continue
|
||||
|
||||
except Exception:
|
||||
await ws.close()
|
||||
break
|
||||
|
||||
@@ -1566,10 +1575,10 @@ class DataEngine_TseIfb_AsyncClient:
|
||||
... print(update["data"])
|
||||
"""
|
||||
|
||||
if event is None :
|
||||
if not isinstance(event,Event):
|
||||
event = Event()
|
||||
event.set()
|
||||
|
||||
|
||||
async with connect(
|
||||
uri=(
|
||||
f"wss://core.hedgetech.ir/data-engine/tse-ifb/live/data/websocket/symbol/isin?"
|
||||
@@ -1581,8 +1590,12 @@ class DataEngine_TseIfb_AsyncClient:
|
||||
|
||||
while event.is_set():
|
||||
|
||||
try:
|
||||
yield loads(await ws.recv())
|
||||
except :
|
||||
try: yield loads(await wait_for(ws.recv(), timeout=2))
|
||||
|
||||
except TimeoutError:
|
||||
await sleep(0)
|
||||
continue
|
||||
|
||||
except Exception:
|
||||
await ws.close()
|
||||
break
|
||||
@@ -1425,10 +1425,10 @@ class DataEngine_TseIfb_SyncClient:
|
||||
... print(update) # This will not run; method is not implemented
|
||||
"""
|
||||
|
||||
if event is None :
|
||||
if not isinstance(event,Event):
|
||||
event = Event()
|
||||
event.set()
|
||||
|
||||
|
||||
with connect(
|
||||
uri=(
|
||||
f"wss://core.hedgetech.ir/data-engine/tse-ifb/live/data/websocket/symbol/name?"
|
||||
@@ -1440,13 +1440,12 @@ class DataEngine_TseIfb_SyncClient:
|
||||
|
||||
while event.is_set():
|
||||
|
||||
try :
|
||||
yield loads(ws.recv())
|
||||
except :
|
||||
try : yield loads(ws.recv(timeout=2))
|
||||
except TimeoutError : continue
|
||||
except Exception:
|
||||
ws.close()
|
||||
break
|
||||
|
||||
|
||||
# +--------------------------------------------------------------------------------------+ #
|
||||
|
||||
def websocket_by_isin(
|
||||
@@ -1520,10 +1519,10 @@ class DataEngine_TseIfb_SyncClient:
|
||||
... print(update) # This will not run; method is not implemented
|
||||
"""
|
||||
|
||||
if event is None :
|
||||
if not isinstance(event,Event):
|
||||
event = Event()
|
||||
event.set()
|
||||
|
||||
|
||||
with connect(
|
||||
uri=(
|
||||
f"wss://core.hedgetech.ir/data-engine/tse-ifb/live/data/websocket/symbol/isin?"
|
||||
@@ -1535,8 +1534,8 @@ class DataEngine_TseIfb_SyncClient:
|
||||
|
||||
while event.is_set():
|
||||
|
||||
try :
|
||||
yield loads(ws.recv())
|
||||
except :
|
||||
try : yield loads(ws.recv(timeout=2))
|
||||
except TimeoutError : continue
|
||||
except Exception:
|
||||
ws.close()
|
||||
break
|
||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "HedgeTech"
|
||||
version = "0.2.3"
|
||||
version = "0.2.4"
|
||||
description = "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."
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.10"
|
||||
|
||||
Reference in new issue
Block a user