HedgeTech 0.1.0__py3-none-any.whl → 0.2.0b1__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.
@@ -1,8 +1,3 @@
1
- from .__requests import (
2
- SymbolNames,
3
- SymbolIsins,
4
- )
5
-
6
1
  from .__response import(
7
2
  SecuritiesAndFunds,
8
3
  StockFutures,
@@ -0,0 +1,4 @@
1
+ from .__tse_ifb import (
2
+ EmsEngine_TseIfb_SyncClient,
3
+ EmsEngine_TseIfb_ASyncClient
4
+ )
@@ -0,0 +1,463 @@
1
+ # ========================================|======================================== #
2
+ # Imports #
3
+ # ========================================|======================================== #
4
+
5
+ from typing import (
6
+ Literal,
7
+ )
8
+ from .__io_types import (
9
+ HexUUID,
10
+ OrderStatus,
11
+ )
12
+ from HedgeTech.Auth import AuthAsyncClient
13
+ from PIL.Image import open as image_open
14
+ from PIL.ImageFile import ImageFile
15
+ from io import BytesIO
16
+
17
+ # ========================================|======================================== #
18
+ # Class Definitions #
19
+ # ========================================|======================================== #
20
+ class Order:
21
+
22
+ def __init__(
23
+ self,
24
+ *,
25
+ order_uuid : HexUUID,
26
+ AuthASyncClient : AuthAsyncClient,
27
+ Order_ValidityType : Literal[
28
+ 'DAY',
29
+ 'GTC', # Good Till Cancelled
30
+ 'GTD', # Good Till Date
31
+ 'FAK', # Fill And Kill
32
+ 'FOK', # Fill Or Kill
33
+ ] = 'DAY',
34
+ ValidityDate : int = 0,
35
+ SymbolNameOrIsin : str,
36
+ Price : int,
37
+ Volume :int,
38
+ ):
39
+
40
+ self.__AuthASyncClient = AuthASyncClient
41
+ self.__order_uuid : HexUUID = order_uuid
42
+ self.ValidityType : str = Order_ValidityType
43
+ self.ValidityDate : int = ValidityDate
44
+ self.SymbolNameOrIsin : str = SymbolNameOrIsin
45
+ self.Price : int = Price
46
+ self.Volume : int = Volume
47
+ self.is_deleted : bool = False
48
+
49
+
50
+ # +--------------------------------------------------------------------------------------+ #
51
+
52
+ async def Edit(
53
+ self,
54
+ *,
55
+ Order_ValidityType : Literal[
56
+ 'DAY',
57
+ 'GTC', # Good Till Cancelled
58
+ 'GTD', # Good Till Date
59
+ 'FAK', # Fill And Kill
60
+ 'FOK', # Fill Or Kill
61
+ ] = 'DAY',
62
+ ValidityDate : int = 0,
63
+ Price : int,
64
+ Volume :int,
65
+ )-> None:
66
+
67
+ Edit_response = await self.__AuthASyncClient.httpx_Client.patch(
68
+ url='https://core.hedgetech.ir/ems-engine/tse-ifb/order/edit',
69
+ data={
70
+ 'order_uuid' : self.__order_uuid,
71
+ 'Order_ValidityType' : Order_ValidityType,
72
+ 'ValidityDate' : ValidityDate,
73
+ 'Price' : Price,
74
+ 'Volume' : Volume
75
+ }
76
+ )
77
+
78
+
79
+ match Edit_response.status_code:
80
+
81
+ case 200:
82
+
83
+ Edit_response = Edit_response.json()
84
+
85
+ self.__order_uuid = Edit_response['Data']['order_uuid']
86
+ self.ValidityType = Edit_response['Data']['order_validity_type']
87
+ self.ValidityDate = ValidityDate
88
+ self.Price = Edit_response['Data']['order_price']
89
+ self.Volume = Edit_response['Data']['order_volume']
90
+
91
+ case 400:
92
+
93
+ raise ValueError(Edit_response.json()['detail']['Status']['Description']['en'])
94
+
95
+ case _ :
96
+
97
+ raise ValueError(Edit_response.text)
98
+
99
+ # +--------------------------------------------------------------------------------------+ #
100
+ @property
101
+ async def Status(self)-> OrderStatus:
102
+
103
+ status_respnse = await self.__AuthASyncClient.httpx_Client.get(
104
+ url='https://core.hedgetech.ir/ems-engine/tse-ifb/order/status',
105
+ params={'order_uuid' : self.__order_uuid}
106
+ )
107
+
108
+ match status_respnse.status_code :
109
+
110
+ case 200:
111
+
112
+ return status_respnse.json()['Data']
113
+
114
+ case 400:
115
+
116
+ raise ValueError(status_respnse.json()['detail']['Status']['Description']['en'])
117
+
118
+ case _ :
119
+
120
+ raise ValueError(status_respnse.text)
121
+
122
+ # +--------------------------------------------------------------------------------------+ #
123
+
124
+ @property
125
+ async def order_is_valid(self)-> bool:
126
+
127
+ status = await self.Status
128
+
129
+ if (status['Price'] == self.Price) and (
130
+ status['Volume'] == self.Volume
131
+ ) and (status['ValidityType'] == self.ValidityType) and status['OrderInQueue']:
132
+
133
+ return True
134
+
135
+ else : return False
136
+
137
+ # +--------------------------------------------------------------------------------------+ #
138
+
139
+ @property
140
+ async def Delete(self)-> bool :
141
+
142
+ Delete_respnse = await self.__AuthASyncClient.httpx_Client.delete(
143
+ url= 'https://core.hedgetech.ir/ems-engine/tse-ifb/order/delete',
144
+ params={'order_uuid' : self.__order_uuid}
145
+ )
146
+
147
+
148
+ match Delete_respnse.status_code :
149
+
150
+ case 200:
151
+
152
+ self.is_deleted = True
153
+
154
+ case 400:
155
+
156
+ raise ValueError(Delete_respnse.json()['detail']['Status']['Description']['en'])
157
+
158
+ case _ :
159
+
160
+ raise ValueError(Delete_respnse.text)
161
+
162
+
163
+ # ================================================================================= #
164
+
165
+ class EmsEngine_TseIfb_ASyncClient:
166
+
167
+ def __init__(
168
+ self,
169
+ AuthASyncClient : AuthAsyncClient,
170
+ ):
171
+
172
+
173
+ self.__AuthASyncClient = AuthASyncClient
174
+
175
+ self.Customer_FullName : str | None = None
176
+ self.Customer_TSEBourseCode : str | None = None
177
+ self.oms_session : str | None = None
178
+
179
+ # +--------------------------------------------------------------------------------------+ #
180
+
181
+
182
+ async def Get_Captcha(
183
+ self,
184
+ OMS : Literal[
185
+ 'Omex | Parsian',
186
+ 'Sahra | Karamad',
187
+ ]
188
+ )-> ImageFile:
189
+
190
+ Captcha = await self.__AuthASyncClient.httpx_Client.get(
191
+ url='https://core.hedgetech.ir/ems-engine/tse-ifb/oms/login',
192
+ params={'oms' : OMS }
193
+ )
194
+
195
+ if Captcha.status_code == 200: return image_open(BytesIO(Captcha.content))
196
+
197
+ else : raise ValueError(Captcha.json()['detail']['Status']['Description']['en'])
198
+
199
+
200
+ # +--------------------------------------------------------------------------------------+ #
201
+
202
+ async def oms_login(
203
+ self,
204
+ username: str,
205
+ password: str,
206
+ captcha_value: str,
207
+ ) -> None :
208
+
209
+ response = await self.__AuthASyncClient.httpx_Client.post(
210
+ url='https://core.hedgetech.ir/ems-engine/tse-ifb/oms/login',
211
+ data={
212
+ 'username' : username,
213
+ 'Password' : password,
214
+ 'Captcha_Value' : captcha_value
215
+ },
216
+ )
217
+
218
+ match response.status_code :
219
+
220
+ case 200 :
221
+
222
+ data = response.json()
223
+
224
+ self.Customer_FullName = data['Data']['Customer_FullName']
225
+ self.Customer_TSEBourseCode = data['Data']['Customer_TSEBourseCode']
226
+ self.oms_session = data['Data']['oms_session']
227
+
228
+ return None
229
+
230
+ case 400 :
231
+
232
+ raise ValueError(response.json()['detail']['Status']['Description']['en'])
233
+
234
+ case _ :
235
+
236
+ raise ValueError(response.text)
237
+
238
+ # +--------------------------------------------------------------------------------------+ #
239
+
240
+
241
+ async def Buy_by_Name(
242
+ self,
243
+ *,
244
+ Order_ValidityType : Literal[
245
+ 'DAY',
246
+ 'GTC', # Good Till Cancelled
247
+ 'GTD', # Good Till Date
248
+ 'FAK', # Fill And Kill
249
+ 'FOK', # Fill Or Kill
250
+ ] = 'DAY',
251
+ ValidityDate : int = 0,
252
+ symbolName : str,
253
+ Price : int,
254
+ Volume :int,
255
+ )-> Order:
256
+
257
+ order_response = await self.__AuthASyncClient.httpx_Client.post(
258
+ url='https://core.hedgetech.ir/ems-engine/tse-ifb/order/new/buy/name',
259
+ data={
260
+ 'oms_session' : self.oms_session,
261
+ 'Order_ValidityType' : Order_ValidityType,
262
+ 'ValidityDate' : ValidityDate,
263
+ 'symbolName' : symbolName,
264
+ 'Price' : Price,
265
+ 'Volume' : Volume
266
+ }
267
+ )
268
+
269
+ match order_response.status_code:
270
+
271
+
272
+ case 200:
273
+
274
+ order_response = order_response.json()
275
+
276
+ return Order(
277
+ order_uuid=order_response['Data']['order_uuid'],
278
+ AuthSyncClient=self.__AuthASyncClient,
279
+ Order_ValidityType=Order_ValidityType,
280
+ ValidityDate=ValidityDate,
281
+ SymbolNameOrIsin = symbolName,
282
+ Price=Price,
283
+ Volume=Volume
284
+ )
285
+
286
+ case 400:
287
+
288
+ raise ValueError(order_response.json()['detail']['Status']['Description']['en'])
289
+
290
+ case _ :
291
+
292
+ raise ValueError(order_response.text)
293
+
294
+
295
+ # +--------------------------------------------------------------------------------------+ #
296
+
297
+
298
+ async def Sell_by_Name(
299
+ self,
300
+ *,
301
+ Order_ValidityType : Literal[
302
+ 'DAY',
303
+ 'GTC', # Good Till Cancelled
304
+ 'GTD', # Good Till Date
305
+ 'FAK', # Fill And Kill
306
+ 'FOK', # Fill Or Kill
307
+ ] = 'DAY',
308
+ ValidityDate : int = 0,
309
+ symbolName : str,
310
+ Price : int,
311
+ Volume :int,
312
+ )-> Order:
313
+
314
+ order_response = await self.__AuthASyncClient.httpx_Client.post(
315
+ url='https://core.hedgetech.ir/ems-engine/tse-ifb/order/new/sell/name',
316
+ data={
317
+ 'oms_session' : self.oms_session,
318
+ 'Order_ValidityType' : Order_ValidityType,
319
+ 'ValidityDate' : ValidityDate,
320
+ 'symbolName' : symbolName,
321
+ 'Price' : Price,
322
+ 'Volume' : Volume
323
+ }
324
+ )
325
+
326
+ match order_response.status_code:
327
+
328
+
329
+ case 200:
330
+
331
+ order_response = order_response.json()
332
+
333
+ return Order(
334
+ order_uuid=order_response['Data']['order_uuid'],
335
+ AuthSyncClient=self.__AuthASyncClient,
336
+ Order_ValidityType=Order_ValidityType,
337
+ ValidityDate=ValidityDate,
338
+ SymbolNameOrIsin = symbolName,
339
+ Price=Price,
340
+ Volume=Volume
341
+ )
342
+
343
+ case 400:
344
+
345
+ raise ValueError(order_response.json()['detail']['Status']['Description']['en'])
346
+
347
+ case _ :
348
+
349
+ raise ValueError(order_response.text)
350
+
351
+ # +--------------------------------------------------------------------------------------+ #
352
+
353
+ async def Buy_by_isin(
354
+ self,
355
+ *,
356
+ Order_ValidityType : Literal[
357
+ 'DAY',
358
+ 'GTC', # Good Till Cancelled
359
+ 'GTD', # Good Till Date
360
+ 'FAK', # Fill And Kill
361
+ 'FOK', # Fill Or Kill
362
+ ] = 'DAY',
363
+ ValidityDate : int = 0,
364
+ symbolIsin : str,
365
+ Price : int,
366
+ Volume :int,
367
+ )-> Order:
368
+
369
+ order_response = await self.__AuthASyncClient.httpx_Client.post(
370
+ url='https://core.hedgetech.ir/ems-engine/tse-ifb/order/new/buy/isin',
371
+ data={
372
+ 'oms_session' : self.oms_session,
373
+ 'Order_ValidityType' : Order_ValidityType,
374
+ 'ValidityDate' : ValidityDate,
375
+ 'symbolIsin' : symbolIsin,
376
+ 'Price' : Price,
377
+ 'Volume' : Volume
378
+ }
379
+ )
380
+
381
+ match order_response.status_code:
382
+
383
+
384
+ case 200:
385
+
386
+ order_response = order_response.json()
387
+
388
+ return Order(
389
+ order_uuid=order_response['Data']['order_uuid'],
390
+ AuthSyncClient=self.__AuthASyncClient,
391
+ Order_ValidityType=Order_ValidityType,
392
+ ValidityDate=ValidityDate,
393
+ SymbolNameOrIsin = symbolIsin,
394
+ Price=Price,
395
+ Volume=Volume
396
+ )
397
+
398
+ case 400:
399
+
400
+ raise ValueError(order_response.json()['detail']['Status']['Description']['en'])
401
+
402
+ case _ :
403
+
404
+ raise ValueError(order_response.text)
405
+
406
+
407
+ # +--------------------------------------------------------------------------------------+ #
408
+
409
+ async def Sell_by_isin(
410
+ self,
411
+ *,
412
+ Order_ValidityType : Literal[
413
+ 'DAY',
414
+ 'GTC', # Good Till Cancelled
415
+ 'GTD', # Good Till Date
416
+ 'FAK', # Fill And Kill
417
+ 'FOK', # Fill Or Kill
418
+ ] = 'DAY',
419
+ ValidityDate : int = 0,
420
+ symbolIsin : str,
421
+ Price : int,
422
+ Volume :int,
423
+ )-> Order:
424
+
425
+ order_response = await self.__AuthASyncClient.httpx_Client.post(
426
+ url='https://core.hedgetech.ir/ems-engine/tse-ifb/order/new/sell/isin',
427
+ data={
428
+ 'oms_session' : self.oms_session,
429
+ 'Order_ValidityType' : Order_ValidityType,
430
+ 'ValidityDate' : ValidityDate,
431
+ 'symbolIsin' : symbolIsin,
432
+ 'Price' : Price,
433
+ 'Volume' : Volume
434
+ }
435
+ )
436
+
437
+ match order_response.status_code:
438
+
439
+
440
+ case 200:
441
+
442
+ order_response = order_response.json()
443
+
444
+ return Order(
445
+ order_uuid=order_response['Data']['order_uuid'],
446
+ AuthSyncClient=self.__AuthASyncClient,
447
+ Order_ValidityType=Order_ValidityType,
448
+ ValidityDate=ValidityDate,
449
+ SymbolNameOrIsin = symbolIsin,
450
+ Price=Price,
451
+ Volume=Volume
452
+ )
453
+
454
+ case 400:
455
+
456
+ raise ValueError(order_response.json()['detail']['Status']['Description']['en'])
457
+
458
+ case _ :
459
+
460
+ raise ValueError(order_response.text)
461
+
462
+ # +--------------------------------------------------------------------------------------+ #
463
+
@@ -0,0 +1,467 @@
1
+ # ========================================|======================================== #
2
+ # Imports #
3
+ # ========================================|======================================== #
4
+
5
+ from typing import (
6
+ Literal,
7
+ )
8
+ from .__io_types import (
9
+ HexUUID,
10
+ OrderStatus,
11
+ )
12
+ from HedgeTech.Auth import AuthSyncClient
13
+ from PIL.Image import open as image_open
14
+ from PIL.ImageFile import ImageFile
15
+ from io import BytesIO
16
+
17
+ # ========================================|======================================== #
18
+ # Class Definitions #
19
+ # ========================================|======================================== #
20
+
21
+ class Order:
22
+
23
+ def __init__(
24
+ self,
25
+ *,
26
+ order_uuid : HexUUID,
27
+ AuthSyncClient : AuthSyncClient,
28
+ Order_ValidityType : Literal[
29
+ 'DAY',
30
+ 'GTC', # Good Till Cancelled
31
+ 'GTD', # Good Till Date
32
+ 'FAK', # Fill And Kill
33
+ 'FOK', # Fill Or Kill
34
+ ] = 'DAY',
35
+ ValidityDate : int = 0,
36
+ SymbolNameOrIsin : str,
37
+ Price : int,
38
+ Volume :int,
39
+ ):
40
+
41
+ self.__AuthSyncClient = AuthSyncClient
42
+ self.__order_uuid : HexUUID = order_uuid
43
+ self.ValidityType : str = Order_ValidityType
44
+ self.ValidityDate : int = ValidityDate
45
+ self.SymbolNameOrIsin : str = SymbolNameOrIsin
46
+ self.Price : int = Price
47
+ self.Volume : int = Volume
48
+ self.is_deleted : bool = False
49
+
50
+
51
+ # +--------------------------------------------------------------------------------------+ #
52
+
53
+ def Edit(
54
+ self,
55
+ *,
56
+ Order_ValidityType : Literal[
57
+ 'DAY',
58
+ 'GTC', # Good Till Cancelled
59
+ 'GTD', # Good Till Date
60
+ 'FAK', # Fill And Kill
61
+ 'FOK', # Fill Or Kill
62
+ ] = 'DAY',
63
+ ValidityDate : int = 0,
64
+ Price : int,
65
+ Volume :int,
66
+ )-> None:
67
+
68
+ Edit_response = self.__AuthSyncClient.httpx_Client.patch(
69
+ url='https://core.hedgetech.ir/ems-engine/tse-ifb/order/edit',
70
+ data={
71
+ 'order_uuid' : self.__order_uuid,
72
+ 'Order_ValidityType' : Order_ValidityType,
73
+ 'ValidityDate' : ValidityDate,
74
+ 'Price' : Price,
75
+ 'Volume' : Volume
76
+ }
77
+ )
78
+
79
+
80
+ match Edit_response.status_code:
81
+
82
+ case 200:
83
+
84
+ Edit_response = Edit_response.json()
85
+
86
+ self.__order_uuid = Edit_response['Data']['order_uuid']
87
+ self.ValidityType = Edit_response['Data']['order_validity_type']
88
+ self.ValidityDate = ValidityDate
89
+ self.Price = Edit_response['Data']['order_price']
90
+ self.Volume = Edit_response['Data']['order_volume']
91
+
92
+ case 400:
93
+
94
+ raise ValueError(Edit_response.json()['detail']['Status']['Description']['en'])
95
+
96
+ case _ :
97
+
98
+ raise ValueError(Edit_response.text)
99
+
100
+
101
+ # +--------------------------------------------------------------------------------------+ #
102
+
103
+ @property
104
+ def Status(self)-> OrderStatus:
105
+
106
+ status_respnse = self.__AuthSyncClient.httpx_Client.get(
107
+ url='https://core.hedgetech.ir/ems-engine/tse-ifb/order/status',
108
+ params={'order_uuid' : self.__order_uuid}
109
+ )
110
+
111
+ match status_respnse.status_code :
112
+
113
+ case 200:
114
+
115
+ return status_respnse.json()['Data']
116
+
117
+ case 400:
118
+
119
+ raise ValueError(status_respnse.json()['detail']['Status']['Description']['en'])
120
+
121
+ case _ :
122
+
123
+ raise ValueError(status_respnse.text)
124
+
125
+ # +--------------------------------------------------------------------------------------+ #
126
+
127
+ @property
128
+ def order_is_valid(self)-> bool:
129
+
130
+ status = self.Status
131
+
132
+ if (status['Price'] == self.Price) and (
133
+ status['Volume'] == self.Volume
134
+ ) and (status['ValidityType'] == self.ValidityType) and status['OrderInQueue']:
135
+
136
+ return True
137
+
138
+ else : return False
139
+
140
+ # +--------------------------------------------------------------------------------------+ #
141
+
142
+ @property
143
+ def Delete(self)-> bool :
144
+
145
+ Delete_respnse = self.__AuthSyncClient.httpx_Client.delete(
146
+ url= 'https://core.hedgetech.ir/ems-engine/tse-ifb/order/delete',
147
+ params={'order_uuid' : self.__order_uuid}
148
+ )
149
+
150
+
151
+ match Delete_respnse.status_code :
152
+
153
+ case 200:
154
+
155
+ self.is_deleted = True
156
+
157
+ case 400:
158
+
159
+ raise ValueError(Delete_respnse.json()['detail']['Status']['Description']['en'])
160
+
161
+ case _ :
162
+
163
+ raise ValueError(Delete_respnse.text)
164
+
165
+
166
+ # ================================================================================= #
167
+
168
+ class EmsEngine_TseIfb_SyncClient:
169
+
170
+ def __init__(
171
+ self,
172
+ AuthSyncClient : AuthSyncClient,
173
+ ):
174
+
175
+
176
+ self.__AuthSyncClient = AuthSyncClient
177
+
178
+ self.Customer_FullName : str | None = None
179
+ self.Customer_TSEBourseCode : str | None = None
180
+ self.oms_session : HexUUID | None = None
181
+
182
+
183
+ # +--------------------------------------------------------------------------------------+ #
184
+
185
+ def Get_Captcha(
186
+ self,
187
+ OMS : Literal[
188
+ 'Omex | Parsian',
189
+ 'Sahra | Karamad',
190
+ ]
191
+ )-> ImageFile:
192
+
193
+ Captcha = self.__AuthSyncClient.httpx_Client.get(
194
+ url='https://core.hedgetech.ir/ems-engine/tse-ifb/oms/login',
195
+ params={'oms' : OMS }
196
+ )
197
+
198
+ if Captcha.status_code == 200: return image_open(BytesIO(Captcha.content))
199
+
200
+ else : raise ValueError(Captcha.json()['detail']['Status']['Description']['en'])
201
+
202
+ # +--------------------------------------------------------------------------------------+ #
203
+
204
+ def oms_login(
205
+ self,
206
+ username: str,
207
+ password: str,
208
+ captcha_value: str,
209
+ ) -> None :
210
+
211
+ response = self.__AuthSyncClient.httpx_Client.post(
212
+ url='https://core.hedgetech.ir/ems-engine/tse-ifb/oms/login',
213
+ data={
214
+ 'username' : username,
215
+ 'Password' : password,
216
+ 'Captcha_Value' : captcha_value
217
+ },
218
+ )
219
+
220
+ match response.status_code :
221
+
222
+ case 200 :
223
+
224
+ data = response.json()
225
+
226
+ self.Customer_FullName = data['Data']['Customer_FullName']
227
+ self.Customer_TSEBourseCode = data['Data']['Customer_TSEBourseCode']
228
+ self.oms_session = data['Data']['oms_session']
229
+
230
+ return None
231
+
232
+ case 400 :
233
+
234
+ raise ValueError(response.json()['detail']['Status']['Description']['en'])
235
+
236
+ case _ :
237
+
238
+ raise ValueError(response.text)
239
+
240
+
241
+
242
+ # +--------------------------------------------------------------------------------------+ #
243
+
244
+
245
+ def Buy_by_Name(
246
+ self,
247
+ *,
248
+ Order_ValidityType : Literal[
249
+ 'DAY',
250
+ 'GTC', # Good Till Cancelled
251
+ 'GTD', # Good Till Date
252
+ 'FAK', # Fill And Kill
253
+ 'FOK', # Fill Or Kill
254
+ ] = 'DAY',
255
+ ValidityDate : int = 0,
256
+ symbolName : str,
257
+ Price : int,
258
+ Volume :int,
259
+ )-> Order:
260
+
261
+ order_response = self.__AuthSyncClient.httpx_Client.post(
262
+ url='https://core.hedgetech.ir/ems-engine/tse-ifb/order/new/buy/name',
263
+ data={
264
+ 'oms_session' : self.oms_session,
265
+ 'Order_ValidityType' : Order_ValidityType,
266
+ 'ValidityDate' : ValidityDate,
267
+ 'symbolName' : symbolName,
268
+ 'Price' : Price,
269
+ 'Volume' : Volume
270
+ }
271
+ )
272
+
273
+ match order_response.status_code:
274
+
275
+
276
+ case 200:
277
+
278
+ order_response = order_response.json()
279
+
280
+ return Order(
281
+ order_uuid=order_response['Data']['order_uuid'],
282
+ AuthSyncClient=self.__AuthSyncClient,
283
+ Order_ValidityType=Order_ValidityType,
284
+ ValidityDate=ValidityDate,
285
+ SymbolNameOrIsin = symbolName,
286
+ Price=Price,
287
+ Volume=Volume
288
+ )
289
+
290
+ case 400:
291
+
292
+ raise ValueError(order_response.json()['detail']['Status']['Description']['en'])
293
+
294
+ case _ :
295
+
296
+ raise ValueError(order_response.text)
297
+
298
+
299
+ # +--------------------------------------------------------------------------------------+ #
300
+
301
+
302
+ def Sell_by_Name(
303
+ self,
304
+ *,
305
+ Order_ValidityType : Literal[
306
+ 'DAY',
307
+ 'GTC', # Good Till Cancelled
308
+ 'GTD', # Good Till Date
309
+ 'FAK', # Fill And Kill
310
+ 'FOK', # Fill Or Kill
311
+ ] = 'DAY',
312
+ ValidityDate : int = 0,
313
+ symbolName : str,
314
+ Price : int,
315
+ Volume :int,
316
+ )-> Order:
317
+
318
+ order_response = self.__AuthSyncClient.httpx_Client.post(
319
+ url='https://core.hedgetech.ir/ems-engine/tse-ifb/order/new/sell/name',
320
+ data={
321
+ 'oms_session' : self.oms_session,
322
+ 'Order_ValidityType' : Order_ValidityType,
323
+ 'ValidityDate' : ValidityDate,
324
+ 'symbolName' : symbolName,
325
+ 'Price' : Price,
326
+ 'Volume' : Volume
327
+ }
328
+ )
329
+
330
+ match order_response.status_code:
331
+
332
+
333
+ case 200:
334
+
335
+ order_response = order_response.json()
336
+
337
+ return Order(
338
+ order_uuid=order_response['Data']['order_uuid'],
339
+ AuthSyncClient=self.__AuthSyncClient,
340
+ Order_ValidityType=Order_ValidityType,
341
+ ValidityDate=ValidityDate,
342
+ SymbolNameOrIsin = symbolName,
343
+ Price=Price,
344
+ Volume=Volume
345
+ )
346
+
347
+ case 400:
348
+
349
+ raise ValueError(order_response.json()['detail']['Status']['Description']['en'])
350
+
351
+ case _ :
352
+
353
+ raise ValueError(order_response.text)
354
+
355
+ # +--------------------------------------------------------------------------------------+ #
356
+
357
+ def Buy_by_isin(
358
+ self,
359
+ *,
360
+ Order_ValidityType : Literal[
361
+ 'DAY',
362
+ 'GTC', # Good Till Cancelled
363
+ 'GTD', # Good Till Date
364
+ 'FAK', # Fill And Kill
365
+ 'FOK', # Fill Or Kill
366
+ ] = 'DAY',
367
+ ValidityDate : int = 0,
368
+ symbolIsin : str,
369
+ Price : int,
370
+ Volume :int,
371
+ )-> Order:
372
+
373
+ order_response = self.__AuthSyncClient.httpx_Client.post(
374
+ url='https://core.hedgetech.ir/ems-engine/tse-ifb/order/new/buy/isin',
375
+ data={
376
+ 'oms_session' : self.oms_session,
377
+ 'Order_ValidityType' : Order_ValidityType,
378
+ 'ValidityDate' : ValidityDate,
379
+ 'symbolIsin' : symbolIsin,
380
+ 'Price' : Price,
381
+ 'Volume' : Volume
382
+ }
383
+ )
384
+
385
+ match order_response.status_code:
386
+
387
+
388
+ case 200:
389
+
390
+ order_response = order_response.json()
391
+
392
+ return Order(
393
+ order_uuid=order_response['Data']['order_uuid'],
394
+ AuthSyncClient=self.__AuthSyncClient,
395
+ Order_ValidityType=Order_ValidityType,
396
+ ValidityDate=ValidityDate,
397
+ SymbolNameOrIsin = symbolIsin,
398
+ Price=Price,
399
+ Volume=Volume
400
+ )
401
+
402
+ case 400:
403
+
404
+ raise ValueError(order_response.json()['detail']['Status']['Description']['en'])
405
+
406
+ case _ :
407
+
408
+ raise ValueError(order_response.text)
409
+
410
+
411
+ # +--------------------------------------------------------------------------------------+ #
412
+
413
+ def Sell_by_isin(
414
+ self,
415
+ *,
416
+ Order_ValidityType : Literal[
417
+ 'DAY',
418
+ 'GTC', # Good Till Cancelled
419
+ 'GTD', # Good Till Date
420
+ 'FAK', # Fill And Kill
421
+ 'FOK', # Fill Or Kill
422
+ ] = 'DAY',
423
+ ValidityDate : int = 0,
424
+ symbolIsin : str,
425
+ Price : int,
426
+ Volume :int,
427
+ )-> Order:
428
+
429
+ order_response = self.__AuthSyncClient.httpx_Client.post(
430
+ url='https://core.hedgetech.ir/ems-engine/tse-ifb/order/new/sell/isin',
431
+ data={
432
+ 'oms_session' : self.oms_session,
433
+ 'Order_ValidityType' : Order_ValidityType,
434
+ 'ValidityDate' : ValidityDate,
435
+ 'symbolIsin' : symbolIsin,
436
+ 'Price' : Price,
437
+ 'Volume' : Volume
438
+ }
439
+ )
440
+
441
+ match order_response.status_code:
442
+
443
+
444
+ case 200:
445
+
446
+ order_response = order_response.json()
447
+
448
+ return Order(
449
+ order_uuid=order_response['Data']['order_uuid'],
450
+ AuthSyncClient=self.__AuthSyncClient,
451
+ Order_ValidityType=Order_ValidityType,
452
+ ValidityDate=ValidityDate,
453
+ SymbolNameOrIsin = symbolIsin,
454
+ Price=Price,
455
+ Volume=Volume
456
+ )
457
+
458
+ case 400:
459
+
460
+ raise ValueError(order_response.json()['detail']['Status']['Description']['en'])
461
+
462
+ case _ :
463
+
464
+ raise ValueError(order_response.text)
465
+
466
+ # +--------------------------------------------------------------------------------------+ #
467
+
@@ -0,0 +1,2 @@
1
+ from .__SyncClient import EmsEngine_TseIfb_SyncClient
2
+ from .__AsyncClient import EmsEngine_TseIfb_ASyncClient
@@ -0,0 +1,4 @@
1
+ from .__response import (
2
+ OrderStatus,
3
+ HexUUID,
4
+ )
@@ -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
+ OrderInQueue : bool
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.1.0
3
+ Version: 0.2.0b1
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
@@ -0,0 +1,21 @@
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=k4ssbz6f_ZWwSPPkTCfZe9m-v8byzoUShGOcc1FSuWc,832
9
+ HedgeTech/DataEngine/__tse_ifb/__io_types/__response.py,sha256=pMzjM8biVuEya62MHGU4guUCqNmhOHOToGXLS21uxc0,70442
10
+ HedgeTech/EmsEngine/__init__.py,sha256=E8ftTXv-gGjyvlEH-4spu0dRdgQGnpM6X9iE1UZBq2Y,92
11
+ HedgeTech/EmsEngine/__tse_ifb/__AsyncClient.py,sha256=0N0mrzXvwGWJNefT8cChP1Po9ryTHJWgOkUs9SZD41k,15043
12
+ HedgeTech/EmsEngine/__tse_ifb/__SyncClient.py,sha256=R76dRDHWLTnDy8KnoftrlspHqkW1LNZ5wFe3NPvSslo,14920
13
+ HedgeTech/EmsEngine/__tse_ifb/__init__.py,sha256=gKs9x0L-e8aytXFsUKmlbqopOIlBV8HfpM5q6uJrPqw,109
14
+ HedgeTech/EmsEngine/__tse_ifb/__io_types/__init__.py,sha256=yuU2_SgUzNJpbW8AWunZu4aUzA7-OgUjqCMZ22_wyys,57
15
+ HedgeTech/EmsEngine/__tse_ifb/__io_types/__response.py,sha256=XUeItP7tdttAU50qEkQeCknnRs4-r4sqmgW1NuQxTGE,985
16
+ hedgetech-0.2.0b1.dist-info/licenses/LICENSE,sha256=RzVH4fFelGlKDPcfQUnkbkri8Xu-bsauTM5FpraQ4NM,10251
17
+ hedgetech-0.2.0b1.dist-info/licenses/NOTICE,sha256=as8VRMsbPsDe5W_cX1xPxPVHPDL8PqGGzHgn5IZF26U,171
18
+ hedgetech-0.2.0b1.dist-info/METADATA,sha256=gb9Ze6qzZ9_kE_fRBQpoqh1PnRvaMTTuezlLPMJwRys,19025
19
+ hedgetech-0.2.0b1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
20
+ hedgetech-0.2.0b1.dist-info/top_level.txt,sha256=dlpgpN4ktclL9B5cS_dchuncCOf5JYPs_bobRAw3-ng,10
21
+ hedgetech-0.2.0b1.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
- # +--------------------------------------------------------------------------------------+ #
@@ -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,,