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.
- {quantplay-2.0.148 → quantplay-2.0.149}/PKG-INFO +2 -2
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/broker_factory.py +28 -28
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/icici_direct.py +23 -29
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay.egg-info/PKG-INFO +2 -2
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay.egg-info/requires.txt +1 -1
- {quantplay-2.0.148 → quantplay-2.0.149}/setup.py +1 -1
- {quantplay-2.0.148 → quantplay-2.0.149}/README.md +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/pyproject.toml +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/__init__.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/__init__.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/aliceblue.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/angelone.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/auto_login/__init__.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/auto_login/aliceblue.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/breeze/__init__.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/breeze/breeze_utils.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/dhan.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/finvasia_utils/__init__.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/finvasia_utils/fa_noren.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/five_paisa.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/flattrade.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/ft_utils/__init__.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/ft_utils/flattrade_utils.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/ft_utils/ft_noren.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/generics/__init__.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/generics/broker.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/iifl_xts.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/jainam_xts.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/kite_utils.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/kotak.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/motilal.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/noren.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/shoonya.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/uplink/__init__.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/uplink/uplink_utils.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/upstox.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/xts.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/xts_utils/Connect.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/xts_utils/Exception.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/xts_utils/InteractiveSocketClient.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/xts_utils/__init__.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/zerodha.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/exception/__init__.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/exception/exceptions.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/model/__init__.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/model/broker.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/model/broker_response.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/model/generics.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/model/instrument_data.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/model/order_event.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/py.typed +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/utils/__init__.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/utils/caching.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/utils/constant.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/utils/exchange.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/utils/number_utils.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/utils/pickle_utils.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/utils/selenium_utils.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/wrapper/__init__.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/wrapper/aws/__init__.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay/wrapper/aws/s3.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay.egg-info/SOURCES.txt +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay.egg-info/dependency_links.txt +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/quantplay.egg-info/top_level.txt +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/setup.cfg +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/tests/__init__.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/tests/conftest.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/tests/wrapper/__init__.py +0 -0
- {quantplay-2.0.148 → quantplay-2.0.149}/tests/wrapper/aws/__init__.py +0 -0
- {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.
|
|
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:
|
|
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
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
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
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
.alias("
|
|
266
|
-
pl.
|
|
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
|
-
|
|
344
|
-
|
|
345
|
-
|
|
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=
|
|
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.
|
|
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:
|
|
24
|
+
Requires-Dist: breeze_connect
|
|
25
25
|
Requires-Dist: kiteconnect
|
|
26
26
|
Requires-Dist: pya3
|
|
27
27
|
Requires-Dist: py5paisa
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{quantplay-2.0.148 → quantplay-2.0.149}/quantplay/broker/xts_utils/InteractiveSocketClient.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|