quantplay 2.0.35__tar.gz → 2.0.36__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 (62) hide show
  1. {quantplay-2.0.35 → quantplay-2.0.36}/PKG-INFO +1 -1
  2. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/five_paisa.py +2 -2
  3. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/xts.py +1 -1
  4. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/xts_utils/Connect.py +35 -24
  5. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/xts_utils/InteractiveSocketClient.py +27 -27
  6. quantplay-2.0.36/quantplay/model/xts.py +7 -0
  7. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay.egg-info/PKG-INFO +1 -1
  8. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay.egg-info/SOURCES.txt +1 -0
  9. {quantplay-2.0.35 → quantplay-2.0.36}/setup.py +1 -1
  10. {quantplay-2.0.35 → quantplay-2.0.36}/README.md +0 -0
  11. {quantplay-2.0.35 → quantplay-2.0.36}/pyproject.toml +0 -0
  12. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/__init__.py +0 -0
  13. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/__init__.py +0 -0
  14. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/aliceblue.py +0 -0
  15. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/angelone.py +0 -0
  16. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/auto_login/__init__.py +0 -0
  17. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/auto_login/aliceblue.py +0 -0
  18. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/finvasia_utils/__init__.py +0 -0
  19. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/finvasia_utils/fa_noren.py +0 -0
  20. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/flattrade.py +0 -0
  21. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/ft_utils/__init__.py +0 -0
  22. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/ft_utils/flattrade_utils.py +0 -0
  23. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/ft_utils/ft_noren.py +0 -0
  24. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/generics/__init__.py +0 -0
  25. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/generics/broker.py +0 -0
  26. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/iifl_xts.py +0 -0
  27. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/kite_utils.py +0 -0
  28. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/motilal.py +0 -0
  29. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/noren.py +0 -0
  30. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/shoonya.py +0 -0
  31. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/uplink/__init__.py +0 -0
  32. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/uplink/uplink_utils.py +0 -0
  33. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/upstox.py +0 -0
  34. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/xts_utils/Exception.py +0 -0
  35. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/xts_utils/__init__.py +0 -0
  36. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/broker/zerodha.py +0 -0
  37. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/exception/__init__.py +0 -0
  38. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/exception/exceptions.py +0 -0
  39. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/model/__init__.py +0 -0
  40. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/model/broker.py +0 -0
  41. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/model/generics.py +0 -0
  42. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/model/instrument_data.py +0 -0
  43. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/model/order_event.py +0 -0
  44. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/py.typed +0 -0
  45. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/utils/__init__.py +0 -0
  46. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/utils/constant.py +0 -0
  47. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/utils/exchange.py +0 -0
  48. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/utils/number_utils.py +0 -0
  49. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/utils/pickle_utils.py +0 -0
  50. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/utils/selenium_utils.py +0 -0
  51. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/wrapper/__init__.py +0 -0
  52. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/wrapper/aws/__init__.py +0 -0
  53. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay/wrapper/aws/s3.py +0 -0
  54. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay.egg-info/dependency_links.txt +0 -0
  55. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay.egg-info/requires.txt +0 -0
  56. {quantplay-2.0.35 → quantplay-2.0.36}/quantplay.egg-info/top_level.txt +0 -0
  57. {quantplay-2.0.35 → quantplay-2.0.36}/setup.cfg +0 -0
  58. {quantplay-2.0.35 → quantplay-2.0.36}/tests/__init__.py +0 -0
  59. {quantplay-2.0.35 → quantplay-2.0.36}/tests/conftest.py +0 -0
  60. {quantplay-2.0.35 → quantplay-2.0.36}/tests/wrapper/__init__.py +0 -0
  61. {quantplay-2.0.35 → quantplay-2.0.36}/tests/wrapper/aws/__init__.py +0 -0
  62. {quantplay-2.0.35 → quantplay-2.0.36}/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.35
3
+ Version: 2.0.36
4
4
  Summary: This python package will be stored in AWS CodeArtifact
5
5
  Home-page:
6
6
  Author:
@@ -1,3 +1,4 @@
1
+ from ast import alias
1
2
  import codecs
2
3
  import pickle
3
4
  import traceback
@@ -147,9 +148,8 @@ class FivePaisa(Broker):
147
148
  return self.client.fetch_market_feed_scrip(req_list_)["Data"][0]["LastRate"] # type: ignore
148
149
 
149
150
  def add_exchange(self, data: pl.DataFrame):
150
- data["exchange"] = None
151
-
152
151
  return data.with_columns(
152
+ pl.lit(None).alias("exchange"),
153
153
  pl.when((pl.col("Exch").eq("N")) & (pl.col("ExchType").eq("D")))
154
154
  .then(pl.lit("NFO"))
155
155
  .alias("exchange"),
@@ -668,7 +668,7 @@ class XTS(Broker):
668
668
  disclosed_quantity = 0
669
669
 
670
670
  api_response = self.wrapper.modify_order(
671
- appOrderID=order_id,
671
+ appOrderID=int(order_id),
672
672
  modifiedTimeInForce=time_in_force,
673
673
  modifiedDisclosedQuantity=disclosed_quantity,
674
674
  modifiedLimitPrice=price,
@@ -9,7 +9,7 @@ import json
9
9
  import logging
10
10
  import os
11
11
  import traceback
12
- from typing import Any, Dict, Literal
12
+ from typing import Any, Dict, List, Literal
13
13
 
14
14
  import requests
15
15
  import urllib3
@@ -20,6 +20,7 @@ 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
24
 
24
25
  log = logging.getLogger(__name__)
25
26
 
@@ -346,15 +347,15 @@ class XTSConnect(XTSCommon):
346
347
 
347
348
  def modify_order(
348
349
  self,
349
- appOrderID,
350
+ appOrderID: int,
350
351
  modifiedProductType,
351
352
  modifiedOrderType,
352
- modifiedOrderQuantity,
353
- modifiedDisclosedQuantity,
354
- modifiedLimitPrice,
355
- modifiedStopPrice,
353
+ modifiedOrderQuantity: int,
354
+ modifiedDisclosedQuantity: int,
355
+ modifiedLimitPrice: float,
356
+ modifiedStopPrice: float,
356
357
  modifiedTimeInForce,
357
- orderUniqueIdentifier,
358
+ orderUniqueIdentifier: str,
358
359
  clientID: str | None = None,
359
360
  ):
360
361
  """The facility to modify your open orders by allowing you to change limit order to market or vice versa,
@@ -468,7 +469,7 @@ class XTSConnect(XTSCommon):
468
469
  raise BrokerException("convert_position Failed for XTS")
469
470
 
470
471
  def cancel_order(
471
- self, appOrderID, orderUniqueIdentifier, clientID: str | None = None
472
+ self, appOrderID: int, orderUniqueIdentifier: str, clientID: str | None = None
472
473
  ):
473
474
  """This API can be called to cancel any open order of the user by providing correct appOrderID matching with
474
475
  the chosen open order to cancel."""
@@ -485,7 +486,7 @@ class XTSConnect(XTSCommon):
485
486
  traceback.print_exc()
486
487
  raise BrokerException("cancel_order Failed for XTS")
487
488
 
488
- def cancelall_order(self, exchangeSegment, exchangeInstrumentID):
489
+ def cancelall_order(self, exchangeSegment: ExchangeSegmentType, exchangeInstrumentID):
489
490
  """This API can be called to cancel all open order of the user by providing exchange segment and exchange instrument ID"""
490
491
  try:
491
492
  params: Dict[str, Any] = {
@@ -506,10 +507,10 @@ class XTSConnect(XTSCommon):
506
507
  exchangeInstrumentID,
507
508
  orderSide,
508
509
  orderType,
509
- orderQuantity,
510
- disclosedQuantity,
511
- limitPrice,
512
- stopPrice,
510
+ orderQuantity: int,
511
+ disclosedQuantity: int,
512
+ limitPrice: float,
513
+ stopPrice: float,
513
514
  orderUniqueIdentifier,
514
515
  clientID: str | None = None,
515
516
  ):
@@ -537,7 +538,7 @@ class XTSConnect(XTSCommon):
537
538
  traceback.print_exc()
538
539
  raise BrokerException("place_cover_order Failed for XTS")
539
540
 
540
- def exit_cover_order(self, appOrderID, clientID: str | None = None):
541
+ def exit_cover_order(self, appOrderID: int, clientID: str | None = None):
541
542
  """Exit Cover API is a functionality to enable user to easily exit an open stoploss order by converting it
542
543
  into Exit order."""
543
544
  try:
@@ -583,7 +584,7 @@ class XTSConnect(XTSCommon):
583
584
  traceback.print_exc()
584
585
  raise BrokerException("squareoff_position Failed for XTS")
585
586
 
586
- def get_order_history(self, appOrderID, clientID: str | None = None):
587
+ def get_order_history(self, appOrderID: int, clientID: str | None = None):
587
588
  """Order history will provide particular order trail chain. This indicate the particular order & its state
588
589
  changes. i.e.Pending New to New, New to PartiallyFilled, PartiallyFilled, PartiallyFilled & PartiallyFilled
589
590
  to Filled etc"""
@@ -677,7 +678,7 @@ class XTSConnect(XTSCommon):
677
678
  traceback.print_exc()
678
679
  raise BrokerException("send_unsubscription Failed for XTS")
679
680
 
680
- def get_master(self, exchangeSegmentList):
681
+ def get_master(self, exchangeSegmentList: List[ExchangeSegmentType]):
681
682
  try:
682
683
  params: Dict[str, Any] = {"exchangeSegmentList": exchangeSegmentList}
683
684
  response = self._post("market.instruments.master", json.dumps(params))
@@ -688,7 +689,7 @@ class XTSConnect(XTSCommon):
688
689
 
689
690
  def get_ohlc(
690
691
  self,
691
- exchangeSegment,
692
+ exchangeSegment: ExchangeSegmentType,
692
693
  exchangeInstrumentID,
693
694
  startTime,
694
695
  endTime,
@@ -708,7 +709,7 @@ class XTSConnect(XTSCommon):
708
709
  traceback.print_exc()
709
710
  raise BrokerException("get_ohlc Failed for XTS")
710
711
 
711
- def get_series(self, exchangeSegment):
712
+ def get_series(self, exchangeSegment: ExchangeSegmentType):
712
713
  try:
713
714
  params: Dict[str, Any] = {"exchangeSegment": exchangeSegment}
714
715
  response = self._get("market.instruments.instrument.series", params)
@@ -717,7 +718,7 @@ class XTSConnect(XTSCommon):
717
718
  traceback.print_exc()
718
719
  raise BrokerException("get_series Failed for XTS")
719
720
 
720
- def get_equity_symbol(self, exchangeSegment, series, symbol):
721
+ def get_equity_symbol(self, exchangeSegment: ExchangeSegmentType, series, symbol):
721
722
  try:
722
723
  params: Dict[str, Any] = {
723
724
  "exchangeSegment": exchangeSegment,
@@ -730,7 +731,7 @@ class XTSConnect(XTSCommon):
730
731
  traceback.print_exc()
731
732
  raise BrokerException("get_equity_symbol Failed for XTS")
732
733
 
733
- def get_expiry_date(self, exchangeSegment, series, symbol):
734
+ def get_expiry_date(self, exchangeSegment: ExchangeSegmentType, series, symbol):
734
735
  try:
735
736
  params: Dict[str, Any] = {
736
737
  "exchangeSegment": exchangeSegment,
@@ -743,7 +744,9 @@ class XTSConnect(XTSCommon):
743
744
  traceback.print_exc()
744
745
  raise BrokerException("get_expiry_date Failed for XTS")
745
746
 
746
- def get_future_symbol(self, exchangeSegment, series, symbol, expiryDate):
747
+ def get_future_symbol(
748
+ self, exchangeSegment: ExchangeSegmentType, series, symbol, expiryDate
749
+ ):
747
750
  try:
748
751
  params: Dict[str, Any] = {
749
752
  "exchangeSegment": exchangeSegment,
@@ -758,7 +761,13 @@ class XTSConnect(XTSCommon):
758
761
  raise BrokerException("get_future_symbol Failed for XTS")
759
762
 
760
763
  def get_option_symbol(
761
- self, exchangeSegment, series, symbol, expiryDate, optionType, strikePrice
764
+ self,
765
+ exchangeSegment: ExchangeSegmentType,
766
+ series,
767
+ symbol,
768
+ expiryDate,
769
+ optionType,
770
+ strikePrice,
762
771
  ):
763
772
  try:
764
773
  params: Dict[str, Any] = {
@@ -775,7 +784,9 @@ class XTSConnect(XTSCommon):
775
784
  traceback.print_exc()
776
785
  raise BrokerException("get_option_symbol Failed for XTS")
777
786
 
778
- def get_option_type(self, exchangeSegment, series, symbol, expiryDate):
787
+ def get_option_type(
788
+ self, exchangeSegment: ExchangeSegmentType, series, symbol, expiryDate
789
+ ):
779
790
  try:
780
791
  params: Dict[str, Any] = {
781
792
  "exchangeSegment": exchangeSegment,
@@ -789,7 +800,7 @@ class XTSConnect(XTSCommon):
789
800
  traceback.print_exc()
790
801
  raise BrokerException("get_option_type Failed for XTS")
791
802
 
792
- def get_index_list(self, exchangeSegment):
803
+ def get_index_list(self, exchangeSegment: ExchangeSegmentType):
793
804
  try:
794
805
  params: Dict[str, Any] = {"exchangeSegment": exchangeSegment}
795
806
  response = self._get("market.instruments.indexlist", params)
@@ -1,5 +1,5 @@
1
- from typing import Dict, List, Literal
2
- import socketio
1
+ from typing import Any, Dict, List, Literal
2
+ import socketio # type: ignore
3
3
 
4
4
 
5
5
  class OrderSocket_io(socketio.Client):
@@ -48,8 +48,8 @@ class OrderSocket_io(socketio.Client):
48
48
  randomization_factor: float = 0.5,
49
49
  logger: bool = False,
50
50
  binary: bool = False,
51
- json=None,
52
- **kwargs,
51
+ json: Any | None = None,
52
+ **kwargs: Any,
53
53
  ):
54
54
  self.sid = socketio.Client(logger=False, engineio_logger=False)
55
55
  self.eventlistener = self.sid
@@ -65,17 +65,17 @@ class OrderSocket_io(socketio.Client):
65
65
  port + self.token + "&userID=" + self.userID + "&apiType=INTERACTIVE"
66
66
  )
67
67
 
68
- def setup_event_listners(self, on_order):
69
- self.sid.on("order", on_order)
68
+ def setup_event_listners(self, on_order: Any):
69
+ self.sid.on("order", on_order) # type: ignore
70
70
 
71
71
  # self.sid.on("connect", self.on_connect)
72
- self.sid.on("message", self.on_message)
72
+ self.sid.on("message", self.on_message) # type: ignore
73
73
  # self.sid.on("joined", self.on_joined)
74
- self.sid.on("error", self.on_error)
75
- self.sid.on("trade", self.on_trade)
76
- self.sid.on("position", self.on_position)
77
- self.sid.on("tradeConversion", self.on_tradeconversion)
78
- self.sid.on("logout", self.on_messagelogout)
74
+ self.sid.on("error", self.on_error) # type: ignore
75
+ self.sid.on("trade", self.on_trade) # type: ignore
76
+ self.sid.on("position", self.on_position) # type: ignore
77
+ self.sid.on("tradeConversion", self.on_tradeconversion) # type: ignore
78
+ self.sid.on("logout", self.on_messagelogout) # type: ignore
79
79
  # self.sid.on("disconnect", self.on_disconnect)
80
80
 
81
81
  def connect( # type: ignore
@@ -108,7 +108,7 @@ class OrderSocket_io(socketio.Client):
108
108
  url = self.connection_url
109
109
 
110
110
  """Connected to the socket."""
111
- self.sid.connect(url, headers, transports, namespaces, socketio_path)
111
+ self.sid.connect(url, headers, transports, namespaces, socketio_path) # type: ignore
112
112
  self.sid.wait()
113
113
  """Disconnect from the socket."""
114
114
  # self.sid.disconnect()
@@ -121,33 +121,33 @@ class OrderSocket_io(socketio.Client):
121
121
  """On message from socket"""
122
122
  print("I received a message!")
123
123
 
124
- def on_joined(self, data):
124
+ def on_joined(self, data: Any):
125
125
  """On socket joined"""
126
- print("Interactive socket joined successfully!" + data)
126
+ print(f"Interactive socket joined successfully!{data}")
127
127
 
128
- def on_error(self, data):
128
+ def on_error(self, data: Any):
129
129
  """On receiving error from socket"""
130
- print("Interactive socket error!" + data)
130
+ print(f"Interactive socket error!{data}")
131
131
 
132
- def on_order(self, data):
132
+ def on_order(self, data: Any):
133
133
  """On receiving order placed data from socket"""
134
- print("Order placed!" + data)
134
+ print(f"Order placed!{data}")
135
135
 
136
- def on_trade(self, data):
136
+ def on_trade(self, data: Any):
137
137
  """On receiving trade data from socket"""
138
- print("Trade Received!" + data)
138
+ print(f"Trade Received!{data}")
139
139
 
140
- def on_position(self, data):
140
+ def on_position(self, data: Any):
141
141
  """On receiving position data from socket"""
142
- print("Position Retrieved!" + data)
142
+ print(f"Position Retrieved!{data}")
143
143
 
144
- def on_tradeconversion(self, data):
144
+ def on_tradeconversion(self, data: Any):
145
145
  """On receiving trade conversion data from socket"""
146
- print("Trade Conversion Received!" + data)
146
+ print(f"Trade Conversion Received!{data}")
147
147
 
148
- def on_messagelogout(self, data):
148
+ def on_messagelogout(self, data: Any):
149
149
  """On receiving user logout message"""
150
- print("User logged out!" + data)
150
+ print(f"User logged out!{data}")
151
151
 
152
152
  def on_disconnect(self):
153
153
  """On receiving disconnection from socket"""
@@ -0,0 +1,7 @@
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"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quantplay
3
- Version: 2.0.35
3
+ Version: 2.0.36
4
4
  Summary: This python package will be stored in AWS CodeArtifact
5
5
  Home-page:
6
6
  Author:
@@ -43,6 +43,7 @@ quantplay/model/broker.py
43
43
  quantplay/model/generics.py
44
44
  quantplay/model/instrument_data.py
45
45
  quantplay/model/order_event.py
46
+ quantplay/model/xts.py
46
47
  quantplay/utils/__init__.py
47
48
  quantplay/utils/constant.py
48
49
  quantplay/utils/exchange.py
@@ -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.35",
24
+ version="2.0.36",
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