vortex-api 1.0.7__tar.gz → 2.0.0__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.
- {vortex_api-1.0.7 → vortex_api-2.0.0}/PKG-INFO +27 -9
- {vortex_api-1.0.7 → vortex_api-2.0.0}/README.md +4 -4
- vortex_api-2.0.0/pyproject.toml +3 -0
- {vortex_api-1.0.7 → vortex_api-2.0.0}/vortex_api/__init__.py +8 -8
- vortex_api-2.0.0/vortex_api/__version__.py +8 -0
- {vortex_api-1.0.7 → vortex_api-2.0.0}/vortex_api/api.py +100 -42
- {vortex_api-1.0.7 → vortex_api-2.0.0}/vortex_api/vortex_feed.py +1 -1
- {vortex_api-1.0.7 → vortex_api-2.0.0}/vortex_api.egg-info/PKG-INFO +28 -10
- {vortex_api-1.0.7 → vortex_api-2.0.0}/vortex_api.egg-info/SOURCES.txt +1 -1
- vortex_api-1.0.7/vortex_api/__version__.py +0 -8
- {vortex_api-1.0.7 → vortex_api-2.0.0}/LICENSE +0 -0
- {vortex_api-1.0.7 → vortex_api-2.0.0}/setup.cfg +0 -0
- {vortex_api-1.0.7 → vortex_api-2.0.0}/setup.py +0 -0
- {vortex_api-1.0.7 → vortex_api-2.0.0}/vortex_api.egg-info/dependency_links.txt +0 -0
- {vortex_api-1.0.7 → vortex_api-2.0.0}/vortex_api.egg-info/requires.txt +0 -0
- {vortex_api-1.0.7 → vortex_api-2.0.0}/vortex_api.egg-info/top_level.txt +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: vortex_api
|
|
3
|
-
Version:
|
|
4
|
-
Summary: Vortex APIs to place orders in
|
|
5
|
-
Home-page: https://vortex.
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Vortex APIs to place orders in Rupeezy application
|
|
5
|
+
Home-page: https://vortex.rupeezy.in
|
|
6
6
|
Download-URL: https://github.com/AsthaTech/pyvortex
|
|
7
7
|
Author: Astha Credit & Securities Pvt Ltd.
|
|
8
|
-
Author-email: tech@
|
|
8
|
+
Author-email: tech@rupeezy.in
|
|
9
9
|
License: MIT
|
|
10
10
|
Classifier: Intended Audience :: Developers
|
|
11
11
|
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
@@ -18,6 +18,24 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
|
18
18
|
Classifier: Topic :: Software Development :: Libraries
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE
|
|
21
|
+
Requires-Dist: requests>=2.25.1
|
|
22
|
+
Requires-Dist: wrapt>=1.15.0
|
|
23
|
+
Requires-Dist: six>=1.11.0
|
|
24
|
+
Requires-Dist: pyOpenSSL>=17.5.0
|
|
25
|
+
Requires-Dist: python-dateutil>=2.6.1
|
|
26
|
+
Requires-Dist: autobahn[twisted]==19.11.2
|
|
27
|
+
Requires-Dist: service_identity>=18.1.0
|
|
28
|
+
Dynamic: author
|
|
29
|
+
Dynamic: author-email
|
|
30
|
+
Dynamic: classifier
|
|
31
|
+
Dynamic: description
|
|
32
|
+
Dynamic: description-content-type
|
|
33
|
+
Dynamic: download-url
|
|
34
|
+
Dynamic: home-page
|
|
35
|
+
Dynamic: license
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
Dynamic: requires-dist
|
|
38
|
+
Dynamic: summary
|
|
21
39
|
|
|
22
40
|
# Vortex API Python Client
|
|
23
41
|
|
|
@@ -31,10 +49,10 @@ pip install vortex-api
|
|
|
31
49
|
# Api Usage
|
|
32
50
|
|
|
33
51
|
```python
|
|
34
|
-
from vortex_api import
|
|
52
|
+
from vortex_api import VortexAPI
|
|
35
53
|
from vortex_api import Constants as Vc
|
|
36
54
|
|
|
37
|
-
client =
|
|
55
|
+
client = VortexAPI("your api secret","your application id")
|
|
38
56
|
|
|
39
57
|
#For client login using TOTP
|
|
40
58
|
client.login("client code","client password","totp")
|
|
@@ -62,7 +80,7 @@ client.orders(limit=20,offset=1)
|
|
|
62
80
|
# Connecting to websocket
|
|
63
81
|
|
|
64
82
|
Using the feed, you can listen to both price quote changes and order/trade updates. You need to define your own callbacks for `on_price_update`
|
|
65
|
-
and `on_order_update`. The packet structure for `on_order_update` is the same as that received in postbacks and is available [here](https://vortex.
|
|
83
|
+
and `on_order_update`. The packet structure for `on_order_update` is the same as that received in postbacks and is available [here](https://vortex.rupeezy.in/docs/postbacks/)
|
|
66
84
|
|
|
67
85
|
```python
|
|
68
86
|
from vortex_api import VortexFeed
|
|
@@ -101,5 +119,5 @@ if __name__ == "__main__":
|
|
|
101
119
|
main()
|
|
102
120
|
|
|
103
121
|
```
|
|
104
|
-
Refer to the [python document](https://vortex.
|
|
122
|
+
Refer to the [python document](https://vortex.rupeezy.in/docs/pyvortex/vortex_api.html) for all methods and features
|
|
105
123
|
|
|
@@ -10,10 +10,10 @@ pip install vortex-api
|
|
|
10
10
|
# Api Usage
|
|
11
11
|
|
|
12
12
|
```python
|
|
13
|
-
from vortex_api import
|
|
13
|
+
from vortex_api import VortexAPI
|
|
14
14
|
from vortex_api import Constants as Vc
|
|
15
15
|
|
|
16
|
-
client =
|
|
16
|
+
client = VortexAPI("your api secret","your application id")
|
|
17
17
|
|
|
18
18
|
#For client login using TOTP
|
|
19
19
|
client.login("client code","client password","totp")
|
|
@@ -41,7 +41,7 @@ client.orders(limit=20,offset=1)
|
|
|
41
41
|
# Connecting to websocket
|
|
42
42
|
|
|
43
43
|
Using the feed, you can listen to both price quote changes and order/trade updates. You need to define your own callbacks for `on_price_update`
|
|
44
|
-
and `on_order_update`. The packet structure for `on_order_update` is the same as that received in postbacks and is available [here](https://vortex.
|
|
44
|
+
and `on_order_update`. The packet structure for `on_order_update` is the same as that received in postbacks and is available [here](https://vortex.rupeezy.in/docs/postbacks/)
|
|
45
45
|
|
|
46
46
|
```python
|
|
47
47
|
from vortex_api import VortexFeed
|
|
@@ -80,5 +80,5 @@ if __name__ == "__main__":
|
|
|
80
80
|
main()
|
|
81
81
|
|
|
82
82
|
```
|
|
83
|
-
Refer to the [python document](https://vortex.
|
|
83
|
+
Refer to the [python document](https://vortex.rupeezy.in/docs/pyvortex/vortex_api.html) for all methods and features
|
|
84
84
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"""
|
|
2
|
-
Vortex API client for Python -- [Visit Api Center](https://vortex.
|
|
2
|
+
Vortex API client for Python -- [Visit Api Center](https://vortex.rupeezy.in).
|
|
3
3
|
Astha Credit & Securities Pvt. Ltd. (c) 2023
|
|
4
4
|
|
|
5
5
|
License
|
|
6
6
|
-------
|
|
7
|
-
|
|
7
|
+
Rupeezy's Vortex Python library is licensed under the MIT License
|
|
8
8
|
|
|
9
9
|
The library
|
|
10
10
|
-----------
|
|
@@ -17,12 +17,12 @@ the hassle of managing the apis.
|
|
|
17
17
|
Getting started
|
|
18
18
|
---------------
|
|
19
19
|
#!python
|
|
20
|
-
from vortex_api import
|
|
20
|
+
from vortex_api import VortexAPI
|
|
21
21
|
|
|
22
|
-
client =
|
|
22
|
+
client = VortexAPI("your api secret","your application id")
|
|
23
23
|
|
|
24
|
-
#For client login using
|
|
25
|
-
client.
|
|
24
|
+
#For client login using SSO
|
|
25
|
+
client.login_url(callback_param="hi)
|
|
26
26
|
|
|
27
27
|
# Place order
|
|
28
28
|
|
|
@@ -33,6 +33,6 @@ Getting started
|
|
|
33
33
|
|
|
34
34
|
"""
|
|
35
35
|
from __future__ import unicode_literals, absolute_import
|
|
36
|
-
from vortex_api.api import
|
|
36
|
+
from vortex_api.api import VortexAPI,Constants
|
|
37
37
|
from vortex_api.vortex_feed import VortexFeed
|
|
38
|
-
__all__ = [
|
|
38
|
+
__all__ = [VortexAPI,Constants,VortexFeed]
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
__name__ = "vortex_api"
|
|
2
|
+
__description__ = "Vortex APIs to place orders in Rupeezy application"
|
|
3
|
+
__url__ = "https://vortex.rupeezy.in"
|
|
4
|
+
__download_url__ = "https://github.com/AsthaTech/pyvortex"
|
|
5
|
+
__version__ = "2.0.0"
|
|
6
|
+
__author__ = "Astha Credit & Securities Pvt Ltd."
|
|
7
|
+
__author_email__ = "tech@rupeezy.in"
|
|
8
|
+
__license__ = "MIT"
|
|
@@ -5,6 +5,7 @@ import logging
|
|
|
5
5
|
from enum import Enum
|
|
6
6
|
import inspect
|
|
7
7
|
import wrapt
|
|
8
|
+
import hashlib
|
|
8
9
|
|
|
9
10
|
class Constants:
|
|
10
11
|
"""
|
|
@@ -15,7 +16,9 @@ class Constants:
|
|
|
15
16
|
Constants for exchanges
|
|
16
17
|
"""
|
|
17
18
|
NSE_FO = "NSE_FO"
|
|
19
|
+
BSE_FO = "BSE_FO"
|
|
18
20
|
NSE_EQUITY = "NSE_EQ"
|
|
21
|
+
BSE_EQUITY = "BSE_EQ"
|
|
19
22
|
NSE_CURRENCY = "NSE_CD"
|
|
20
23
|
MCX = "MCX_FO"
|
|
21
24
|
|
|
@@ -146,16 +149,16 @@ def validate_selected_methods(method_names):
|
|
|
146
149
|
return decorator
|
|
147
150
|
|
|
148
151
|
@validate_selected_methods(['login','place_order','modify_order','cancel_order','get_order_margin','historical_candles','quotes'])
|
|
149
|
-
class
|
|
152
|
+
class VortexAPI:
|
|
150
153
|
|
|
151
|
-
def __init__(self, api_key: str, application_id: str, base_url: str = "https://vortex.
|
|
154
|
+
def __init__(self, api_key: str, application_id: str, base_url: str = "https://vortex-api.rupeezy.in/v2",enable_logging: bool=False) -> None:
|
|
152
155
|
"""
|
|
153
|
-
Constructor method for
|
|
156
|
+
Constructor method for VortexAPI class.
|
|
154
157
|
|
|
155
158
|
Args:
|
|
156
|
-
api_key (str): API key for the
|
|
157
|
-
api_secret (str): API secret for the
|
|
158
|
-
base_url (str, optional): Base URL for the
|
|
159
|
+
api_key (str): API key for the Vortex API.
|
|
160
|
+
api_secret (str): API secret for the Vortex API.
|
|
161
|
+
base_url (str, optional): Base URL for the Vortex API. Defaults to "https://vortex-api.rupeezy.in/v2".
|
|
159
162
|
"""
|
|
160
163
|
self.api_key = api_key
|
|
161
164
|
self.application_id = application_id
|
|
@@ -167,7 +170,7 @@ class AsthaTradeVortexAPI:
|
|
|
167
170
|
|
|
168
171
|
def _make_api_request(self, method: str, endpoint: str, data: dict = None, params=None) -> dict:
|
|
169
172
|
"""
|
|
170
|
-
Private method to make HTTP requests to the
|
|
173
|
+
Private method to make HTTP requests to the Vortex API.
|
|
171
174
|
|
|
172
175
|
Args:
|
|
173
176
|
method (str): HTTP method for the request (e.g. "GET", "POST", "PUT", "DELETE").
|
|
@@ -195,7 +198,7 @@ class AsthaTradeVortexAPI:
|
|
|
195
198
|
|
|
196
199
|
def _make_unauth_request(self, method: str, endpoint: str, data: dict = None, params: dict = None) -> dict:
|
|
197
200
|
"""
|
|
198
|
-
Private method to make HTTP requests to the
|
|
201
|
+
Private method to make HTTP requests to the Vortex API.
|
|
199
202
|
|
|
200
203
|
Args:
|
|
201
204
|
method (str): HTTP method for the request (e.g. "GET", "POST", "PUT", "DELETE").
|
|
@@ -217,10 +220,10 @@ class AsthaTradeVortexAPI:
|
|
|
217
220
|
|
|
218
221
|
def login(self, client_code: str, password: str, totp: str)->dict:
|
|
219
222
|
"""
|
|
220
|
-
Login using password and totp directly
|
|
223
|
+
Depricating Soon. Use SSO Login instead. Login using password and totp directly
|
|
221
224
|
|
|
222
225
|
Documentation:
|
|
223
|
-
https://vortex.
|
|
226
|
+
https://vortex.rupeezy.in/docs/authentication/
|
|
224
227
|
|
|
225
228
|
Args:
|
|
226
229
|
client_code(str): Client Code of the account
|
|
@@ -246,7 +249,7 @@ class AsthaTradeVortexAPI:
|
|
|
246
249
|
Download list of all available instruments and their details across all exchanges
|
|
247
250
|
|
|
248
251
|
Documentation:
|
|
249
|
-
https://vortex.
|
|
252
|
+
https://vortex.rupeezy.in/docs/historical/#instrument-list
|
|
250
253
|
|
|
251
254
|
Returns:
|
|
252
255
|
dict: CSV Array of all instruments. The first row contains headers
|
|
@@ -267,10 +270,10 @@ class AsthaTradeVortexAPI:
|
|
|
267
270
|
Place an order for a specific security
|
|
268
271
|
|
|
269
272
|
Documentation:
|
|
270
|
-
https://vortex.
|
|
273
|
+
https://vortex.rupeezy.in/docs/order/#placing-an-order
|
|
271
274
|
|
|
272
275
|
Args:
|
|
273
|
-
exchange (Constants.ExchangeTypes): Possible values: [NSE_EQ, NSE_FO, NSE_CD or MCX_FO]
|
|
276
|
+
exchange (Constants.ExchangeTypes): Possible values: [NSE_EQ, NSE_FO, BSE_EQ, BSE_FO, NSE_CD or MCX_FO]
|
|
274
277
|
token (int): Security token of the scrip. It can be found in the scripmaster file
|
|
275
278
|
transaction_type (Constants.TransactionSides): Possible values: [BUY, SELL]
|
|
276
279
|
product (Constants.ProductTypes): Possible values: [INTRADAY, DELIVERY, MTF]. MTF product can only be used in NSE_EQ exchange.
|
|
@@ -294,7 +297,7 @@ class AsthaTradeVortexAPI:
|
|
|
294
297
|
HTTPError: If any HTTP error occurs during the API call
|
|
295
298
|
"""
|
|
296
299
|
|
|
297
|
-
endpoint = "/orders/regular"
|
|
300
|
+
endpoint = "/trading/orders/regular"
|
|
298
301
|
if validity == Constants.ValidityTypes.FULL_DAY:
|
|
299
302
|
validity_days = 1
|
|
300
303
|
is_amo = False
|
|
@@ -322,15 +325,15 @@ class AsthaTradeVortexAPI:
|
|
|
322
325
|
|
|
323
326
|
return self._make_api_request("POST", endpoint, data=data)
|
|
324
327
|
|
|
325
|
-
def modify_order(self,
|
|
328
|
+
def modify_order(self, order_id: str, variety: Constants.VarietyTypes, quantity: int, traded_quantity: int, price: float, trigger_price: float, disclosed_quantity: int, validity: Constants.ValidityTypes) -> dict:
|
|
326
329
|
"""
|
|
327
|
-
Method to modify an order using the
|
|
330
|
+
Method to modify an order using the Vortex API.
|
|
328
331
|
|
|
329
332
|
Documentation:
|
|
330
|
-
https://vortex.
|
|
333
|
+
https://vortex.rupeezy.in/docs/order/#modifying-an-order
|
|
331
334
|
|
|
332
335
|
Args:
|
|
333
|
-
exchange (Constants.ExchangeTypes): Possible values: [NSE_EQ, NSE_FO, NSE_CD or MCX_FO]
|
|
336
|
+
exchange (Constants.ExchangeTypes): Possible values: [NSE_EQ, NSE_FO, BSE_EQ, BSE_FO, NSE_CD or MCX_FO]
|
|
334
337
|
order_id (str): The unique ID of the order to modify.
|
|
335
338
|
variety (Constants.VarietyTypes): Possible values: [RL, RL-MKT, SL, SL-MKT]. RL means regular orders, SL means Stop Loss order.
|
|
336
339
|
MKT means that the trade will happen at market price
|
|
@@ -344,7 +347,8 @@ class AsthaTradeVortexAPI:
|
|
|
344
347
|
Returns:
|
|
345
348
|
dict: Dictionary containing the response data from the API.
|
|
346
349
|
"""
|
|
347
|
-
|
|
350
|
+
|
|
351
|
+
endpoint = f"/trading/orders/regular/{order_id}"
|
|
348
352
|
if validity == Constants.ValidityTypes.FULL_DAY:
|
|
349
353
|
validity_days = 1
|
|
350
354
|
elif validity == Constants.ValidityTypes.IMMEDIATE_OR_CANCEL:
|
|
@@ -364,22 +368,22 @@ class AsthaTradeVortexAPI:
|
|
|
364
368
|
}
|
|
365
369
|
return self._make_api_request("PUT", endpoint, data=data)
|
|
366
370
|
|
|
367
|
-
def cancel_order(self,
|
|
371
|
+
def cancel_order(self, order_id: str) -> dict:
|
|
368
372
|
"""
|
|
369
|
-
Method to cancel an order using the
|
|
373
|
+
Method to cancel an order using the Vortex API.
|
|
370
374
|
|
|
371
375
|
Documentation:
|
|
372
|
-
https://vortex.
|
|
376
|
+
https://vortex.rupeezy.in/docs/order/#cancel-an-order
|
|
373
377
|
|
|
374
378
|
Args:
|
|
375
|
-
exchange (Constants.ExchangeTypes): Possible values: [NSE_EQ, NSE_FO, NSE_CD or MCX_FO]
|
|
379
|
+
exchange (Constants.ExchangeTypes): Possible values: [NSE_EQ, NSE_FO, BSE_EQ, BSE_FO, NSE_CD or MCX_FO]
|
|
376
380
|
order_id (str): The unique ID of the order to cancel.
|
|
377
381
|
|
|
378
382
|
Returns:
|
|
379
383
|
dict: Dictionary containing the response data from the API.
|
|
380
384
|
"""
|
|
381
385
|
|
|
382
|
-
endpoint = f"/orders/regular/{
|
|
386
|
+
endpoint = f"/trading/orders/regular/{order_id}"
|
|
383
387
|
return self._make_api_request("DELETE", endpoint)
|
|
384
388
|
|
|
385
389
|
def orders(self,limit: int, offset: int) -> dict:
|
|
@@ -387,7 +391,7 @@ class AsthaTradeVortexAPI:
|
|
|
387
391
|
Method to get all orders.
|
|
388
392
|
|
|
389
393
|
Documentation:
|
|
390
|
-
https://vortex.
|
|
394
|
+
https://vortex.rupeezy.in/docs/order/#fetching-order-book
|
|
391
395
|
|
|
392
396
|
Args:
|
|
393
397
|
limit (int): Limit is the number of orders to be fetched.
|
|
@@ -396,7 +400,7 @@ class AsthaTradeVortexAPI:
|
|
|
396
400
|
Returns:
|
|
397
401
|
dict: Dictionary containing the response data from the API.
|
|
398
402
|
"""
|
|
399
|
-
endpoint = f"/orders?limit={limit}&offset={offset}"
|
|
403
|
+
endpoint = f"/trading/orders?limit={limit}&offset={offset}"
|
|
400
404
|
return self._make_api_request("GET", endpoint)
|
|
401
405
|
|
|
402
406
|
def order_history(self,order_id: str) -> dict:
|
|
@@ -404,7 +408,7 @@ class AsthaTradeVortexAPI:
|
|
|
404
408
|
Method to get the order history of a particular order
|
|
405
409
|
|
|
406
410
|
Documentation:
|
|
407
|
-
https://vortex.
|
|
411
|
+
https://vortex.rupeezy.in/docs/order/
|
|
408
412
|
|
|
409
413
|
Args:
|
|
410
414
|
order_id (str): Order id for which history has to be fetched
|
|
@@ -412,41 +416,54 @@ class AsthaTradeVortexAPI:
|
|
|
412
416
|
Returns:
|
|
413
417
|
dict: Dictionary containing the response data from the API.
|
|
414
418
|
"""
|
|
415
|
-
endpoint = f"/orders/{order_id}"
|
|
419
|
+
endpoint = f"/trading/orders/{order_id}"
|
|
416
420
|
return self._make_api_request("GET", endpoint)
|
|
417
421
|
|
|
418
422
|
def positions(self) -> dict:
|
|
419
423
|
"""
|
|
420
|
-
Method to get the position book using the
|
|
424
|
+
Method to get the position book using the Vortex API.
|
|
421
425
|
|
|
422
426
|
Documentation:
|
|
423
|
-
https://vortex.
|
|
427
|
+
https://vortex.rupeezy.in/docs/positions/#fetch-all-positions
|
|
424
428
|
|
|
425
429
|
Returns:
|
|
426
430
|
dict: Dictionary containing the response data from the API.
|
|
427
431
|
"""
|
|
428
|
-
endpoint = f"/portfolio/positions"
|
|
432
|
+
endpoint = f"/trading/portfolio/positions"
|
|
429
433
|
return self._make_api_request("GET", endpoint)
|
|
430
434
|
|
|
431
435
|
def holdings(self) -> dict:
|
|
432
436
|
"""
|
|
433
|
-
Method to get the holdings of the user using the
|
|
437
|
+
Method to get the holdings of the user using the Vortex API.
|
|
434
438
|
|
|
435
439
|
Documentation:
|
|
436
|
-
https://vortex.
|
|
440
|
+
https://vortex.rupeezy.in/docs/holdings/
|
|
437
441
|
|
|
438
442
|
Returns:
|
|
439
443
|
dict: Dictionary containing the response data from the API.
|
|
440
444
|
"""
|
|
441
|
-
endpoint = "/portfolio/holdings"
|
|
445
|
+
endpoint = "/trading/portfolio/holdings"
|
|
446
|
+
return self._make_api_request("GET", endpoint)
|
|
447
|
+
|
|
448
|
+
def trades(self) -> dict:
|
|
449
|
+
"""
|
|
450
|
+
Method to get today's trades of the user using the Vortex API.
|
|
451
|
+
|
|
452
|
+
Documentation:
|
|
453
|
+
https://vortex.rupeezy.in/docs/positions/#get-trades
|
|
454
|
+
|
|
455
|
+
Returns:
|
|
456
|
+
dict: Dictionary containing the response data from the API.
|
|
457
|
+
"""
|
|
458
|
+
endpoint = "/trading/trades"
|
|
442
459
|
return self._make_api_request("GET", endpoint)
|
|
443
460
|
|
|
444
461
|
def funds(self) -> dict:
|
|
445
462
|
"""
|
|
446
|
-
Method to get the funds of the user using the
|
|
463
|
+
Method to get the funds of the user using the Vortex API.
|
|
447
464
|
|
|
448
465
|
Documentation:
|
|
449
|
-
https://vortex.
|
|
466
|
+
https://vortex.rupeezy.in/docs/user/#available-funds
|
|
450
467
|
|
|
451
468
|
Returns:
|
|
452
469
|
dict: Dictionary containing the response data from the API.
|
|
@@ -460,10 +477,10 @@ class AsthaTradeVortexAPI:
|
|
|
460
477
|
Get the margin required for placing an order for a specific security.
|
|
461
478
|
|
|
462
479
|
Documentation:
|
|
463
|
-
https://vortex.
|
|
480
|
+
https://vortex.rupeezy.in/docs/margin/#order-margin
|
|
464
481
|
|
|
465
482
|
Args:
|
|
466
|
-
exchange (Constants.ExchangeTypes): Possible values: [NSE_EQ, NSE_FO, NSE_CD or MCX_FO]
|
|
483
|
+
exchange (Constants.ExchangeTypes): Possible values: [NSE_EQ, NSE_FO, BSE_EQ, BSE_FO, NSE_CD or MCX_FO]
|
|
467
484
|
token (int): Security token of the scrip. It can be found in the scripmaster file
|
|
468
485
|
transaction_type (Constants.TransactionSides): Possible values: [BUY, SELL]
|
|
469
486
|
product (Constants.ProductTypes): Possible values: [INTRADAY, DELIVERY, MTF]. MTF product can only be used in NSE_EQ exchange.
|
|
@@ -507,7 +524,7 @@ class AsthaTradeVortexAPI:
|
|
|
507
524
|
Gets quotes of up to 1000 instruments at a time.
|
|
508
525
|
|
|
509
526
|
Documentation:
|
|
510
|
-
https://vortex.
|
|
527
|
+
https://vortex.rupeezy.in/docs/historical/#fetch-price-quotes
|
|
511
528
|
|
|
512
529
|
Args:
|
|
513
530
|
instrument(list): List of instruments. The items should be like ( "NSE_EQ-22", "NSE_FO-1234")
|
|
@@ -517,7 +534,7 @@ class AsthaTradeVortexAPI:
|
|
|
517
534
|
dict: JSON response containing quotes. It is possible that not all the symbol identifiers you passed had a quote available. Those inputs will be missing from the response.
|
|
518
535
|
Also, the order of output might be different than the order of input
|
|
519
536
|
"""
|
|
520
|
-
endpoint = "/data/
|
|
537
|
+
endpoint = "/data/quotes"
|
|
521
538
|
params = {"q": instruments,"mode": mode}
|
|
522
539
|
return self._make_api_request("GET", endpoint, data=None,params=params)
|
|
523
540
|
|
|
@@ -526,10 +543,10 @@ class AsthaTradeVortexAPI:
|
|
|
526
543
|
Gets historical candle data of a particular instrument.
|
|
527
544
|
|
|
528
545
|
Documentation:
|
|
529
|
-
https://vortex.
|
|
546
|
+
https://vortex.rupeezy.in/docs/historical/#fetch-historical-candle-data
|
|
530
547
|
|
|
531
548
|
Args:
|
|
532
|
-
exchange (Constants.ExchangeTypes): Possible values: [NSE_EQ, NSE_FO, NSE_CD or MCX_FO]
|
|
549
|
+
exchange (Constants.ExchangeTypes): Possible values: [NSE_EQ, NSE_FO, BSE_EQ, BSE_FO, NSE_CD or MCX_FO]
|
|
533
550
|
token (int): Security token of the scrip. It can be found in the instruments master file:
|
|
534
551
|
to (datetime): datetime up till when you want to receive candles
|
|
535
552
|
start (datetime): datetime from when you want to receive candles
|
|
@@ -551,7 +568,48 @@ class AsthaTradeVortexAPI:
|
|
|
551
568
|
params = {"exchange": exchange,"token": token , "to": int(to.timestamp()), "from": int(start.timestamp()), "resolution": resolution}
|
|
552
569
|
return self._make_api_request("GET", endpoint, data=None,params=params)
|
|
553
570
|
|
|
571
|
+
def login_url(self, callback_param: str) -> str:
|
|
572
|
+
"""
|
|
573
|
+
Returns the login URL for the Vortex API.
|
|
574
|
+
|
|
575
|
+
Documentation:
|
|
576
|
+
https://vortex.rupeezy.in/docs/authentication/
|
|
577
|
+
|
|
578
|
+
Returns:
|
|
579
|
+
str: The login URL for the Vortex API.
|
|
580
|
+
"""
|
|
581
|
+
|
|
582
|
+
return f"https://flow.rupeezy.in?applicationId={self.application_id}&cb_param={callback_param}"
|
|
554
583
|
|
|
584
|
+
def exchange_token(self,auth_code: str) -> dict:
|
|
585
|
+
"""
|
|
586
|
+
Exchange the auth code received from the login URL for an access token.
|
|
587
|
+
|
|
588
|
+
Documentation:
|
|
589
|
+
https://vortex.rupeezy.in/docs/authentication/
|
|
590
|
+
|
|
591
|
+
Args:
|
|
592
|
+
auth_code (str): The authorization code received from the login URL.
|
|
593
|
+
|
|
594
|
+
Returns:
|
|
595
|
+
dict: JSON response containing the details of the user
|
|
596
|
+
"""
|
|
597
|
+
|
|
598
|
+
endpoint = "/user/session"
|
|
599
|
+
data = {
|
|
600
|
+
"token": auth_code,
|
|
601
|
+
"applicationId": self.application_id,
|
|
602
|
+
"checksum": self._sha256_hash(f"{self.application_id}{auth_code}{self.api_key}")
|
|
603
|
+
}
|
|
604
|
+
res = self._make_unauth_request("POST", endpoint= endpoint, data=data)
|
|
605
|
+
self._setup_client_code(login_object=res)
|
|
606
|
+
return res
|
|
607
|
+
|
|
608
|
+
def _sha256_hash(self,text: str) -> str:
|
|
609
|
+
sha = hashlib.sha256()
|
|
610
|
+
sha.update(text.encode('utf-8'))
|
|
611
|
+
return sha.hexdigest()
|
|
612
|
+
|
|
555
613
|
def _setup_client_code(self, login_object: dict) -> bool:
|
|
556
614
|
"""
|
|
557
615
|
Sets up access token after login
|
|
@@ -234,7 +234,7 @@ class VortexFeed:
|
|
|
234
234
|
_message_subscribe = "subscribe"
|
|
235
235
|
_message_unsubscribe = "unsubscribe"
|
|
236
236
|
|
|
237
|
-
def __init__(self, access_token: str, websocket_endpoint="wss://wire.
|
|
237
|
+
def __init__(self, access_token: str, websocket_endpoint="wss://wire.rupeezy.in/ws",reconnect=True, reconnect_max_tries=RECONNECT_MAX_TRIES, reconnect_max_delay=RECONNECT_MAX_DELAY,
|
|
238
238
|
connect_timeout=CONNECT_TIMEOUT, debug = False) -> None:
|
|
239
239
|
self._maximum_reconnect_max_tries = self.RECONNECT_MAX_TRIES
|
|
240
240
|
self._minimum_reconnect_max_delay = 0
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
2
|
-
Name:
|
|
3
|
-
Version:
|
|
4
|
-
Summary: Vortex APIs to place orders in
|
|
5
|
-
Home-page: https://vortex.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vortex_api
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Vortex APIs to place orders in Rupeezy application
|
|
5
|
+
Home-page: https://vortex.rupeezy.in
|
|
6
6
|
Download-URL: https://github.com/AsthaTech/pyvortex
|
|
7
7
|
Author: Astha Credit & Securities Pvt Ltd.
|
|
8
|
-
Author-email: tech@
|
|
8
|
+
Author-email: tech@rupeezy.in
|
|
9
9
|
License: MIT
|
|
10
10
|
Classifier: Intended Audience :: Developers
|
|
11
11
|
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
@@ -18,6 +18,24 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
|
18
18
|
Classifier: Topic :: Software Development :: Libraries
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE
|
|
21
|
+
Requires-Dist: requests>=2.25.1
|
|
22
|
+
Requires-Dist: wrapt>=1.15.0
|
|
23
|
+
Requires-Dist: six>=1.11.0
|
|
24
|
+
Requires-Dist: pyOpenSSL>=17.5.0
|
|
25
|
+
Requires-Dist: python-dateutil>=2.6.1
|
|
26
|
+
Requires-Dist: autobahn[twisted]==19.11.2
|
|
27
|
+
Requires-Dist: service_identity>=18.1.0
|
|
28
|
+
Dynamic: author
|
|
29
|
+
Dynamic: author-email
|
|
30
|
+
Dynamic: classifier
|
|
31
|
+
Dynamic: description
|
|
32
|
+
Dynamic: description-content-type
|
|
33
|
+
Dynamic: download-url
|
|
34
|
+
Dynamic: home-page
|
|
35
|
+
Dynamic: license
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
Dynamic: requires-dist
|
|
38
|
+
Dynamic: summary
|
|
21
39
|
|
|
22
40
|
# Vortex API Python Client
|
|
23
41
|
|
|
@@ -31,10 +49,10 @@ pip install vortex-api
|
|
|
31
49
|
# Api Usage
|
|
32
50
|
|
|
33
51
|
```python
|
|
34
|
-
from vortex_api import
|
|
52
|
+
from vortex_api import VortexAPI
|
|
35
53
|
from vortex_api import Constants as Vc
|
|
36
54
|
|
|
37
|
-
client =
|
|
55
|
+
client = VortexAPI("your api secret","your application id")
|
|
38
56
|
|
|
39
57
|
#For client login using TOTP
|
|
40
58
|
client.login("client code","client password","totp")
|
|
@@ -62,7 +80,7 @@ client.orders(limit=20,offset=1)
|
|
|
62
80
|
# Connecting to websocket
|
|
63
81
|
|
|
64
82
|
Using the feed, you can listen to both price quote changes and order/trade updates. You need to define your own callbacks for `on_price_update`
|
|
65
|
-
and `on_order_update`. The packet structure for `on_order_update` is the same as that received in postbacks and is available [here](https://vortex.
|
|
83
|
+
and `on_order_update`. The packet structure for `on_order_update` is the same as that received in postbacks and is available [here](https://vortex.rupeezy.in/docs/postbacks/)
|
|
66
84
|
|
|
67
85
|
```python
|
|
68
86
|
from vortex_api import VortexFeed
|
|
@@ -101,5 +119,5 @@ if __name__ == "__main__":
|
|
|
101
119
|
main()
|
|
102
120
|
|
|
103
121
|
```
|
|
104
|
-
Refer to the [python document](https://vortex.
|
|
122
|
+
Refer to the [python document](https://vortex.rupeezy.in/docs/pyvortex/vortex_api.html) for all methods and features
|
|
105
123
|
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
__name__ = "vortex_api"
|
|
2
|
-
__description__ = "Vortex APIs to place orders in AsthaTrade Flow application"
|
|
3
|
-
__url__ = "https://vortex.asthatrade.com"
|
|
4
|
-
__download_url__ = "https://github.com/AsthaTech/pyvortex"
|
|
5
|
-
__version__ = "1.0.7"
|
|
6
|
-
__author__ = "Astha Credit & Securities Pvt Ltd."
|
|
7
|
-
__author_email__ = "tech@asthatrade.com"
|
|
8
|
-
__license__ = "MIT"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|