quantplay 2.0.56__tar.gz → 2.0.57__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.56 → quantplay-2.0.57}/PKG-INFO +1 -1
  2. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/broker_factory.py +57 -53
  3. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/upstox.py +17 -14
  4. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay.egg-info/PKG-INFO +1 -1
  5. {quantplay-2.0.56 → quantplay-2.0.57}/setup.py +1 -1
  6. {quantplay-2.0.56 → quantplay-2.0.57}/README.md +0 -0
  7. {quantplay-2.0.56 → quantplay-2.0.57}/pyproject.toml +0 -0
  8. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/__init__.py +0 -0
  9. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/__init__.py +0 -0
  10. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/aliceblue.py +0 -0
  11. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/angelone.py +0 -0
  12. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/auto_login/__init__.py +0 -0
  13. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/auto_login/aliceblue.py +0 -0
  14. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/dhan.py +0 -0
  15. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/finvasia_utils/__init__.py +0 -0
  16. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/finvasia_utils/fa_noren.py +0 -0
  17. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/five_paisa.py +0 -0
  18. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/flattrade.py +0 -0
  19. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/ft_utils/__init__.py +0 -0
  20. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/ft_utils/flattrade_utils.py +0 -0
  21. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/ft_utils/ft_noren.py +0 -0
  22. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/generics/__init__.py +0 -0
  23. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/generics/broker.py +0 -0
  24. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/iifl_xts.py +0 -0
  25. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/kite_utils.py +0 -0
  26. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/kotak.py +0 -0
  27. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/motilal.py +0 -0
  28. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/noren.py +0 -0
  29. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/shoonya.py +0 -0
  30. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/uplink/__init__.py +0 -0
  31. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/uplink/uplink_utils.py +0 -0
  32. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/xts.py +0 -0
  33. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/xts_utils/Connect.py +0 -0
  34. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/xts_utils/Exception.py +0 -0
  35. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/xts_utils/InteractiveSocketClient.py +0 -0
  36. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/xts_utils/__init__.py +0 -0
  37. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/broker/zerodha.py +0 -0
  38. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/exception/__init__.py +0 -0
  39. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/exception/exceptions.py +0 -0
  40. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/model/__init__.py +0 -0
  41. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/model/broker.py +0 -0
  42. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/model/generics.py +0 -0
  43. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/model/instrument_data.py +0 -0
  44. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/model/order_event.py +0 -0
  45. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/py.typed +0 -0
  46. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/utils/__init__.py +0 -0
  47. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/utils/caching.py +0 -0
  48. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/utils/constant.py +0 -0
  49. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/utils/exchange.py +0 -0
  50. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/utils/number_utils.py +0 -0
  51. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/utils/pickle_utils.py +0 -0
  52. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/utils/selenium_utils.py +0 -0
  53. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/wrapper/__init__.py +0 -0
  54. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/wrapper/aws/__init__.py +0 -0
  55. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay/wrapper/aws/s3.py +0 -0
  56. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay.egg-info/SOURCES.txt +0 -0
  57. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay.egg-info/dependency_links.txt +0 -0
  58. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay.egg-info/requires.txt +0 -0
  59. {quantplay-2.0.56 → quantplay-2.0.57}/quantplay.egg-info/top_level.txt +0 -0
  60. {quantplay-2.0.56 → quantplay-2.0.57}/setup.cfg +0 -0
  61. {quantplay-2.0.56 → quantplay-2.0.57}/tests/__init__.py +0 -0
  62. {quantplay-2.0.56 → quantplay-2.0.57}/tests/conftest.py +0 -0
  63. {quantplay-2.0.56 → quantplay-2.0.57}/tests/wrapper/__init__.py +0 -0
  64. {quantplay-2.0.56 → quantplay-2.0.57}/tests/wrapper/aws/__init__.py +0 -0
  65. {quantplay-2.0.56 → quantplay-2.0.57}/tests/wrapper/aws/s3_test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quantplay
3
- Version: 2.0.56
3
+ Version: 2.0.57
4
4
  Summary: This python package will be stored in AWS CodeArtifact
5
5
  Home-page:
6
6
  Author:
@@ -90,31 +90,32 @@ broker_required_args = {
90
90
  }
91
91
 
92
92
  broker_generate_args = {
93
- Broker.ZERODHA: set(["user_id", "api_key", "api_secret", "password", "totp"]),
93
+ Broker.ZERODHA: set(["user_id", "api_key", "api_secret"]),
94
94
  Broker.FLATTRADE: set(["user_id" "api_secret", "password", "totp_key", "api_key"]),
95
- Broker.IIFL_XTS: set(["user_id", "wrapper", "md_wrapper"]),
95
+ Broker.IIFL_XTS: set(["api_key", "api_secret", "md_api_key", "md_api_secret"]),
96
96
  Broker.MOTILAL: set(["user_id", "password", "api_key", "two_fa", "totp"]),
97
97
  Broker.ALICEBLUE: set(["user_id", "api_key"]),
98
98
  Broker.DHAN: set(["user_id", "access_token"]),
99
- Broker.FIVEPAISA_OPENAPI: set(["user_id", "client"]),
99
+ Broker.FIVEPAISA_OPENAPI: set(
100
+ [
101
+ "app_source",
102
+ "app_user_id",
103
+ "app_password",
104
+ "user_key",
105
+ "encryption_key",
106
+ "client_id",
107
+ "totp_key",
108
+ "pin",
109
+ ]
110
+ ),
100
111
  Broker.ANGELONE: set(["user_id", "api_key", "mpin", "totp"]),
101
112
  Broker.FINVASIA: set(
102
113
  ["api_secret", "imei", "password", "totp_key", "user_id", "vendor_code"]
103
114
  ),
115
+ Broker.UPSTOX: set(["user_id", "access_token"]),
104
116
  Broker.KOTAK: set(
105
117
  ["consumer_key", "consumer_secret", "mobilenumber", "password", "mpin"]
106
118
  ),
107
- Broker.UPSTOX: set(
108
- [
109
- "user_id",
110
- "api_key",
111
- "api_secret",
112
- "totp",
113
- "mobile_number",
114
- "account_pin",
115
- "redirect_url",
116
- ]
117
- ),
118
119
  }
119
120
 
120
121
 
@@ -126,10 +127,10 @@ class BrokerFactory:
126
127
  return f"{username}:{broker_name}"
127
128
 
128
129
  def validate_broker_args(
129
- self, broker_info: Dict[str, Any], is_generator_args: bool = False
130
+ self, user_broker_account: Dict[str, Any], is_generator_args: bool = False
130
131
  ):
131
- broker = broker_info["broker"]
132
- broker_data = broker_info["broker_data"]
132
+ broker = user_broker_account["broker"]
133
+ broker_data = user_broker_account["broker_data"]
133
134
 
134
135
  compare_map = broker_generate_args if is_generator_args else broker_required_args
135
136
 
@@ -138,17 +139,17 @@ class BrokerFactory:
138
139
 
139
140
  if not compare_map[broker].issubset(broker_data.keys()):
140
141
  raise InvalidArgumentException(
141
- f"Missing Arguments for {broker_info['username']}:{broker_info['nickname']} in broker '{broker}' -> {compare_map[broker].difference(broker_info.keys())}"
142
+ f"Missing Arguments for {user_broker_account['username']}:{user_broker_account['nickname']} in broker '{broker}' -> {compare_map[broker].difference(user_broker_account.keys())}"
142
143
  )
143
144
 
144
- def generate_token(self, broker_info: Dict[str, Any]):
145
+ def generate_token(self, user_broker_account: Dict[str, Any]):
145
146
  broker_client: BrokerType | None = None
146
147
 
147
- broker_data = broker_info["broker_data"]
148
- broker = broker_info["broker"]
148
+ broker_data = user_broker_account["broker_data"]
149
+ broker = user_broker_account["broker"]
149
150
 
150
151
  broker_client: BrokerType | None = None
151
- self.validate_broker_args(broker_info, is_generator_args=True)
152
+ self.validate_broker_args(user_broker_account, is_generator_args=True)
152
153
 
153
154
  if broker == Broker.MOTILAL:
154
155
  broker_client = Motilal(
@@ -181,18 +182,25 @@ class BrokerFactory:
181
182
  broker_data["configuration"] = broker_client.configuration
182
183
 
183
184
  elif broker == Broker.ZERODHA:
184
- broker_client = Zerodha(
185
- user_id=broker_data["user_id"],
186
- api_key=broker_data["api_key"],
187
- api_secret=broker_data["api_secret"],
188
- password=broker_data["password"],
189
- totp=broker_data["totp"],
190
- load_instrument=False,
191
- )
185
+ if "password" in broker_data:
186
+ broker_client = Zerodha(
187
+ user_id=broker_data["user_id"],
188
+ api_key=broker_data["api_key"],
189
+ api_secret=broker_data["api_secret"],
190
+ password=broker_data["password"],
191
+ totp=broker_data["totp"],
192
+ load_instrument=False,
193
+ )
194
+
195
+ broker_data["zerodha_wrapper"] = codecs.encode(
196
+ pickle.dumps(broker_client.wrapper), "base64"
197
+ ).decode()
192
198
 
193
- broker_data["zerodha_wrapper"] = codecs.encode(
194
- pickle.dumps(broker_client.wrapper), "base64"
195
- ).decode()
199
+ else:
200
+ broker_client = Zerodha(
201
+ wrapper=broker_data["zerodha_wrapper"],
202
+ load_instrument=False,
203
+ )
196
204
 
197
205
  elif broker == Broker.ANGELONE:
198
206
  broker_client = AngelOne(
@@ -221,13 +229,7 @@ class BrokerFactory:
221
229
  elif broker == Broker.UPSTOX:
222
230
  broker_client = Upstox(
223
231
  user_id=broker_data["user_id"],
224
- api_key=broker_data["api_key"],
225
- api_secret=broker_data["api_secret"],
226
- totp=broker_data["totp"],
227
- mobile_number=broker_data["mobile_number"],
228
- account_pin=broker_data["account_pin"],
229
- redirect_url=broker_data["redirect_url"],
230
- load_instrument=False,
232
+ access_token=broker_data["access_token"],
231
233
  )
232
234
 
233
235
  broker_data["access_token"] = broker_client.configuration.access_token
@@ -303,17 +305,17 @@ class BrokerFactory:
303
305
  }
304
306
 
305
307
  def store_broker_client(
306
- self, broker_info: Dict[str, Any], load_instrument: bool = True
308
+ self, user_broker_account: Dict[str, Any], load_instrument: bool = True
307
309
  ) -> BrokerType | None:
308
- username = broker_info["username"]
309
- nickname = broker_info["nickname"]
310
+ username = user_broker_account["username"]
311
+ nickname = user_broker_account["nickname"]
310
312
 
311
- self.validate_broker_args(broker_info)
313
+ self.validate_broker_args(user_broker_account)
312
314
 
313
315
  broker_key = self.get_broker_key(username, nickname)
314
316
 
315
- broker_data = broker_info["broker_data"]
316
- broker = broker_info["broker"]
317
+ broker_data = user_broker_account["broker_data"]
318
+ broker = user_broker_account["broker"]
317
319
 
318
320
  broker_client: BrokerType | None = None
319
321
 
@@ -400,25 +402,27 @@ class BrokerFactory:
400
402
  broker_name=broker, broker=broker_client
401
403
  )
402
404
 
403
- broker_client.username = broker_info["username"]
404
- broker_client.nickname = broker_info["nickname"]
405
- broker_client.broker_name = broker_info["broker"]
405
+ broker_client.username = user_broker_account["username"]
406
+ broker_client.nickname = user_broker_account["nickname"]
407
+ broker_client.broker_name = user_broker_account["broker"]
406
408
  broker_client.user_id = broker_data["user_id"]
407
409
 
408
410
  self.client_broker_data[broker_key] = broker_client
409
411
 
410
412
  return broker_client
411
413
 
412
- def get_broker_client(self, broker_info: Dict[str, Any]) -> BrokerType:
413
- username = broker_info["username"]
414
- nickname = broker_info["nickname"]
414
+ def get_broker_client(self, user_broker_account: Dict[str, Any]) -> BrokerType:
415
+ username = user_broker_account["username"]
416
+ nickname = user_broker_account["nickname"]
415
417
 
416
418
  broker_key = self.get_broker_key(username, nickname)
417
419
 
418
420
  if broker_key in self.client_broker_data:
419
421
  return self.client_broker_data[broker_key]
420
422
 
421
- broker_client = self.store_broker_client(broker_info, load_instrument=False)
423
+ broker_client = self.store_broker_client(
424
+ user_broker_account, load_instrument=False
425
+ )
422
426
 
423
427
  if broker_client is not None:
424
428
  return broker_client
@@ -55,21 +55,24 @@ class Upstox(Broker):
55
55
  if access_token:
56
56
  self.set_access_token(access_token)
57
57
  self.user_id = user_id
58
- elif (
59
- api_key
60
- and api_secret
61
- and totp
62
- and mobile_number
63
- and account_pin
64
- and redirect_url
65
- ):
66
- new_access_token = self.generate_token(
67
- api_key, api_secret, totp, mobile_number, account_pin, redirect_url
68
- )
69
- self.set_access_token(new_access_token)
70
58
 
71
- self.configuration = upstox_client.Configuration()
72
- self.configuration.access_token = self.access_token
59
+ # TODO: Implement Auto Login
60
+ # elif (
61
+ # api_key
62
+ # and api_secret
63
+ # and totp
64
+ # and mobile_number
65
+ # and account_pin
66
+ # and redirect_url
67
+ # ):
68
+ # new_access_token = self.generate_token(
69
+ # api_key, api_secret, totp, mobile_number, account_pin, redirect_url
70
+ # )
71
+ # self.set_access_token(new_access_token)
72
+
73
+ # self.configuration = upstox_client.Configuration()
74
+ # self.configuration.access_token = self.access_token
75
+
73
76
  else:
74
77
  raise InvalidArgumentException("Missing Args")
75
78
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quantplay
3
- Version: 2.0.56
3
+ Version: 2.0.57
4
4
  Summary: This python package will be stored in AWS CodeArtifact
5
5
  Home-page:
6
6
  Author:
@@ -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.56",
24
+ version="2.0.57",
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