quantplay 2.0.67__tar.gz → 2.0.68__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.67 → quantplay-2.0.68}/PKG-INFO +1 -26
  2. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/dhan.py +5 -2
  3. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/five_paisa.py +0 -1
  4. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/flattrade.py +11 -17
  5. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/ft_utils/flattrade_utils.py +4 -31
  6. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/kotak.py +8 -11
  7. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/motilal.py +1 -2
  8. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/shoonya.py +4 -8
  9. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/upstox.py +0 -1
  10. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/zerodha.py +1 -1
  11. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay.egg-info/PKG-INFO +1 -26
  12. {quantplay-2.0.67 → quantplay-2.0.68}/setup.py +1 -1
  13. {quantplay-2.0.67 → quantplay-2.0.68}/README.md +0 -0
  14. {quantplay-2.0.67 → quantplay-2.0.68}/pyproject.toml +0 -0
  15. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/__init__.py +0 -0
  16. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/__init__.py +0 -0
  17. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/aliceblue.py +0 -0
  18. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/angelone.py +0 -0
  19. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/auto_login/__init__.py +0 -0
  20. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/auto_login/aliceblue.py +0 -0
  21. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/broker_factory.py +0 -0
  22. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/finvasia_utils/__init__.py +0 -0
  23. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/finvasia_utils/fa_noren.py +0 -0
  24. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/ft_utils/__init__.py +0 -0
  25. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/ft_utils/ft_noren.py +0 -0
  26. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/generics/__init__.py +0 -0
  27. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/generics/broker.py +0 -0
  28. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/iifl_xts.py +0 -0
  29. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/kite_utils.py +0 -0
  30. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/noren.py +0 -0
  31. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/uplink/__init__.py +0 -0
  32. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/uplink/uplink_utils.py +0 -0
  33. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/xts.py +0 -0
  34. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/xts_utils/Connect.py +0 -0
  35. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/xts_utils/Exception.py +0 -0
  36. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/xts_utils/InteractiveSocketClient.py +0 -0
  37. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/broker/xts_utils/__init__.py +0 -0
  38. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/exception/__init__.py +0 -0
  39. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/exception/exceptions.py +0 -0
  40. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/model/__init__.py +0 -0
  41. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/model/broker.py +0 -0
  42. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/model/generics.py +0 -0
  43. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/model/instrument_data.py +0 -0
  44. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/model/order_event.py +0 -0
  45. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/py.typed +0 -0
  46. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/utils/__init__.py +0 -0
  47. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/utils/caching.py +0 -0
  48. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/utils/constant.py +0 -0
  49. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/utils/exchange.py +0 -0
  50. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/utils/number_utils.py +0 -0
  51. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/utils/pickle_utils.py +0 -0
  52. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/utils/selenium_utils.py +0 -0
  53. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/wrapper/__init__.py +0 -0
  54. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/wrapper/aws/__init__.py +0 -0
  55. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay/wrapper/aws/s3.py +0 -0
  56. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay.egg-info/SOURCES.txt +0 -0
  57. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay.egg-info/dependency_links.txt +0 -0
  58. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay.egg-info/requires.txt +0 -0
  59. {quantplay-2.0.67 → quantplay-2.0.68}/quantplay.egg-info/top_level.txt +0 -0
  60. {quantplay-2.0.67 → quantplay-2.0.68}/setup.cfg +0 -0
  61. {quantplay-2.0.67 → quantplay-2.0.68}/tests/__init__.py +0 -0
  62. {quantplay-2.0.67 → quantplay-2.0.68}/tests/conftest.py +0 -0
  63. {quantplay-2.0.67 → quantplay-2.0.68}/tests/wrapper/__init__.py +0 -0
  64. {quantplay-2.0.67 → quantplay-2.0.68}/tests/wrapper/aws/__init__.py +0 -0
  65. {quantplay-2.0.67 → quantplay-2.0.68}/tests/wrapper/aws/s3_test.py +0 -0
@@ -1,36 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quantplay
3
- Version: 2.0.67
3
+ Version: 2.0.68
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
34
9
 
35
10
  # Quantplay Alpha playground
36
11
 
@@ -272,7 +272,6 @@ class Dhan(Broker):
272
272
 
273
273
  def orders(self, tag: str | None = None, add_ltp: bool = True) -> pl.DataFrame:
274
274
  orders = self.invoke_dhan_api(self.dhan.get_order_list)
275
-
276
275
  if not orders or "data" not in orders or not isinstance(orders["data"], list):
277
276
  return pl.DataFrame(schema=self.orders_schema)
278
277
 
@@ -295,7 +294,6 @@ class Dhan(Broker):
295
294
  "orderType": "order_type",
296
295
  }
297
296
  )
298
-
299
297
  orders_df = orders_df.with_columns(
300
298
  pl.when(pl.col("product") == "INTRADAY").then(pl.lit("MIS")).alias("product"),
301
299
  pl.when(pl.col("exchange") == "NSE_FNO")
@@ -306,14 +304,19 @@ class Dhan(Broker):
306
304
  .then(pl.lit("NSE"))
307
305
  .when(pl.col("exchange") == "BSE_EQ")
308
306
  .then(pl.lit("BSE"))
307
+ .otherwise(pl.col("exchange"))
309
308
  .alias("exchange"),
310
309
  pl.when(pl.col("order_type") == "STOP_LOSS_MARKET")
311
310
  .then(pl.lit("SL-M"))
312
311
  .when(pl.col("order_type") == "STOP_LOSS")
313
312
  .then(pl.lit("SL"))
313
+ .otherwise(pl.col("order_type"))
314
314
  .alias("order_type"),
315
315
  pl.when(pl.col("status") == "TRADED")
316
316
  .then(pl.lit("COMPLETE"))
317
+ .when(pl.col("status") == "PENDING")
318
+ .then(pl.lit("OPEN"))
319
+ .otherwise(pl.col("status"))
317
320
  .alias("status"),
318
321
  )
319
322
 
@@ -81,7 +81,6 @@ class FivePaisa(Broker):
81
81
 
82
82
  try:
83
83
  self.margins()
84
-
85
84
  except TokenException:
86
85
  raise RetryableException("Generating token again")
87
86
  else:
@@ -2,13 +2,12 @@ import binascii
2
2
  import hashlib
3
3
  from queue import Queue
4
4
 
5
- from kiteconnect.exceptions import TokenException
6
5
  import requests
7
6
 
8
7
  from quantplay.broker.ft_utils.flattrade_utils import FlatTradeUtils
9
8
  from quantplay.broker.ft_utils.ft_noren import FT_NorenApi
10
9
  from quantplay.broker.noren import Noren
11
- from quantplay.exception.exceptions import RetryableException
10
+ from quantplay.exception.exceptions import InvalidArgumentException, RetryableException
12
11
  from quantplay.model.order_event import OrderUpdateEvent
13
12
 
14
13
 
@@ -33,12 +32,6 @@ class FlatTrade(Noren):
33
32
  try:
34
33
  if user_token and user_id:
35
34
  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
- }
42
35
 
43
36
  elif user_id and password and totp and api_key and api_secret:
44
37
  token = self.login(
@@ -50,20 +43,21 @@ class FlatTrade(Noren):
50
43
  )
51
44
 
52
45
  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
- }
59
46
 
60
47
  else:
61
- raise TokenException("Missing Arguments")
48
+ raise InvalidArgumentException("Missing Arguments")
62
49
 
63
- except TokenException:
50
+ response = {
51
+ "susertoken": user_token,
52
+ "actid": user_id,
53
+ "email": None,
54
+ "uname": None,
55
+ }
56
+
57
+ except InvalidArgumentException:
64
58
  raise
65
59
  except binascii.Error:
66
- raise TokenException("Invalid TOTP key provided")
60
+ raise InvalidArgumentException("Invalid TOTP key provided")
67
61
  except Exception as e:
68
62
  raise RetryableException(str(e))
69
63
 
@@ -22,7 +22,6 @@ 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'
26
25
 
27
26
  @staticmethod
28
27
  @retry(
@@ -59,34 +58,8 @@ class FlatTradeUtils:
59
58
 
60
59
  url = driver.current_url
61
60
 
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
-
89
61
  try:
62
+ # TODO: IndexError: list index out of range
90
63
  request_token = url.split("code=")[1].split("&")[0]
91
64
  except Exception as e:
92
65
  Constants.logger.error(f"Flattrade Selenium Error for {url}")
@@ -99,10 +72,10 @@ class FlatTradeUtils:
99
72
 
100
73
  except binascii.Error:
101
74
  raise InvalidArgumentException("Invalid TOTP key provided")
102
- except InvalidArgumentException as e:
103
- raise e
75
+ except InvalidArgumentException:
76
+ raise
104
77
  except WebDriverException:
105
78
  raise WrongLibrarySetup("Selenium setup need to be fixed")
106
79
  except Exception as e:
107
- traceback.print_exc()
80
+ print(traceback.print_exc())
108
81
  raise RetryableException(str(e))
@@ -21,8 +21,11 @@ PROD_BASE_URL = "https://gw-napi.kotaksecurities.com/"
21
21
  SESSION_PROD_BASE_URL = "https://napi.kotaksecurities.com/"
22
22
 
23
23
 
24
- # from quantplay.broker.kotak import Kotak
25
- # client = Kotak(None,"EvOUzPVqkwvlFl_6cZYZSCO5mwQa","pVwafvF3ssA_jFVbKPrwhKt7igwa","+918149949114","Kotak@123","491700")
24
+ # EvOUzPVqkwvlFl_6cZYZSCO5mwQa
25
+ # pVwafvF3ssA_jFVbKPrwhKt7igwa
26
+ # Kotak@123
27
+ # +918149949114
28
+ # 491700
26
29
 
27
30
 
28
31
  class Kotak(Broker):
@@ -81,6 +84,8 @@ class Kotak(Broker):
81
84
  data=json.dumps({"grant_type": "client_credentials"}),
82
85
  )
83
86
 
87
+ print(session_init)
88
+
84
89
  if not session_init.ok:
85
90
  raise Exception("")
86
91
 
@@ -180,15 +185,7 @@ class Kotak(Broker):
180
185
  return {"user_id": self.user_id or ""}
181
186
 
182
187
  def margins(self) -> Dict[str, float]:
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
188
+ return self.request("limits", body={"seg": "ALL", "exch": "ALL", "prod": "ALL"})
192
189
 
193
190
  # **
194
191
  # ** POST/PUT Api's
@@ -139,9 +139,8 @@ class Motilal(Broker):
139
139
  raise Exception("Missing Arguments")
140
140
 
141
141
  self.user_id = self.headers["vendorinfo"]
142
-
143
142
  except binascii.Error:
144
- raise TokenException("Invalid TOTP key provided")
143
+ raise InvalidArgumentException("Invalid TOTP key provided")
145
144
  except InvalidArgumentException:
146
145
  raise
147
146
  except Exception as e:
@@ -5,11 +5,7 @@ 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 (
9
- InvalidArgumentException,
10
- RetryableException,
11
- TokenException,
12
- )
8
+ from quantplay.exception.exceptions import InvalidArgumentException, RetryableException
13
9
  from quantplay.model.order_event import OrderUpdateEvent
14
10
 
15
11
 
@@ -52,12 +48,12 @@ class FinvAsia(Noren):
52
48
  imei=imei,
53
49
  )
54
50
  else:
55
- raise TokenException("Missing Args")
51
+ raise InvalidArgumentException("Missing Args")
56
52
 
57
- except TokenException:
53
+ except InvalidArgumentException:
58
54
  raise
59
55
  except binascii.Error:
60
- raise TokenException("Invalid TOTP key provided")
56
+ raise InvalidArgumentException("Invalid TOTP key provided")
61
57
  except Exception as e:
62
58
  raise RetryableException(str(e))
63
59
 
@@ -133,7 +133,6 @@ 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
137
136
  api_response = api_instance.ltp( # type: ignore
138
137
  symbol_info.get("instrument_key"), self.api_version
139
138
  )
@@ -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("Zerodha WS: API Key or Access Token Missing")
115
+ raise InvalidArgumentException("")
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,36 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quantplay
3
- Version: 2.0.67
3
+ Version: 2.0.68
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
34
9
 
35
10
  # Quantplay Alpha playground
36
11
 
@@ -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.67",
24
+ version="2.0.68",
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