Compare commits
6
Commits
0.2.5
...
ecc1070f1c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ecc1070f1c | ||
|
|
126eab66f7 | ||
|
|
8a5f3142ef | ||
|
|
9cfd36a891 | ||
|
|
034c9a50ea | ||
|
|
17bea4f2a3 |
No files matched your search
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
File diff suppressed because it is too large.
Load diff
@@ -9,6 +9,7 @@ from typing import (
|
||||
Dict,
|
||||
Optional,
|
||||
TypedDict,
|
||||
Literal,
|
||||
)
|
||||
|
||||
# ========================================|======================================== #
|
||||
@@ -37,7 +38,15 @@ class WebsocketBase_symbolIsin(TypedDict):
|
||||
>>> message["symbolIsin"]
|
||||
'IR0001234567'
|
||||
"""
|
||||
channel: str
|
||||
channel: Literal[
|
||||
"best-limit",
|
||||
"order-book",
|
||||
"ohlcv-last-1m",
|
||||
"aggregate",
|
||||
"institutional-vs-individual",
|
||||
"contract-info",
|
||||
"fund-info",
|
||||
]
|
||||
symbolIsin: str
|
||||
timestamp: str
|
||||
|
||||
@@ -64,7 +73,15 @@ class WebsocketBase_symbolName(TypedDict):
|
||||
>>> message["symbolName"]
|
||||
'ETF001'
|
||||
"""
|
||||
channel: str
|
||||
channel: Literal[
|
||||
"best-limit",
|
||||
"order-book",
|
||||
"ohlcv-last-1m",
|
||||
"aggregate",
|
||||
"institutional-vs-individual",
|
||||
"contract-info",
|
||||
"fund-info",
|
||||
]
|
||||
symbolName: str
|
||||
timestamp: str
|
||||
|
||||
@@ -734,7 +751,6 @@ class Instruments(TypedDict):
|
||||
|
||||
# +--------------------------------------------------------------------------------------+ #
|
||||
|
||||
|
||||
class BestLimitItem(TypedDict):
|
||||
"""
|
||||
Represents the best limit order information at a given price level for a financial instrument.
|
||||
@@ -766,39 +782,6 @@ class BestLimitItem(TypedDict):
|
||||
sell_quantity: int
|
||||
sell_price: int
|
||||
|
||||
|
||||
class BestLimit(TypedDict):
|
||||
"""
|
||||
Represents the aggregated best limit orders for multiple instruments.
|
||||
|
||||
The structure is a nested dictionary where the first key is typically a symbol
|
||||
identifier (ISIN or symbolName) and the second key represents the order level or priority.
|
||||
|
||||
Attributes:
|
||||
items (Dict[str, Dict[str, BestLimitItem]]): Nested dictionary of BestLimitItem objects.
|
||||
- Outer key: Instrument identifier (e.g., ISIN or symbolName)
|
||||
- Inner key: Price level or order priority
|
||||
- Value: BestLimitItem for that level
|
||||
|
||||
Example:
|
||||
>>> best_limit: BestLimit = {
|
||||
... "ETF001": {
|
||||
... "1": {
|
||||
... "buy_order_count": 5,
|
||||
... "buy_quantity": 1000,
|
||||
... "buy_price": 12000,
|
||||
... "sell_order_count": 3,
|
||||
... "sell_quantity": 800,
|
||||
... "sell_price": 12100
|
||||
... }
|
||||
... }
|
||||
... }
|
||||
>>> best_limit["ETF001"]["1"]["sell_quantity"]
|
||||
800
|
||||
"""
|
||||
items: Dict[str, Dict[str, BestLimitItem]]
|
||||
|
||||
|
||||
class BestLimitResponse(TypedDict):
|
||||
"""
|
||||
Response structure for best limit orders from a REST API call.
|
||||
@@ -810,7 +793,18 @@ class BestLimitResponse(TypedDict):
|
||||
|
||||
Example:
|
||||
>>> response: BestLimitResponse = {
|
||||
... "Data": best_limit,
|
||||
... "Data": {
|
||||
... "ETF001": {
|
||||
... "1": {
|
||||
... "buy_order_count": 5,
|
||||
... "buy_quantity": 1000,
|
||||
... "buy_price": 12000,
|
||||
... "sell_order_count": 3,
|
||||
... "sell_quantity": 800,
|
||||
... "sell_price": 12100
|
||||
... },
|
||||
... },
|
||||
... },
|
||||
... "Status": {
|
||||
... "State": True,
|
||||
... "ServerTimeStamp": 1700350200.0,
|
||||
@@ -825,7 +819,13 @@ class BestLimitResponse(TypedDict):
|
||||
>>> response["Status"]["State"]
|
||||
True
|
||||
"""
|
||||
Data: BestLimit
|
||||
Data: Dict[
|
||||
str,
|
||||
Dict[
|
||||
Literal['1','2','3','4','5','6',],
|
||||
BestLimitItem
|
||||
]
|
||||
]
|
||||
Status: Status
|
||||
|
||||
|
||||
@@ -867,7 +867,10 @@ class BestLimit_WS_symbolIsin(WebsocketBase_symbolIsin):
|
||||
>>> ws_data["data"]["1"]["sell_price"]
|
||||
12100
|
||||
"""
|
||||
data: Dict[str, BestLimitItem]
|
||||
data: Dict[
|
||||
Literal['1','2','3','4','5','6',],
|
||||
BestLimitItem,
|
||||
]
|
||||
|
||||
|
||||
class BestLimit_WS_symbolName(WebsocketBase_symbolName):
|
||||
@@ -908,7 +911,10 @@ class BestLimit_WS_symbolName(WebsocketBase_symbolName):
|
||||
>>> ws_data["data"]["2"]["buy_price"]
|
||||
11950
|
||||
"""
|
||||
data: Dict[str, BestLimitItem]
|
||||
data: Dict[
|
||||
Literal['1','2','3','4','5','6',],
|
||||
BestLimitItem,
|
||||
]
|
||||
|
||||
# +--------------------------------------------------------------------------------------+ #
|
||||
|
||||
@@ -1628,7 +1634,10 @@ class OverviewSecuritiesAndFunds(SecuritiesAndFunds):
|
||||
>>> overview["FundInfo"]["nav"]
|
||||
12500.0
|
||||
"""
|
||||
BestLimit: Dict[str, BestLimitItem]
|
||||
BestLimit: Dict[
|
||||
Literal['1','2','3','4','5','6',],
|
||||
BestLimitItem,
|
||||
]
|
||||
Aggregate: Aggregate
|
||||
institutional_vs_individual: institutional_vs_individual
|
||||
FundInfo: FundInfo
|
||||
@@ -1649,7 +1658,10 @@ class OverviewTreasuryBonds(TreasuryBonds):
|
||||
FundInfo (FundInfo)
|
||||
ContractInfo (ContractInfo)
|
||||
"""
|
||||
BestLimit: Dict[str, BestLimitItem]
|
||||
BestLimit: Dict[
|
||||
Literal['1','2','3','4','5','6',],
|
||||
BestLimitItem,
|
||||
]
|
||||
Aggregate: Aggregate
|
||||
institutional_vs_individual: institutional_vs_individual
|
||||
FundInfo: FundInfo
|
||||
@@ -1670,7 +1682,10 @@ class OverviewStockOptions(StockOptions):
|
||||
FundInfo (FundInfo)
|
||||
ContractInfo (ContractInfo)
|
||||
"""
|
||||
BestLimit: Dict[str, BestLimitItem]
|
||||
BestLimit: Dict[
|
||||
Literal['1','2','3','4','5','6',],
|
||||
BestLimitItem,
|
||||
]
|
||||
Aggregate: Aggregate
|
||||
institutional_vs_individual: institutional_vs_individual
|
||||
FundInfo: FundInfo
|
||||
@@ -1691,7 +1706,10 @@ class OverviewStockFuturess(StockFutures):
|
||||
FundInfo (FundInfo)
|
||||
ContractInfo (ContractInfo)
|
||||
"""
|
||||
BestLimit: Dict[str, BestLimitItem]
|
||||
BestLimit: Dict[
|
||||
Literal['1','2','3','4','5','6',],
|
||||
BestLimitItem,
|
||||
]
|
||||
Aggregate: Aggregate
|
||||
institutional_vs_individual: institutional_vs_individual
|
||||
FundInfo: FundInfo
|
||||
@@ -1728,7 +1746,8 @@ class OverviewResponse:
|
||||
True
|
||||
"""
|
||||
Data : Dict[
|
||||
str,Optional[
|
||||
str,
|
||||
Optional[
|
||||
Union[
|
||||
OverviewSecuritiesAndFunds,
|
||||
OverviewTreasuryBonds,
|
||||
|
||||
@@ -32,13 +32,13 @@ maximum flexibility and performance for different application scenarios.
|
||||
Install via PyPI:
|
||||
|
||||
``` bash
|
||||
pip install HedgeTech
|
||||
pip install git+https://gitea.hedgetech.ir/HedgeTech/HedgeTech
|
||||
```
|
||||
|
||||
### Update
|
||||
|
||||
``` bash
|
||||
pip install --upgrade HedgeTech
|
||||
pip install --upgrade --force-reinstall git+https://gitea.hedgetech.ir/HedgeTech/HedgeTech
|
||||
```
|
||||
|
||||
------------------------------------------------------------------------
|
||||
@@ -367,7 +367,7 @@ See LICENSE file.
|
||||
|
||||
## Support
|
||||
|
||||
GitHub Issues: https://github.com/HedgeTech-ir/HedgeTech/issues
|
||||
GitHub Issues: https://gitea.hedgetech.ir/HedgeTech/HedgeTech/issues
|
||||
|
||||
Email: info@hedgetech.ir
|
||||
|
||||
|
||||
+2
-2
@@ -59,5 +59,5 @@ dependencies = [
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://hedgetech.ir/landing/"
|
||||
Documentation = "https://github.com/HedgeTech-ir/HedgeTech/blob/main/README.md"
|
||||
Repository = "https://github.com/HedgeTech-ir/HedgeTech"
|
||||
Documentation = "https://gitea.hedgetech.ir/HedgeTech/HedgeTech/src/branch/main/README.md"
|
||||
Repository = "https://gitea.hedgetech.ir/HedgeTech/HedgeTech"
|
||||
Reference in new issue
Block a user