quantplay 2.0.36__tar.gz → 2.0.37__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 (63) hide show
  1. {quantplay-2.0.36 → quantplay-2.0.37}/PKG-INFO +1 -1
  2. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/five_paisa.py +0 -1
  3. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/xts.py +24 -17
  4. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/xts_utils/Connect.py +99 -64
  5. quantplay-2.0.37/quantplay/model/xts.py +24 -0
  6. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay.egg-info/PKG-INFO +1 -1
  7. {quantplay-2.0.36 → quantplay-2.0.37}/setup.py +1 -1
  8. quantplay-2.0.36/quantplay/model/xts.py +0 -7
  9. {quantplay-2.0.36 → quantplay-2.0.37}/README.md +0 -0
  10. {quantplay-2.0.36 → quantplay-2.0.37}/pyproject.toml +0 -0
  11. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/__init__.py +0 -0
  12. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/__init__.py +0 -0
  13. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/aliceblue.py +0 -0
  14. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/angelone.py +0 -0
  15. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/auto_login/__init__.py +0 -0
  16. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/auto_login/aliceblue.py +0 -0
  17. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/finvasia_utils/__init__.py +0 -0
  18. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/finvasia_utils/fa_noren.py +0 -0
  19. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/flattrade.py +0 -0
  20. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/ft_utils/__init__.py +0 -0
  21. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/ft_utils/flattrade_utils.py +0 -0
  22. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/ft_utils/ft_noren.py +0 -0
  23. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/generics/__init__.py +0 -0
  24. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/generics/broker.py +0 -0
  25. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/iifl_xts.py +0 -0
  26. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/kite_utils.py +0 -0
  27. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/motilal.py +0 -0
  28. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/noren.py +0 -0
  29. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/shoonya.py +0 -0
  30. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/uplink/__init__.py +0 -0
  31. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/uplink/uplink_utils.py +0 -0
  32. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/upstox.py +0 -0
  33. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/xts_utils/Exception.py +0 -0
  34. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/xts_utils/InteractiveSocketClient.py +0 -0
  35. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/xts_utils/__init__.py +0 -0
  36. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/broker/zerodha.py +0 -0
  37. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/exception/__init__.py +0 -0
  38. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/exception/exceptions.py +0 -0
  39. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/model/__init__.py +0 -0
  40. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/model/broker.py +0 -0
  41. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/model/generics.py +0 -0
  42. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/model/instrument_data.py +0 -0
  43. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/model/order_event.py +0 -0
  44. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/py.typed +0 -0
  45. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/utils/__init__.py +0 -0
  46. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/utils/constant.py +0 -0
  47. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/utils/exchange.py +0 -0
  48. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/utils/number_utils.py +0 -0
  49. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/utils/pickle_utils.py +0 -0
  50. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/utils/selenium_utils.py +0 -0
  51. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/wrapper/__init__.py +0 -0
  52. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/wrapper/aws/__init__.py +0 -0
  53. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay/wrapper/aws/s3.py +0 -0
  54. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay.egg-info/SOURCES.txt +0 -0
  55. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay.egg-info/dependency_links.txt +0 -0
  56. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay.egg-info/requires.txt +0 -0
  57. {quantplay-2.0.36 → quantplay-2.0.37}/quantplay.egg-info/top_level.txt +0 -0
  58. {quantplay-2.0.36 → quantplay-2.0.37}/setup.cfg +0 -0
  59. {quantplay-2.0.36 → quantplay-2.0.37}/tests/__init__.py +0 -0
  60. {quantplay-2.0.36 → quantplay-2.0.37}/tests/conftest.py +0 -0
  61. {quantplay-2.0.36 → quantplay-2.0.37}/tests/wrapper/__init__.py +0 -0
  62. {quantplay-2.0.36 → quantplay-2.0.37}/tests/wrapper/aws/__init__.py +0 -0
  63. {quantplay-2.0.36 → quantplay-2.0.37}/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.36
3
+ Version: 2.0.37
4
4
  Summary: This python package will be stored in AWS CodeArtifact
5
5
  Home-page:
6
6
  Author:
@@ -1,4 +1,3 @@
1
- from ast import alias
2
1
  import codecs
3
2
  import pickle
4
3
  import traceback
@@ -4,7 +4,7 @@ import pickle
4
4
  import traceback
5
5
  from datetime import datetime
6
6
  from queue import Queue
7
- from typing import Dict
7
+ from typing import Any, Dict, List
8
8
 
9
9
  import pandas as pd
10
10
  import polars as pl
@@ -27,6 +27,7 @@ from quantplay.model.broker import (
27
27
  )
28
28
  from quantplay.model.generics import OrderTypeType, ProductType, TransactionType
29
29
  from quantplay.model.order_event import OrderUpdateEvent
30
+ from quantplay.model.xts import XTSTypes
30
31
  from quantplay.utils.constant import Constants, OrderType
31
32
  from quantplay.utils.pickle_utils import InstrumentData, PickleUtils
32
33
 
@@ -151,7 +152,7 @@ class XTS(Broker):
151
152
  except Exception:
152
153
  raise InvalidArgumentException("Invalid api key/secret")
153
154
 
154
- def handle_exception(self, response):
155
+ def handle_exception(self, response: Dict[str, Any]):
155
156
  if "data" in response and "description" in response["data"]:
156
157
  data = response["data"]
157
158
  if "max limit" in data["description"].lower():
@@ -164,7 +165,7 @@ class XTS(Broker):
164
165
  ):
165
166
  raise TokenException(response["description"])
166
167
  if "type" in response and response["type"] == "error":
167
- raise Exception(f"[XTS_Error]: {response["description"]}")
168
+ raise Exception(f"[XTS_Error]: {response['description']}")
168
169
 
169
170
  @retry(
170
171
  wait_exponential_multiplier=3000,
@@ -463,15 +464,15 @@ class XTS(Broker):
463
464
 
464
465
  return positions_df
465
466
 
466
- def get_quantplay_symbol(self, symbol):
467
+ def get_quantplay_symbol(self, symbol: str):
467
468
  if symbol in self.broker_symbol_map:
468
469
  return self.broker_symbol_map[symbol]
469
470
  return symbol
470
471
 
471
- def get_ltps(self, symbols):
472
- instruments = [
472
+ def get_ltps(self, symbols: List[str]):
473
+ instruments: List[XTSTypes.InstrumentType] = [
473
474
  {
474
- "exchangeSegment": int(self.get_exchange_code(x.split(":")[0])),
475
+ "exchangeSegment": self.get_exchange_code(x.split(":")[0]),
475
476
  "exchangeInstrumentID": int(x.split(":")[1]),
476
477
  }
477
478
  for x in symbols
@@ -493,8 +494,8 @@ class XTS(Broker):
493
494
  ltp = {x["ExchangeInstrumentID"]: float(x["LastTradedPrice"]) for x in ltp}
494
495
  return ltp
495
496
 
496
- def get_exchange_code(self, exchange):
497
- exchange_code_map = {
497
+ def get_exchange_code(self, exchange) -> XTSTypes.ExchangeSegmentType:
498
+ exchange_code_map: Dict[str, XTSTypes.ExchangeSegmentType] = {
498
499
  "NSE": 1,
499
500
  "NFO": 2,
500
501
  "BFO": 12,
@@ -513,8 +514,8 @@ class XTS(Broker):
513
514
 
514
515
  return exchange_code_map[exchange]
515
516
 
516
- def get_exchange_name(self, exchange):
517
- exchange_code_map = {
517
+ def get_exchange_name(self, exchange) -> XTSTypes.ExchangeType:
518
+ exchange_code_map: Dict[str, XTSTypes.ExchangeType] = {
518
519
  "NSE": "NSECM",
519
520
  "NFO": "NSEFO",
520
521
  "BFO": "BSEFO",
@@ -530,10 +531,11 @@ class XTS(Broker):
530
531
 
531
532
  return exchange_code_map[exchange]
532
533
 
533
- def ltp(self, exchange=None, tradingsymbol=None) -> float:
534
+ def ltp(self, exchange, tradingsymbol: str) -> float:
534
535
  exchange_code = self.get_exchange_code(exchange)
535
536
  exchange_token = self.symbol_data[f"{exchange}:{tradingsymbol}"].get(
536
- "exchange_token"
537
+ "exchange_token",
538
+ "", # TODO
537
539
  )
538
540
 
539
541
  api_response = self.md_wrapper.get_quote(
@@ -580,11 +582,14 @@ class XTS(Broker):
580
582
  xts_order_type = self.get_order_type(order_type)
581
583
 
582
584
  exchange_token = self.symbol_data[f"{exchange}:{tradingsymbol}"].get(
583
- "exchange_token"
585
+ "exchange_token", ""
584
586
  )
585
587
  if trigger_price is None:
586
588
  trigger_price = 0
587
589
 
590
+ if tag is None:
591
+ tag = ""
592
+
588
593
  api_response = self.wrapper.place_order(
589
594
  exchangeSegment=exchange_name,
590
595
  exchangeInstrumentID=exchange_token,
@@ -608,7 +613,7 @@ class XTS(Broker):
608
613
 
609
614
  return api_response["result"]["AppOrderID"]
610
615
 
611
- def cancel_order(self, order_id, variety=None):
616
+ def cancel_order(self, order_id, variety: str | None = None):
612
617
  orders = self.orders()
613
618
 
614
619
  order_data = orders.filter(pl.col("order_id").eq(str(order_id)))
@@ -631,7 +636,7 @@ class XTS(Broker):
631
636
 
632
637
  return api_response["result"]["AppOrderID"]
633
638
 
634
- def get_order_type(self, order_type: OrderTypeType) -> str:
639
+ def get_order_type(self, order_type: OrderTypeType):
635
640
  if order_type == OrderType.market:
636
641
  return "Market"
637
642
  elif order_type == OrderType.sl:
@@ -687,7 +692,9 @@ class XTS(Broker):
687
692
 
688
693
  return api_response["result"]["AppOrderID"]
689
694
 
690
- def modify_price(self, order_id, price: float, trigger_price=None, order_type=None):
695
+ def modify_price(
696
+ self, order_id, price: float, trigger_price: float | None = None, order_type=None
697
+ ):
691
698
  self.modify_order(
692
699
  {
693
700
  "order_id": str(order_id),
@@ -20,7 +20,9 @@ from six.moves.urllib.parse import urljoin # type:ignore
20
20
  from quantplay.broker.xts_utils import Exception as ex
21
21
  from quantplay.broker.xts_utils.Exception import XTSDataException
22
22
  from quantplay.exception.exceptions import BrokerException
23
- from quantplay.model.xts import ExchangeSegmentType
23
+ from quantplay.model.xts import (
24
+ XTSTypes,
25
+ )
24
26
 
25
27
  log = logging.getLogger(__name__)
26
28
 
@@ -240,17 +242,17 @@ class XTSConnect(XTSCommon):
240
242
 
241
243
  def place_order(
242
244
  self,
243
- exchangeSegment,
244
- exchangeInstrumentID,
245
- productType,
246
- orderType,
247
- orderSide,
248
- timeInForce,
249
- disclosedQuantity,
250
- orderQuantity,
251
- limitPrice,
252
- stopPrice,
253
- orderUniqueIdentifier,
245
+ exchangeSegment: XTSTypes.ExchangeType,
246
+ exchangeInstrumentID: int | str,
247
+ productType: XTSTypes.ProductType,
248
+ orderType: XTSTypes.OrderType,
249
+ orderSide: XTSTypes.OrderSide,
250
+ timeInForce: XTSTypes.DayOrNetType,
251
+ disclosedQuantity: int,
252
+ orderQuantity: int,
253
+ limitPrice: float,
254
+ stopPrice: float,
255
+ orderUniqueIdentifier: str,
254
256
  clientID: str | None = None,
255
257
  ):
256
258
  """To place an order"""
@@ -280,18 +282,18 @@ class XTSConnect(XTSCommon):
280
282
 
281
283
  def place_bracketorder(
282
284
  self,
283
- exchangeSegment,
284
- exchangeInstrumentID,
285
- orderType,
286
- orderSide,
287
- disclosedQuantity,
288
- orderQuantity,
289
- limitPrice,
290
- squarOff,
291
- stopLossPrice,
292
- trailingStoploss,
293
- isProOrder,
294
- orderUniqueIdentifier,
285
+ exchangeSegment: XTSTypes.ExchangeType,
286
+ exchangeInstrumentID: int,
287
+ orderType: XTSTypes.OrderType,
288
+ orderSide: XTSTypes.OrderSide,
289
+ disclosedQuantity: int,
290
+ orderQuantity: int,
291
+ limitPrice: float,
292
+ squarOff: int,
293
+ stopLossPrice: float,
294
+ trailingStoploss: float,
295
+ isProOrder: bool,
296
+ orderUniqueIdentifier: str,
295
297
  ):
296
298
  """To place a bracketorder"""
297
299
  try:
@@ -348,13 +350,13 @@ class XTSConnect(XTSCommon):
348
350
  def modify_order(
349
351
  self,
350
352
  appOrderID: int,
351
- modifiedProductType,
352
- modifiedOrderType,
353
+ modifiedProductType: XTSTypes.ProductType,
354
+ modifiedOrderType: XTSTypes.OrderType,
353
355
  modifiedOrderQuantity: int,
354
356
  modifiedDisclosedQuantity: int,
355
357
  modifiedLimitPrice: float,
356
358
  modifiedStopPrice: float,
357
- modifiedTimeInForce,
359
+ modifiedTimeInForce: XTSTypes.DayOrNetType,
358
360
  orderUniqueIdentifier: str,
359
361
  clientID: str | None = None,
360
362
  ):
@@ -440,12 +442,12 @@ class XTSConnect(XTSCommon):
440
442
 
441
443
  def convert_position(
442
444
  self,
443
- exchangeSegment,
444
- exchangeInstrumentID,
445
- targetQty,
446
- isDayWise,
447
- oldProductType,
448
- newProductType,
445
+ exchangeSegment: XTSTypes.ExchangeType,
446
+ exchangeInstrumentID: int,
447
+ targetQty: int,
448
+ isDayWise: bool,
449
+ oldProductType: XTSTypes.ProductType,
450
+ newProductType: XTSTypes.ProductType,
449
451
  clientID: str | None = None,
450
452
  ):
451
453
  """Convert position API, enable users to convert their open positions from NRML intra-day to Short term MIS or
@@ -486,7 +488,9 @@ class XTSConnect(XTSCommon):
486
488
  traceback.print_exc()
487
489
  raise BrokerException("cancel_order Failed for XTS")
488
490
 
489
- def cancelall_order(self, exchangeSegment: ExchangeSegmentType, exchangeInstrumentID):
491
+ def cancelall_order(
492
+ self, exchangeSegment: XTSTypes.ExchangeSegmentType, exchangeInstrumentID: int
493
+ ):
490
494
  """This API can be called to cancel all open order of the user by providing exchange segment and exchange instrument ID"""
491
495
  try:
492
496
  params: Dict[str, Any] = {
@@ -503,15 +507,15 @@ class XTSConnect(XTSCommon):
503
507
 
504
508
  def place_cover_order(
505
509
  self,
506
- exchangeSegment,
507
- exchangeInstrumentID,
508
- orderSide,
509
- orderType,
510
+ exchangeSegment: XTSTypes.ExchangeType,
511
+ exchangeInstrumentID: int,
512
+ orderSide: XTSTypes.OrderSide,
513
+ orderType: XTSTypes.OrderType,
510
514
  orderQuantity: int,
511
515
  disclosedQuantity: int,
512
516
  limitPrice: float,
513
517
  stopPrice: float,
514
- orderUniqueIdentifier,
518
+ orderUniqueIdentifier: str,
515
519
  clientID: str | None = None,
516
520
  ):
517
521
  """A Cover Order is an advance intraday order that is accompanied by a compulsory Stop Loss Order. This helps
@@ -553,9 +557,9 @@ class XTSConnect(XTSCommon):
553
557
 
554
558
  def squareoff_position(
555
559
  self,
556
- exchangeSegment,
557
- exchangeInstrumentID,
558
- productType,
560
+ exchangeSegment: XTSTypes.ExchangeType,
561
+ exchangeInstrumentID: int,
562
+ productType: XTSTypes.ProductType,
559
563
  squareoffMode,
560
564
  positionSquareOffQuantityType,
561
565
  squareOffQtyValue,
@@ -642,7 +646,12 @@ class XTSConnect(XTSCommon):
642
646
  traceback.print_exc()
643
647
  raise BrokerException("get_config Failed for XTS")
644
648
 
645
- def get_quote(self, Instruments, xtsMessageCode, publishFormat):
649
+ def get_quote(
650
+ self,
651
+ Instruments: List[XTSTypes.InstrumentType],
652
+ xtsMessageCode: XTSTypes.XTSMessageCodeType,
653
+ publishFormat: XTSTypes.PublishFormatType,
654
+ ):
646
655
  try:
647
656
  params: Dict[str, Any] = {
648
657
  "instruments": Instruments,
@@ -654,7 +663,11 @@ class XTSConnect(XTSCommon):
654
663
  except Exception as e:
655
664
  raise e
656
665
 
657
- def send_subscription(self, Instruments, xtsMessageCode):
666
+ def send_subscription(
667
+ self,
668
+ Instruments: List[XTSTypes.InstrumentType],
669
+ xtsMessageCode: XTSTypes.XTSMessageCodeType,
670
+ ):
658
671
  try:
659
672
  params: Dict[str, Any] = {
660
673
  "instruments": Instruments,
@@ -666,7 +679,11 @@ class XTSConnect(XTSCommon):
666
679
  traceback.print_exc()
667
680
  raise BrokerException("send_subscription Failed for XTS")
668
681
 
669
- def send_unsubscription(self, Instruments, xtsMessageCode):
682
+ def send_unsubscription(
683
+ self,
684
+ Instruments: List[XTSTypes.InstrumentType],
685
+ xtsMessageCode: XTSTypes.XTSMessageCodeType,
686
+ ):
670
687
  try:
671
688
  params: Dict[str, Any] = {
672
689
  "instruments": Instruments,
@@ -678,7 +695,7 @@ class XTSConnect(XTSCommon):
678
695
  traceback.print_exc()
679
696
  raise BrokerException("send_unsubscription Failed for XTS")
680
697
 
681
- def get_master(self, exchangeSegmentList: List[ExchangeSegmentType]):
698
+ def get_master(self, exchangeSegmentList: List[XTSTypes.ExchangeType]):
682
699
  try:
683
700
  params: Dict[str, Any] = {"exchangeSegmentList": exchangeSegmentList}
684
701
  response = self._post("market.instruments.master", json.dumps(params))
@@ -689,11 +706,11 @@ class XTSConnect(XTSCommon):
689
706
 
690
707
  def get_ohlc(
691
708
  self,
692
- exchangeSegment: ExchangeSegmentType,
693
- exchangeInstrumentID,
694
- startTime,
695
- endTime,
696
- compressionValue,
709
+ exchangeSegment: XTSTypes.ExchangeSegmentType,
710
+ exchangeInstrumentID: str | int,
711
+ startTime: str,
712
+ endTime: str,
713
+ compressionValue: Literal[1, 60, 120, 180, 300, 600, 900, 1800, 3600],
697
714
  ):
698
715
  try:
699
716
  params: Dict[str, Any] = {
@@ -709,7 +726,7 @@ class XTSConnect(XTSCommon):
709
726
  traceback.print_exc()
710
727
  raise BrokerException("get_ohlc Failed for XTS")
711
728
 
712
- def get_series(self, exchangeSegment: ExchangeSegmentType):
729
+ def get_series(self, exchangeSegment: XTSTypes.ExchangeSegmentType):
713
730
  try:
714
731
  params: Dict[str, Any] = {"exchangeSegment": exchangeSegment}
715
732
  response = self._get("market.instruments.instrument.series", params)
@@ -718,7 +735,12 @@ class XTSConnect(XTSCommon):
718
735
  traceback.print_exc()
719
736
  raise BrokerException("get_series Failed for XTS")
720
737
 
721
- def get_equity_symbol(self, exchangeSegment: ExchangeSegmentType, series, symbol):
738
+ def get_equity_symbol(
739
+ self,
740
+ exchangeSegment: XTSTypes.ExchangeSegmentType,
741
+ series: XTSTypes.SeriesType,
742
+ symbol: str,
743
+ ):
722
744
  try:
723
745
  params: Dict[str, Any] = {
724
746
  "exchangeSegment": exchangeSegment,
@@ -731,7 +753,12 @@ class XTSConnect(XTSCommon):
731
753
  traceback.print_exc()
732
754
  raise BrokerException("get_equity_symbol Failed for XTS")
733
755
 
734
- def get_expiry_date(self, exchangeSegment: ExchangeSegmentType, series, symbol):
756
+ def get_expiry_date(
757
+ self,
758
+ exchangeSegment: XTSTypes.ExchangeSegmentType,
759
+ series: XTSTypes.SeriesType,
760
+ symbol: str,
761
+ ):
735
762
  try:
736
763
  params: Dict[str, Any] = {
737
764
  "exchangeSegment": exchangeSegment,
@@ -745,7 +772,11 @@ class XTSConnect(XTSCommon):
745
772
  raise BrokerException("get_expiry_date Failed for XTS")
746
773
 
747
774
  def get_future_symbol(
748
- self, exchangeSegment: ExchangeSegmentType, series, symbol, expiryDate
775
+ self,
776
+ exchangeSegment: XTSTypes.ExchangeSegmentType,
777
+ series: XTSTypes.SeriesType,
778
+ symbol: str,
779
+ expiryDate: str,
749
780
  ):
750
781
  try:
751
782
  params: Dict[str, Any] = {
@@ -762,12 +793,12 @@ class XTSConnect(XTSCommon):
762
793
 
763
794
  def get_option_symbol(
764
795
  self,
765
- exchangeSegment: ExchangeSegmentType,
766
- series,
767
- symbol,
768
- expiryDate,
769
- optionType,
770
- strikePrice,
796
+ exchangeSegment: XTSTypes.ExchangeSegmentType,
797
+ series: XTSTypes.SeriesType,
798
+ symbol: str,
799
+ expiryDate: str,
800
+ optionType: Literal["CE", "PE"],
801
+ strikePrice: int,
771
802
  ):
772
803
  try:
773
804
  params: Dict[str, Any] = {
@@ -785,7 +816,11 @@ class XTSConnect(XTSCommon):
785
816
  raise BrokerException("get_option_symbol Failed for XTS")
786
817
 
787
818
  def get_option_type(
788
- self, exchangeSegment: ExchangeSegmentType, series, symbol, expiryDate
819
+ self,
820
+ exchangeSegment: XTSTypes.ExchangeSegmentType,
821
+ series: XTSTypes.SeriesType,
822
+ symbol: str,
823
+ expiryDate: str,
789
824
  ):
790
825
  try:
791
826
  params: Dict[str, Any] = {
@@ -800,7 +835,7 @@ class XTSConnect(XTSCommon):
800
835
  traceback.print_exc()
801
836
  raise BrokerException("get_option_type Failed for XTS")
802
837
 
803
- def get_index_list(self, exchangeSegment: ExchangeSegmentType):
838
+ def get_index_list(self, exchangeSegment: XTSTypes.ExchangeSegmentType):
804
839
  try:
805
840
  params: Dict[str, Any] = {"exchangeSegment": exchangeSegment}
806
841
  response = self._get("market.instruments.indexlist", params)
@@ -809,7 +844,7 @@ class XTSConnect(XTSCommon):
809
844
  traceback.print_exc()
810
845
  raise BrokerException("get_index_list Failed for XTS")
811
846
 
812
- def search_by_instrumentid(self, Instruments):
847
+ def search_by_instrumentid(self, Instruments: List[XTSTypes.InstrumentType]):
813
848
  try:
814
849
  params: Dict[str, Any] = {"source": self.source, "instruments": Instruments}
815
850
  response = self._post("market.search.instrumentsbyid", json.dumps(params))
@@ -0,0 +1,24 @@
1
+ from typing import Literal, TypedDict
2
+
3
+
4
+ XTSExchangeSegmentType = Literal[1, 2, 3, 11, 12]
5
+
6
+
7
+ class XTSInstrumentType(TypedDict):
8
+ exchangeSegment: XTSExchangeSegmentType
9
+ exchangeInstrumentID: str | int
10
+
11
+
12
+ class XTSTypes:
13
+ ExchangeSegmentType = XTSExchangeSegmentType
14
+ XTSMessageCodeType = Literal[1501, 1502, 1505, 1507, 1510, 1512, 1105]
15
+ PublishFormatType = Literal["JSON", "Binary"]
16
+ ExchangeType = Literal["NSECM", "NSEFO", "NSECD", "BSECM", "BSEFO"]
17
+ InstrumentType = XTSInstrumentType
18
+ SeriesType = str
19
+ OrderSide = Literal["BUY", "SELL"]
20
+ OrderType = Literal["Market", "StopLimit", "StopMarket", "Limit"]
21
+ ProductType = Literal["CO", "CNC", "MIS", "NRML"]
22
+ PositionSqureOffModeType = Literal["DayWise", "NetWise"]
23
+ PositionSquareOffQuantityTypeType = Literal["Percentage", "ExactQty"]
24
+ DayOrNetType = Literal["DAY", "NET"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quantplay
3
- Version: 2.0.36
3
+ Version: 2.0.37
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.36",
24
+ version="2.0.37",
25
25
  setup_requires=["pytest-runner"],
26
26
  install_requires=requirements,
27
27
  tests_require=[],
@@ -1,7 +0,0 @@
1
- from typing import Literal
2
-
3
-
4
- ExchangeSegmentType = Literal[1, 2, 3, 11, 12]
5
- XTSMessageCodeType = Literal[1501, 1502, 1505, 1507, 1510, 1512, 1105]
6
- PublishFormatType = Literal["JSON", "Binary"]
7
- ExchangeType = Literal["NSECM", "NSEFO", "NSECD", "BSECM", "BSEFO"]
File without changes
File without changes
File without changes
File without changes
File without changes