quantplay 2.0.166__tar.gz → 2.0.168__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.166 → quantplay-2.0.168}/PKG-INFO +1 -1
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/kotak.py +83 -7
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay.egg-info/PKG-INFO +1 -1
- {quantplay-2.0.166 → quantplay-2.0.168}/setup.py +1 -1
- {quantplay-2.0.166 → quantplay-2.0.168}/README.md +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/pyproject.toml +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/__init__.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/__init__.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/aliceblue.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/angelone.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/auto_login/__init__.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/auto_login/aliceblue.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/breeze/__init__.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/breeze/breeze_utils.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/broker_factory.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/dhan.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/finvasia_utils/__init__.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/finvasia_utils/fa_noren.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/five_paisa.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/flattrade.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/ft_utils/__init__.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/ft_utils/flattrade_utils.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/ft_utils/ft_noren.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/generics/__init__.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/generics/broker.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/icici_direct.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/iifl_xts.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/jainam_xts.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/kite_utils.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/motilal.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/noren.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/shoonya.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/uplink/__init__.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/uplink/uplink_utils.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/upstox.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/xts.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/xts_utils/Connect.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/xts_utils/Exception.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/xts_utils/InteractiveSocketClient.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/xts_utils/__init__.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/broker/zerodha.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/exception/__init__.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/exception/exceptions.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/model/__init__.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/model/broker.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/model/broker_response.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/model/generics.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/model/instrument_data.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/model/order_event.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/py.typed +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/utils/__init__.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/utils/caching.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/utils/constant.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/utils/exchange.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/utils/number_utils.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/utils/pickle_utils.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/utils/selenium_utils.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/wrapper/__init__.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/wrapper/aws/__init__.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay/wrapper/aws/s3.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay.egg-info/SOURCES.txt +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay.egg-info/dependency_links.txt +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay.egg-info/requires.txt +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/quantplay.egg-info/top_level.txt +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/setup.cfg +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/tests/__init__.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/tests/conftest.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/tests/wrapper/__init__.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/tests/wrapper/aws/__init__.py +0 -0
- {quantplay-2.0.166 → quantplay-2.0.168}/tests/wrapper/aws/s3_test.py +0 -0
|
@@ -61,6 +61,7 @@ class Kotak(Broker):
|
|
|
61
61
|
"bearer_token": configuration["bearer_token"],
|
|
62
62
|
"view_token": configuration["view_token"],
|
|
63
63
|
"sid": configuration["sid"],
|
|
64
|
+
"kotakUserId": configuration["kotakUserId"],
|
|
64
65
|
"edit_token": configuration.get("edit_token"),
|
|
65
66
|
"edit_sid": configuration.get("edit_sid"),
|
|
66
67
|
"edit_rid": configuration.get("edit_rid"),
|
|
@@ -139,7 +140,7 @@ class Kotak(Broker):
|
|
|
139
140
|
self.configuration["view_token"], options={"verify_signature": False}
|
|
140
141
|
)
|
|
141
142
|
userid = decode_jwt.get("sub")
|
|
142
|
-
self.kotakUserId = userid
|
|
143
|
+
self.configuration["kotakUserId"] = userid
|
|
143
144
|
|
|
144
145
|
generate_otp_resp = requests.post(
|
|
145
146
|
url=f"{PROD_BASE_URL}login/1.0/login/otp/generate",
|
|
@@ -154,6 +155,7 @@ class Kotak(Broker):
|
|
|
154
155
|
self.configuration["bearer_token"] is None
|
|
155
156
|
or self.configuration["sid"] is None
|
|
156
157
|
or self.configuration["view_token"] is None
|
|
158
|
+
or self.configuration["kotakUserId"] is None
|
|
157
159
|
):
|
|
158
160
|
raise InvalidArgumentException("Missing Params")
|
|
159
161
|
|
|
@@ -165,7 +167,7 @@ class Kotak(Broker):
|
|
|
165
167
|
"Auth": self.configuration["view_token"],
|
|
166
168
|
"Content-Type": "application/json",
|
|
167
169
|
},
|
|
168
|
-
data=json.dumps({"userId": self.kotakUserId, "otp": otp}),
|
|
170
|
+
data=json.dumps({"userId": self.configuration["kotakUserId"], "otp": otp}),
|
|
169
171
|
)
|
|
170
172
|
|
|
171
173
|
edit_token_resp = json.loads(login_resp.text)
|
|
@@ -180,7 +182,39 @@ class Kotak(Broker):
|
|
|
180
182
|
def order_history(self, order_id: str) -> pl.DataFrame:
|
|
181
183
|
body = {"nOrdNo": order_id}
|
|
182
184
|
order_history = self.request("order_history", body=body)["data"] # type:ignore
|
|
183
|
-
|
|
185
|
+
order_history_df = pl.DataFrame(order_history)[
|
|
186
|
+
[
|
|
187
|
+
"tok",
|
|
188
|
+
"flDtTm",
|
|
189
|
+
"nOrdNo",
|
|
190
|
+
"exch",
|
|
191
|
+
"prod",
|
|
192
|
+
"trdSym",
|
|
193
|
+
"trnsTp",
|
|
194
|
+
"qty",
|
|
195
|
+
"prcTp",
|
|
196
|
+
]
|
|
197
|
+
]
|
|
198
|
+
order_history_df = order_history_df.rename(
|
|
199
|
+
{
|
|
200
|
+
"tok": "token",
|
|
201
|
+
"flDtTm": "update_timestamp",
|
|
202
|
+
"nOrdNo": "order_id",
|
|
203
|
+
"exch": "exchange",
|
|
204
|
+
"prod": "product",
|
|
205
|
+
"trdSym": "tradingsymbol",
|
|
206
|
+
"trnsTp": "transaction_type",
|
|
207
|
+
"qty": "quantity",
|
|
208
|
+
"prcTp": "order_type",
|
|
209
|
+
}
|
|
210
|
+
)
|
|
211
|
+
order_history_df = order_history_df.with_columns(
|
|
212
|
+
pl.col("update_timestamp")
|
|
213
|
+
.str.strptime(pl.Datetime(time_unit="ms"), format="%d-%b-%Y %H:%M:%S")
|
|
214
|
+
.alias("update_timestamp")
|
|
215
|
+
).sort("update_timestamp")
|
|
216
|
+
|
|
217
|
+
return order_history_df
|
|
184
218
|
|
|
185
219
|
# **
|
|
186
220
|
# ** GET Api's
|
|
@@ -455,11 +489,53 @@ class Kotak(Broker):
|
|
|
455
489
|
self.request("cancel_order", body=body)
|
|
456
490
|
|
|
457
491
|
def modify_order(self, order: ModifyOrderRequest) -> str:
|
|
458
|
-
|
|
492
|
+
order_id = order["order_id"]
|
|
493
|
+
price = order.get("price")
|
|
494
|
+
trigger_price = order.get("trigger_price", 0)
|
|
459
495
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
496
|
+
order_history = self.order_history(order_id).to_dicts()[-1]
|
|
497
|
+
|
|
498
|
+
order_type = self.get_order_type(
|
|
499
|
+
order.get("order_type", order_history["order_type"])
|
|
500
|
+
)
|
|
501
|
+
quantity = str(order.get("quantity", order_history["quantity"]))
|
|
502
|
+
modify_order_request = {
|
|
503
|
+
"tk": str(order_history["token"]),
|
|
504
|
+
"mp": "0",
|
|
505
|
+
"pc": order_history["product"],
|
|
506
|
+
"dd": "NA",
|
|
507
|
+
"dq": "0",
|
|
508
|
+
"vd": "DAY",
|
|
509
|
+
"ts": order_history["tradingsymbol"],
|
|
510
|
+
"tt": order_history["transaction_type"],
|
|
511
|
+
"pr": str(price),
|
|
512
|
+
"tp": str(trigger_price),
|
|
513
|
+
"qt": quantity,
|
|
514
|
+
"no": order_id,
|
|
515
|
+
"es": self.get_exchange(order_history["exchange"]),
|
|
516
|
+
"pt": order_type,
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
try:
|
|
520
|
+
Constants.logger.info(f"Modifying order [{order_id}] new price [{price}]")
|
|
521
|
+
|
|
522
|
+
modify_order_response = self.request( # type:ignore
|
|
523
|
+
"modify_order", body=modify_order_request
|
|
524
|
+
)
|
|
525
|
+
|
|
526
|
+
return modify_order_response["nOrdNo"]
|
|
527
|
+
|
|
528
|
+
except Exception as e:
|
|
529
|
+
exception_message = (
|
|
530
|
+
f"OrderModificationFailed for {order_id} failed with exception {e}"
|
|
531
|
+
)
|
|
532
|
+
if (
|
|
533
|
+
"Order cannot be modified as it is being processed"
|
|
534
|
+
not in exception_message
|
|
535
|
+
):
|
|
536
|
+
Constants.logger.error(f"{exception_message}")
|
|
537
|
+
|
|
538
|
+
return order_id
|
|
463
539
|
|
|
464
540
|
def get_transaction_type(self, transaction_type: TransactionType) -> str:
|
|
465
541
|
transaction_type_map: dict[TransactionType, str] = {
|
|
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
|
|
File without changes
|
{quantplay-2.0.166 → quantplay-2.0.168}/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
|
|
File without changes
|