quantplay 2.0.148__tar.gz → 2.0.149__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 (70) hide show
  1. {quantplay-2.0.148 → quantplay-2.0.149}/PKG-INFO +2 -2
  2. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/broker_factory.py +28 -28
  3. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/icici_direct.py +23 -29
  4. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay.egg-info/PKG-INFO +2 -2
  5. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay.egg-info/requires.txt +1 -1
  6. {quantplay-2.0.148 → quantplay-2.0.149}/setup.py +1 -1
  7. {quantplay-2.0.148 → quantplay-2.0.149}/README.md +0 -0
  8. {quantplay-2.0.148 → quantplay-2.0.149}/pyproject.toml +0 -0
  9. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/__init__.py +0 -0
  10. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/__init__.py +0 -0
  11. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/aliceblue.py +0 -0
  12. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/angelone.py +0 -0
  13. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/auto_login/__init__.py +0 -0
  14. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/auto_login/aliceblue.py +0 -0
  15. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/breeze/__init__.py +0 -0
  16. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/breeze/breeze_utils.py +0 -0
  17. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/dhan.py +0 -0
  18. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/finvasia_utils/__init__.py +0 -0
  19. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/finvasia_utils/fa_noren.py +0 -0
  20. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/five_paisa.py +0 -0
  21. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/flattrade.py +0 -0
  22. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/ft_utils/__init__.py +0 -0
  23. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/ft_utils/flattrade_utils.py +0 -0
  24. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/ft_utils/ft_noren.py +0 -0
  25. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/generics/__init__.py +0 -0
  26. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/generics/broker.py +0 -0
  27. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/iifl_xts.py +0 -0
  28. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/jainam_xts.py +0 -0
  29. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/kite_utils.py +0 -0
  30. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/kotak.py +0 -0
  31. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/motilal.py +0 -0
  32. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/noren.py +0 -0
  33. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/shoonya.py +0 -0
  34. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/uplink/__init__.py +0 -0
  35. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/uplink/uplink_utils.py +0 -0
  36. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/upstox.py +0 -0
  37. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/xts.py +0 -0
  38. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/xts_utils/Connect.py +0 -0
  39. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/xts_utils/Exception.py +0 -0
  40. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/xts_utils/InteractiveSocketClient.py +0 -0
  41. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/xts_utils/__init__.py +0 -0
  42. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/zerodha.py +0 -0
  43. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/exception/__init__.py +0 -0
  44. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/exception/exceptions.py +0 -0
  45. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/model/__init__.py +0 -0
  46. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/model/broker.py +0 -0
  47. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/model/broker_response.py +0 -0
  48. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/model/generics.py +0 -0
  49. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/model/instrument_data.py +0 -0
  50. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/model/order_event.py +0 -0
  51. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/py.typed +0 -0
  52. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/utils/__init__.py +0 -0
  53. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/utils/caching.py +0 -0
  54. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/utils/constant.py +0 -0
  55. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/utils/exchange.py +0 -0
  56. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/utils/number_utils.py +0 -0
  57. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/utils/pickle_utils.py +0 -0
  58. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/utils/selenium_utils.py +0 -0
  59. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/wrapper/__init__.py +0 -0
  60. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/wrapper/aws/__init__.py +0 -0
  61. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/wrapper/aws/s3.py +0 -0
  62. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay.egg-info/SOURCES.txt +0 -0
  63. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay.egg-info/dependency_links.txt +0 -0
  64. {quantplay-2.0.148 → quantplay-2.0.149}/quantplay.egg-info/top_level.txt +0 -0
  65. {quantplay-2.0.148 → quantplay-2.0.149}/setup.cfg +0 -0
  66. {quantplay-2.0.148 → quantplay-2.0.149}/tests/__init__.py +0 -0
  67. {quantplay-2.0.148 → quantplay-2.0.149}/tests/conftest.py +0 -0
  68. {quantplay-2.0.148 → quantplay-2.0.149}/tests/wrapper/__init__.py +0 -0
  69. {quantplay-2.0.148 → quantplay-2.0.149}/tests/wrapper/aws/__init__.py +0 -0
  70. {quantplay-2.0.148 → quantplay-2.0.149}/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.148
3
+ Version: 2.0.149
4
4
  Summary: This python package will be stored in AWS CodeArtifact
5
5
  Home-page:
6
6
  Author:
@@ -21,7 +21,7 @@ Requires-Dist: requests
21
21
  Requires-Dist: pandas
22
22
  Requires-Dist: pyarrow
23
23
  Requires-Dist: polars
24
- Requires-Dist: breeze-connect
24
+ Requires-Dist: breeze_connect
25
25
  Requires-Dist: kiteconnect
26
26
  Requires-Dist: pya3
27
27
  Requires-Dist: py5paisa
@@ -10,7 +10,7 @@ from quantplay.broker.angelone import AngelOne
10
10
  from quantplay.broker.dhan import Dhan
11
11
  from quantplay.broker.five_paisa import FivePaisa
12
12
  from quantplay.broker.flattrade import FlatTrade
13
- from quantplay.broker.icici_direct import ICICI
13
+ # from quantplay.broker.icici_direct import ICICI
14
14
  from quantplay.broker.iifl_xts import IIFL as IIFL_XTS
15
15
  from quantplay.broker.jainam_xts import Jainam
16
16
  from quantplay.broker.kotak import Kotak
@@ -35,7 +35,7 @@ BrokerType = (
35
35
  | Kotak
36
36
  | Dhan
37
37
  | Jainam
38
- | ICICI
38
+ # | ICICI
39
39
  )
40
40
 
41
41
  instrument_cache = InstrumentCache()
@@ -261,25 +261,25 @@ class BrokerFactory:
261
261
  broker_client.api.close_websocket()
262
262
  broker_data["user_token"] = broker_client.user_token
263
263
 
264
- elif broker == Broker.ICICI:
265
- if "password" in broker_data:
266
- broker_client = ICICI(
267
- api_key=broker_data["api_key"],
268
- api_secret=broker_data["api_secret"],
269
- user_id=broker_data["user_id"],
270
- password=broker_data["password"],
271
- totp=broker_data["totp"],
272
- session_token=broker_data["session_token"],
273
- load_instrument=False,
274
- )
275
- else:
276
- broker_client = ICICI(
277
- api_key=broker_data["api_key"],
278
- api_secret=broker_data["api_secret"],
279
- session_token=broker_data["session_token"],
280
- load_instrument=False,
281
- )
282
- broker_data["session_token"] = broker_client.session_token
264
+ # elif broker == Broker.ICICI:
265
+ # if "password" in broker_data:
266
+ # broker_client = ICICI(
267
+ # api_key=broker_data["api_key"],
268
+ # api_secret=broker_data["api_secret"],
269
+ # user_id=broker_data["user_id"],
270
+ # password=broker_data["password"],
271
+ # totp=broker_data["totp"],
272
+ # session_token=broker_data["session_token"],
273
+ # load_instrument=False,
274
+ # )
275
+ # else:
276
+ # broker_client = ICICI(
277
+ # api_key=broker_data["api_key"],
278
+ # api_secret=broker_data["api_secret"],
279
+ # session_token=broker_data["session_token"],
280
+ # load_instrument=False,
281
+ # )
282
+ # broker_data["session_token"] = broker_client.session_token
283
283
 
284
284
  elif broker == Broker.FLATTRADE:
285
285
  broker_client = FlatTrade(
@@ -425,13 +425,13 @@ class BrokerFactory:
425
425
  load_instrument=load_instrument,
426
426
  )
427
427
 
428
- elif broker == Broker.ICICI:
429
- broker_client = ICICI(
430
- api_key=broker_data["api_key"],
431
- api_secret=broker_data["api_secret"],
432
- session_token=broker_data["session_token"],
433
- load_instrument=load_instrument,
434
- )
428
+ # elif broker == Broker.ICICI:
429
+ # broker_client = ICICI(
430
+ # api_key=broker_data["api_key"],
431
+ # api_secret=broker_data["api_secret"],
432
+ # session_token=broker_data["session_token"],
433
+ # load_instrument=load_instrument,
434
+ # )
435
435
 
436
436
  elif broker == Broker.FLATTRADE:
437
437
  broker_client = FlatTrade(
@@ -80,7 +80,7 @@ class ICICI(Broker):
80
80
  user_id: str,
81
81
  password: str,
82
82
  totp: str,
83
- ):
83
+ ) -> None:
84
84
  session_token = BreezeUtils.get_session_code(api_key, user_id, password, totp)
85
85
  self.session_token = session_token
86
86
 
@@ -137,12 +137,12 @@ class ICICI(Broker):
137
137
 
138
138
  print(data)
139
139
 
140
- if data["Success"] is None or len(data["Success"]) == 0:
140
+ if data is None or len(data) == 0:
141
141
  raise NoDataException(f"Historical Data For {data}")
142
142
 
143
- return pl.from_dicts(data["Success"])
143
+ return pl.from_dicts(data)
144
144
 
145
- def get_symbol(self, symbol: str, exchange: ExchangeType | None = None):
145
+ def get_symbol(self, symbol: str, exchange: ExchangeType | None = None) -> str:
146
146
  if symbol not in self.quantplay_symbol_map:
147
147
  return symbol
148
148
 
@@ -233,13 +233,19 @@ class ICICI(Broker):
233
233
  return orders_df
234
234
 
235
235
  def positions(self, drop_cnc: bool = True) -> pl.DataFrame:
236
- positions: Dict[str, Any] = self.wrapper.get_portfolio_positions() # type:ignore
236
+ to_date = datetime.now().isoformat()[:19] + ".000Z"
237
+ from_date = (datetime.now() - timedelta(hours=10)).isoformat()[:19] + ".000Z"
238
+ positions: Dict[str, Any] = self.wrapper.get_portfolio_holdings( # type:ignore
239
+ exchange_code="NFO",
240
+ from_date=from_date,
241
+ to_date=to_date,
242
+ stock_code="",
243
+ portfolio_type="",
244
+ )
237
245
  if "Success" in positions and positions["Success"] is None:
238
246
  return pl.DataFrame(schema=self.positions_schema)
239
247
  positions_df = pl.DataFrame(positions["Success"])
240
- if "realized_profit" not in positions_df:
241
- positions_df = positions_df.with_columns(pl.lit(0.0).alias("realized_profit"))
242
- positions_df = positions_df.filter(pl.col("exchange_code").is_in(["NFO", "BFO"]))
248
+
243
249
  positions_df = positions_df.rename(
244
250
  {
245
251
  "exchange_code": "exchange",
@@ -248,9 +254,6 @@ class ICICI(Broker):
248
254
  "product_type": "product",
249
255
  }
250
256
  )
251
- positions_df = positions_df.with_columns(
252
- pl.col("quantity").cast(pl.Int32).alias("quantity")
253
- )
254
257
  positions_df = positions_df.with_columns(
255
258
  pl.col("strike").cast(pl.Float32).alias("strike"),
256
259
  pl.col("expiry").str.strptime(pl.Date, format="%d-%b-%Y").alias("expiry"),
@@ -259,11 +262,11 @@ class ICICI(Broker):
259
262
  .when(pl.col("right") == "Put")
260
263
  .then(pl.lit("PE"))
261
264
  .alias("instrument_type"),
262
- pl.when(pl.col("action") == "Sell")
263
- .then(abs(pl.col("quantity").cast(pl.Float32)) * -1)
264
- .otherwise(abs(pl.col("quantity").cast(pl.Float32)))
265
- .alias("quantity"),
266
- pl.lit(0).alias("pnl"),
265
+ (
266
+ pl.col("unrealized_profit").cast(pl.Float32)
267
+ + pl.col("realized_profit").cast(pl.Float32)
268
+ ).alias("pnl"),
269
+ pl.col("quantity").cast(pl.Int32).alias("quantity"),
267
270
  pl.col("average_price").cast(pl.Float32).alias("average_price"),
268
271
  )
269
272
 
@@ -340,14 +343,9 @@ class ICICI(Broker):
340
343
  if tag is None:
341
344
  tag = ""
342
345
  icici_tradingsymbol = self.get_symbol(tradingsymbol)
343
- try:
344
- symbol_data: Dict[str, Any] = self.symbol_data[ # type:ignore
345
- f"{exchange}:{icici_tradingsymbol}"
346
- ]
347
- except KeyError:
348
- raise QuantplayOrderPlacementException(
349
- f"Failed to find tradingsymbol {tradingsymbol}"
350
- )
346
+ symbol_data: Dict[str, Any] = self.symbol_data[ # type:ignore
347
+ f"{exchange}:{icici_tradingsymbol}"
348
+ ]
351
349
  icici_product = "cash"
352
350
  if exchange in ["NFO", "BFO"]:
353
351
  icici_product = "futures"
@@ -369,7 +367,7 @@ class ICICI(Broker):
369
367
  else:
370
368
  response: Dict[str, Any] = self.wrapper.place_order( # type:ignore
371
369
  stock_code=symbol_data["symbol_code"],
372
- exchange_code=exchange,
370
+ exchange_code="NFO",
373
371
  product=icici_product,
374
372
  action=transaction_type.lower(),
375
373
  order_type=order_type.lower(),
@@ -384,8 +382,6 @@ class ICICI(Broker):
384
382
  )
385
383
  if "Success" in response and "order_id" in response["Success"]:
386
384
  return response["Success"]["order_id"]
387
- elif "Error" in response:
388
- raise QuantplayOrderPlacementException(response["Error"])
389
385
  else:
390
386
  raise QuantplayOrderPlacementException(
391
387
  f"ICICI: order placement failed {response}"
@@ -452,8 +448,6 @@ class ICICI(Broker):
452
448
  try:
453
449
  data = fn(*args, **kwargs)
454
450
 
455
- print(data)
456
-
457
451
  if data["Status"] > 200:
458
452
  if data["Error"] == "Limit exceed: API call per day: ":
459
453
  raise RateLimitExcededException(data["Error"])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quantplay
3
- Version: 2.0.148
3
+ Version: 2.0.149
4
4
  Summary: This python package will be stored in AWS CodeArtifact
5
5
  Home-page:
6
6
  Author:
@@ -21,7 +21,7 @@ Requires-Dist: requests
21
21
  Requires-Dist: pandas
22
22
  Requires-Dist: pyarrow
23
23
  Requires-Dist: polars
24
- Requires-Dist: breeze-connect
24
+ Requires-Dist: breeze_connect
25
25
  Requires-Dist: kiteconnect
26
26
  Requires-Dist: pya3
27
27
  Requires-Dist: py5paisa
@@ -13,7 +13,7 @@ requests
13
13
  pandas
14
14
  pyarrow
15
15
  polars
16
- breeze-connect
16
+ breeze_connect
17
17
  kiteconnect
18
18
  pya3
19
19
  py5paisa
@@ -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.148",
24
+ version="2.0.149",
25
25
  setup_requires=["pytest-runner"],
26
26
  install_requires=requirements,
27
27
  tests_require=[],
File without changes
File without changes
File without changes