quantplay 2.0.65__tar.gz → 2.0.67__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 (65) hide show
  1. {quantplay-2.0.65 → quantplay-2.0.67}/PKG-INFO +26 -1
  2. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/five_paisa.py +1 -0
  3. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/flattrade.py +17 -11
  4. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/ft_utils/flattrade_utils.py +31 -4
  5. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/kotak.py +11 -8
  6. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/motilal.py +2 -1
  7. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/shoonya.py +8 -4
  8. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/upstox.py +1 -0
  9. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/zerodha.py +1 -1
  10. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay.egg-info/PKG-INFO +26 -1
  11. {quantplay-2.0.65 → quantplay-2.0.67}/setup.py +1 -1
  12. {quantplay-2.0.65 → quantplay-2.0.67}/README.md +0 -0
  13. {quantplay-2.0.65 → quantplay-2.0.67}/pyproject.toml +0 -0
  14. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/__init__.py +0 -0
  15. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/__init__.py +0 -0
  16. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/aliceblue.py +0 -0
  17. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/angelone.py +0 -0
  18. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/auto_login/__init__.py +0 -0
  19. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/auto_login/aliceblue.py +0 -0
  20. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/broker_factory.py +0 -0
  21. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/dhan.py +0 -0
  22. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/finvasia_utils/__init__.py +0 -0
  23. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/finvasia_utils/fa_noren.py +0 -0
  24. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/ft_utils/__init__.py +0 -0
  25. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/ft_utils/ft_noren.py +0 -0
  26. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/generics/__init__.py +0 -0
  27. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/generics/broker.py +0 -0
  28. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/iifl_xts.py +0 -0
  29. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/kite_utils.py +0 -0
  30. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/noren.py +0 -0
  31. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/uplink/__init__.py +0 -0
  32. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/uplink/uplink_utils.py +0 -0
  33. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/xts.py +0 -0
  34. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/xts_utils/Connect.py +0 -0
  35. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/xts_utils/Exception.py +0 -0
  36. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/xts_utils/InteractiveSocketClient.py +0 -0
  37. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/broker/xts_utils/__init__.py +0 -0
  38. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/exception/__init__.py +0 -0
  39. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/exception/exceptions.py +0 -0
  40. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/model/__init__.py +0 -0
  41. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/model/broker.py +0 -0
  42. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/model/generics.py +0 -0
  43. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/model/instrument_data.py +0 -0
  44. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/model/order_event.py +0 -0
  45. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/py.typed +0 -0
  46. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/utils/__init__.py +0 -0
  47. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/utils/caching.py +0 -0
  48. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/utils/constant.py +0 -0
  49. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/utils/exchange.py +0 -0
  50. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/utils/number_utils.py +0 -0
  51. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/utils/pickle_utils.py +0 -0
  52. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/utils/selenium_utils.py +0 -0
  53. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/wrapper/__init__.py +0 -0
  54. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/wrapper/aws/__init__.py +0 -0
  55. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay/wrapper/aws/s3.py +0 -0
  56. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay.egg-info/SOURCES.txt +0 -0
  57. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay.egg-info/dependency_links.txt +0 -0
  58. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay.egg-info/requires.txt +0 -0
  59. {quantplay-2.0.65 → quantplay-2.0.67}/quantplay.egg-info/top_level.txt +0 -0
  60. {quantplay-2.0.65 → quantplay-2.0.67}/setup.cfg +0 -0
  61. {quantplay-2.0.65 → quantplay-2.0.67}/tests/__init__.py +0 -0
  62. {quantplay-2.0.65 → quantplay-2.0.67}/tests/conftest.py +0 -0
  63. {quantplay-2.0.65 → quantplay-2.0.67}/tests/wrapper/__init__.py +0 -0
  64. {quantplay-2.0.65 → quantplay-2.0.67}/tests/wrapper/aws/__init__.py +0 -0
  65. {quantplay-2.0.65 → quantplay-2.0.67}/tests/wrapper/aws/s3_test.py +0 -0
@@ -1,11 +1,36 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quantplay
3
- Version: 2.0.65
3
+ Version: 2.0.67
4
4
  Summary: This python package will be stored in AWS CodeArtifact
5
5
  Home-page:
6
6
  Author:
7
7
  Author-email:
8
8
  License: MIT
9
+ Requires-Dist: setuptools
10
+ Requires-Dist: path
11
+ Requires-Dist: pyotp
12
+ Requires-Dist: retrying
13
+ Requires-Dist: boto3
14
+ Requires-Dist: numpy
15
+ Requires-Dist: websocket-client
16
+ Requires-Dist: smartapi-python
17
+ Requires-Dist: logzero
18
+ Requires-Dist: selenium
19
+ Requires-Dist: requests
20
+ Requires-Dist: pandas
21
+ Requires-Dist: pyarrow
22
+ Requires-Dist: polars
23
+ Requires-Dist: kiteconnect
24
+ Requires-Dist: pya3
25
+ Requires-Dist: py5paisa
26
+ Requires-Dist: upstox-python-sdk
27
+ Requires-Dist: undetected-chromedriver
28
+ Requires-Dist: cachetools
29
+ Requires-Dist: py_vollib
30
+ Requires-Dist: python-engineio
31
+ Requires-Dist: python-socketio
32
+ Requires-Dist: six
33
+ Requires-Dist: dhanhq
9
34
 
10
35
  # Quantplay Alpha playground
11
36
 
@@ -81,6 +81,7 @@ class FivePaisa(Broker):
81
81
 
82
82
  try:
83
83
  self.margins()
84
+
84
85
  except TokenException:
85
86
  raise RetryableException("Generating token again")
86
87
  else:
@@ -2,12 +2,13 @@ import binascii
2
2
  import hashlib
3
3
  from queue import Queue
4
4
 
5
+ from kiteconnect.exceptions import TokenException
5
6
  import requests
6
7
 
7
8
  from quantplay.broker.ft_utils.flattrade_utils import FlatTradeUtils
8
9
  from quantplay.broker.ft_utils.ft_noren import FT_NorenApi
9
10
  from quantplay.broker.noren import Noren
10
- from quantplay.exception.exceptions import InvalidArgumentException, RetryableException
11
+ from quantplay.exception.exceptions import RetryableException
11
12
  from quantplay.model.order_event import OrderUpdateEvent
12
13
 
13
14
 
@@ -32,6 +33,12 @@ class FlatTrade(Noren):
32
33
  try:
33
34
  if user_token and user_id:
34
35
  self.api.set_session(userid=user_id, usertoken=user_token)
36
+ response = {
37
+ "susertoken": user_token,
38
+ "actid": user_id,
39
+ "email": None,
40
+ "uname": None,
41
+ }
35
42
 
36
43
  elif user_id and password and totp and api_key and api_secret:
37
44
  token = self.login(
@@ -43,21 +50,20 @@ class FlatTrade(Noren):
43
50
  )
44
51
 
45
52
  self.api.set_session(userid=user_id, usertoken=token)
53
+ response = {
54
+ "susertoken": token,
55
+ "actid": user_id,
56
+ "email": None,
57
+ "uname": None,
58
+ }
46
59
 
47
60
  else:
48
- raise InvalidArgumentException("Missing Arguments")
61
+ raise TokenException("Missing Arguments")
49
62
 
50
- response = {
51
- "susertoken": user_token,
52
- "actid": user_id,
53
- "email": None,
54
- "uname": None,
55
- }
56
-
57
- except InvalidArgumentException:
63
+ except TokenException:
58
64
  raise
59
65
  except binascii.Error:
60
- raise InvalidArgumentException("Invalid TOTP key provided")
66
+ raise TokenException("Invalid TOTP key provided")
61
67
  except Exception as e:
62
68
  raise RetryableException(str(e))
63
69
 
@@ -22,6 +22,7 @@ class FlatTradeUtils:
22
22
  totp_xpath = '//*[@id="pan"]'
23
23
 
24
24
  login_xpath = '//*[@id="sbmt"]'
25
+ error_xpath = '//*[@id="app"]/div/div/div[2]/div/div[2]/div[1]/div/form/div[5]/div'
25
26
 
26
27
  @staticmethod
27
28
  @retry(
@@ -58,8 +59,34 @@ class FlatTradeUtils:
58
59
 
59
60
  url = driver.current_url
60
61
 
62
+ if url.split("/")[2] == flattrade_url.split("/")[2]:
63
+ error_message = ""
64
+
65
+ try:
66
+ error_attempt = driver.find_element(
67
+ "xpath", FlatTradeUtils.error_xpath
68
+ )
69
+ error_message = error_attempt.text
70
+
71
+ if error_message in [
72
+ "Invalid Input : Wrong Password",
73
+ "Invalid API key",
74
+ ]:
75
+ raise InvalidArgumentException(
76
+ f"Flattrade Login Failed: {error_message}"
77
+ )
78
+
79
+ except Exception as e:
80
+ Constants.logger.error(f"Flattrade Selenium Error : {e}")
81
+ traceback.print_exc()
82
+
83
+ finally:
84
+ Constants.logger.error(
85
+ f"Flattrade Unkown Selenium Error : {error_message}"
86
+ )
87
+ raise Exception(f"Flattrade Unkown Selenium Error : {error_message}")
88
+
61
89
  try:
62
- # TODO: IndexError: list index out of range
63
90
  request_token = url.split("code=")[1].split("&")[0]
64
91
  except Exception as e:
65
92
  Constants.logger.error(f"Flattrade Selenium Error for {url}")
@@ -72,10 +99,10 @@ class FlatTradeUtils:
72
99
 
73
100
  except binascii.Error:
74
101
  raise InvalidArgumentException("Invalid TOTP key provided")
75
- except InvalidArgumentException:
76
- raise
102
+ except InvalidArgumentException as e:
103
+ raise e
77
104
  except WebDriverException:
78
105
  raise WrongLibrarySetup("Selenium setup need to be fixed")
79
106
  except Exception as e:
80
- print(traceback.print_exc())
107
+ traceback.print_exc()
81
108
  raise RetryableException(str(e))
@@ -21,11 +21,8 @@ PROD_BASE_URL = "https://gw-napi.kotaksecurities.com/"
21
21
  SESSION_PROD_BASE_URL = "https://napi.kotaksecurities.com/"
22
22
 
23
23
 
24
- # EvOUzPVqkwvlFl_6cZYZSCO5mwQa
25
- # pVwafvF3ssA_jFVbKPrwhKt7igwa
26
- # Kotak@123
27
- # +918149949114
28
- # 491700
24
+ # from quantplay.broker.kotak import Kotak
25
+ # client = Kotak(None,"EvOUzPVqkwvlFl_6cZYZSCO5mwQa","pVwafvF3ssA_jFVbKPrwhKt7igwa","+918149949114","Kotak@123","491700")
29
26
 
30
27
 
31
28
  class Kotak(Broker):
@@ -84,8 +81,6 @@ class Kotak(Broker):
84
81
  data=json.dumps({"grant_type": "client_credentials"}),
85
82
  )
86
83
 
87
- print(session_init)
88
-
89
84
  if not session_init.ok:
90
85
  raise Exception("")
91
86
 
@@ -185,7 +180,15 @@ class Kotak(Broker):
185
180
  return {"user_id": self.user_id or ""}
186
181
 
187
182
  def margins(self) -> Dict[str, float]:
188
- return self.request("limits", body={"seg": "ALL", "exch": "ALL", "prod": "ALL"})
183
+ limits_resp = self.request(
184
+ "limits", body={"seg": "ALL", "exch": "ALL", "prod": "ALL"}
185
+ )
186
+
187
+ margins = {
188
+ "margin_used": limits_resp["MarginUsed"],
189
+ "margin_available": limits_resp["Net"],
190
+ }
191
+ return margins
189
192
 
190
193
  # **
191
194
  # ** POST/PUT Api's
@@ -139,8 +139,9 @@ class Motilal(Broker):
139
139
  raise Exception("Missing Arguments")
140
140
 
141
141
  self.user_id = self.headers["vendorinfo"]
142
+
142
143
  except binascii.Error:
143
- raise InvalidArgumentException("Invalid TOTP key provided")
144
+ raise TokenException("Invalid TOTP key provided")
144
145
  except InvalidArgumentException:
145
146
  raise
146
147
  except Exception as e:
@@ -5,7 +5,11 @@ import pyotp
5
5
 
6
6
  from quantplay.broker.finvasia_utils.fa_noren import FA_NorenApi
7
7
  from quantplay.broker.noren import Noren
8
- from quantplay.exception.exceptions import InvalidArgumentException, RetryableException
8
+ from quantplay.exception.exceptions import (
9
+ InvalidArgumentException,
10
+ RetryableException,
11
+ TokenException,
12
+ )
9
13
  from quantplay.model.order_event import OrderUpdateEvent
10
14
 
11
15
 
@@ -48,12 +52,12 @@ class FinvAsia(Noren):
48
52
  imei=imei,
49
53
  )
50
54
  else:
51
- raise InvalidArgumentException("Missing Args")
55
+ raise TokenException("Missing Args")
52
56
 
53
- except InvalidArgumentException:
57
+ except TokenException:
54
58
  raise
55
59
  except binascii.Error:
56
- raise InvalidArgumentException("Invalid TOTP key provided")
60
+ raise TokenException("Invalid TOTP key provided")
57
61
  except Exception as e:
58
62
  raise RetryableException(str(e))
59
63
 
@@ -133,6 +133,7 @@ class Upstox(Broker):
133
133
  try:
134
134
  symbol_info = self.symbol_data[f"{exchange}:{tradingsymbol}"]
135
135
  # Market quotes and instruments - LTP quotes.
136
+ # TODO:Check Get FN->symbol_info
136
137
  api_response = api_instance.ltp( # type: ignore
137
138
  symbol_info.get("instrument_key"), self.api_version
138
139
  )
@@ -112,7 +112,7 @@ class Zerodha(Broker):
112
112
 
113
113
  def stream_order_data(self):
114
114
  if self.wrapper.api_key is None or self.wrapper.access_token is None:
115
- raise InvalidArgumentException("")
115
+ raise InvalidArgumentException("Zerodha WS: API Key or Access Token Missing")
116
116
 
117
117
  kite_ticker = KiteTicker(self.wrapper.api_key, self.wrapper.access_token)
118
118
  kite_ticker.on_order_update = self.on_order_update
@@ -1,11 +1,36 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quantplay
3
- Version: 2.0.65
3
+ Version: 2.0.67
4
4
  Summary: This python package will be stored in AWS CodeArtifact
5
5
  Home-page:
6
6
  Author:
7
7
  Author-email:
8
8
  License: MIT
9
+ Requires-Dist: setuptools
10
+ Requires-Dist: path
11
+ Requires-Dist: pyotp
12
+ Requires-Dist: retrying
13
+ Requires-Dist: boto3
14
+ Requires-Dist: numpy
15
+ Requires-Dist: websocket-client
16
+ Requires-Dist: smartapi-python
17
+ Requires-Dist: logzero
18
+ Requires-Dist: selenium
19
+ Requires-Dist: requests
20
+ Requires-Dist: pandas
21
+ Requires-Dist: pyarrow
22
+ Requires-Dist: polars
23
+ Requires-Dist: kiteconnect
24
+ Requires-Dist: pya3
25
+ Requires-Dist: py5paisa
26
+ Requires-Dist: upstox-python-sdk
27
+ Requires-Dist: undetected-chromedriver
28
+ Requires-Dist: cachetools
29
+ Requires-Dist: py_vollib
30
+ Requires-Dist: python-engineio
31
+ Requires-Dist: python-socketio
32
+ Requires-Dist: six
33
+ Requires-Dist: dhanhq
9
34
 
10
35
  # Quantplay Alpha playground
11
36
 
@@ -21,7 +21,7 @@ requirements = [
21
21
  setup(
22
22
  name="quantplay",
23
23
  long_description=Path("README.md").read_text(),
24
- version="2.0.65",
24
+ version="2.0.67",
25
25
  setup_requires=["pytest-runner"],
26
26
  install_requires=requirements,
27
27
  tests_require=[],
File without changes
File without changes
File without changes
File without changes
File without changes