quantplay 2.0.98__tar.gz → 2.0.100__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 (67) hide show
  1. {quantplay-2.0.98 → quantplay-2.0.100}/PKG-INFO +1 -1
  2. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/broker_factory.py +25 -0
  3. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/generics/broker.py +1 -0
  4. quantplay-2.0.100/quantplay/broker/jainam_xts.py +33 -0
  5. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/xts.py +14 -2
  6. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/xts_utils/Connect.py +37 -0
  7. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay.egg-info/PKG-INFO +1 -1
  8. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay.egg-info/SOURCES.txt +1 -0
  9. {quantplay-2.0.98 → quantplay-2.0.100}/setup.py +1 -1
  10. {quantplay-2.0.98 → quantplay-2.0.100}/README.md +0 -0
  11. {quantplay-2.0.98 → quantplay-2.0.100}/pyproject.toml +0 -0
  12. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/__init__.py +0 -0
  13. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/__init__.py +0 -0
  14. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/aliceblue.py +0 -0
  15. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/angelone.py +0 -0
  16. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/auto_login/__init__.py +0 -0
  17. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/auto_login/aliceblue.py +0 -0
  18. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/dhan.py +0 -0
  19. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/finvasia_utils/__init__.py +0 -0
  20. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/finvasia_utils/fa_noren.py +0 -0
  21. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/five_paisa.py +0 -0
  22. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/flattrade.py +0 -0
  23. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/ft_utils/__init__.py +0 -0
  24. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/ft_utils/flattrade_utils.py +0 -0
  25. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/ft_utils/ft_noren.py +0 -0
  26. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/generics/__init__.py +0 -0
  27. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/iifl_xts.py +0 -0
  28. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/kite_utils.py +0 -0
  29. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/kotak.py +0 -0
  30. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/motilal.py +0 -0
  31. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/noren.py +0 -0
  32. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/shoonya.py +0 -0
  33. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/uplink/__init__.py +0 -0
  34. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/uplink/uplink_utils.py +0 -0
  35. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/upstox.py +0 -0
  36. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/xts_utils/Exception.py +0 -0
  37. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/xts_utils/InteractiveSocketClient.py +0 -0
  38. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/xts_utils/__init__.py +0 -0
  39. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/broker/zerodha.py +0 -0
  40. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/exception/__init__.py +0 -0
  41. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/exception/exceptions.py +0 -0
  42. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/model/__init__.py +0 -0
  43. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/model/broker.py +0 -0
  44. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/model/broker_response.py +0 -0
  45. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/model/generics.py +0 -0
  46. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/model/instrument_data.py +0 -0
  47. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/model/order_event.py +0 -0
  48. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/py.typed +0 -0
  49. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/utils/__init__.py +0 -0
  50. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/utils/caching.py +0 -0
  51. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/utils/constant.py +0 -0
  52. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/utils/exchange.py +0 -0
  53. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/utils/number_utils.py +0 -0
  54. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/utils/pickle_utils.py +0 -0
  55. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/utils/selenium_utils.py +0 -0
  56. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/wrapper/__init__.py +0 -0
  57. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/wrapper/aws/__init__.py +0 -0
  58. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay/wrapper/aws/s3.py +0 -0
  59. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay.egg-info/dependency_links.txt +0 -0
  60. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay.egg-info/requires.txt +0 -0
  61. {quantplay-2.0.98 → quantplay-2.0.100}/quantplay.egg-info/top_level.txt +0 -0
  62. {quantplay-2.0.98 → quantplay-2.0.100}/setup.cfg +0 -0
  63. {quantplay-2.0.98 → quantplay-2.0.100}/tests/__init__.py +0 -0
  64. {quantplay-2.0.98 → quantplay-2.0.100}/tests/conftest.py +0 -0
  65. {quantplay-2.0.98 → quantplay-2.0.100}/tests/wrapper/__init__.py +0 -0
  66. {quantplay-2.0.98 → quantplay-2.0.100}/tests/wrapper/aws/__init__.py +0 -0
  67. {quantplay-2.0.98 → quantplay-2.0.100}/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.98
3
+ Version: 2.0.100
4
4
  Summary: This python package will be stored in AWS CodeArtifact
5
5
  Home-page:
6
6
  Author:
@@ -11,6 +11,7 @@ from quantplay.broker.dhan import Dhan
11
11
  from quantplay.broker.five_paisa import FivePaisa
12
12
  from quantplay.broker.flattrade import FlatTrade
13
13
  from quantplay.broker.iifl_xts import IIFL as IIFL_XTS
14
+ from quantplay.broker.jainam_xts import Jainam
14
15
  from quantplay.broker.kotak import Kotak
15
16
  from quantplay.broker.motilal import Motilal
16
17
  from quantplay.broker.shoonya import FinvAsia
@@ -32,6 +33,7 @@ BrokerType = (
32
33
  | FivePaisa
33
34
  | Kotak
34
35
  | Dhan
36
+ | Jainam
35
37
  )
36
38
 
37
39
  instrument_cache = InstrumentCache()
@@ -46,6 +48,7 @@ class Broker:
46
48
  FINVASIA = "Finvasia"
47
49
  FLATTRADE = "Flattrade"
48
50
  IIFL_XTS = "IIFL_XTS"
51
+ JAINAM = "Jainam"
49
52
  MOTILAL = "Motilal"
50
53
  ANGELONE = "Angelone"
51
54
  KOTAK = "Kotak"
@@ -57,6 +60,7 @@ broker_instruments_map = {
57
60
  Broker.FINVASIA: "shoonya_instruments",
58
61
  Broker.FLATTRADE: "shoonya_instruments",
59
62
  Broker.IIFL_XTS: "xts_instruments",
63
+ Broker.JAINAM: "xts_instruments",
60
64
  Broker.MOTILAL: "motilal_instruments",
61
65
  Broker.ANGELONE: "angelone_instruments",
62
66
  Broker.ALICEBLUE: "aliceblue_instruments",
@@ -71,6 +75,7 @@ broker_required_args = {
71
75
  Broker.FINVASIA: set(["user_id", "user_token"]),
72
76
  Broker.FLATTRADE: set(["user_id", "user_token"]),
73
77
  Broker.IIFL_XTS: set(["user_id", "wrapper", "md_wrapper"]),
78
+ Broker.JAINAM: set(["user_id", "wrapper", "md_wrapper"]),
74
79
  Broker.MOTILAL: set(["user_id", "headers"]),
75
80
  Broker.ALICEBLUE: set(["user_id", "client"]),
76
81
  Broker.UPSTOX: set(["user_id", "access_token"]),
@@ -92,6 +97,7 @@ broker_generate_args = {
92
97
  Broker.ZERODHA: set(["user_id", "api_key", "api_secret"]),
93
98
  Broker.FLATTRADE: set(["user_id", "api_secret", "password", "totp", "api_key"]),
94
99
  Broker.IIFL_XTS: set(["api_key", "api_secret", "md_api_key", "md_api_secret"]),
100
+ Broker.JAINAM: set(["api_key", "api_secret", "md_api_key", "md_api_secret"]),
95
101
  Broker.MOTILAL: set(["user_id", "password", "api_key", "two_fa", "totp"]),
96
102
  Broker.ALICEBLUE: set(["user_id", "api_key"]),
97
103
  Broker.DHAN: set(["user_id", "access_token"]),
@@ -297,6 +303,25 @@ class BrokerFactory:
297
303
  pickle.dumps(broker_client.md_wrapper), "base64"
298
304
  ).decode()
299
305
 
306
+ elif broker == Broker.JAINAM:
307
+ broker_client = Jainam(
308
+ api_secret=broker_data["api_secret"],
309
+ api_key=broker_data["api_key"],
310
+ md_api_key=broker_data["md_api_key"],
311
+ md_api_secret=broker_data["md_api_secret"],
312
+ client_id=broker_data["user_id"],
313
+ load_instrument=False,
314
+ )
315
+ broker_data["user_id"] = broker_client.ClientID
316
+
317
+ broker_data["wrapper"] = codecs.encode(
318
+ pickle.dumps(broker_client.wrapper), "base64"
319
+ ).decode()
320
+
321
+ broker_data["md_wrapper"] = codecs.encode(
322
+ pickle.dumps(broker_client.md_wrapper), "base64"
323
+ ).decode()
324
+
300
325
  else:
301
326
  raise InvalidArgumentException(f"Broker '{broker}' not supported")
302
327
 
@@ -603,6 +603,7 @@ class Broker(ABC):
603
603
  )
604
604
 
605
605
  orders = orders.to_dicts()
606
+ orders = sorted(orders, key=lambda d: d["transaction_type"])
606
607
  for order in orders:
607
608
  order_id = order["order_id"]
608
609
  if "status" in order and order["status"].lower() in [
@@ -0,0 +1,33 @@
1
+ from quantplay.broker.xts import XTS
2
+
3
+
4
+ class Jainam(XTS):
5
+ def __init__(
6
+ self,
7
+ api_secret: str | None = None,
8
+ api_key: str | None = None,
9
+ md_api_key: str | None = None,
10
+ md_api_secret: str | None = None,
11
+ wrapper: str | None = None,
12
+ md_wrapper: str | None = None,
13
+ client_id: str | None = None,
14
+ load_instrument: bool = True,
15
+ is_dealer: bool = False,
16
+ ):
17
+ super().__init__(
18
+ root_url=f"http://ctrade.jainam.in:{3000 if is_dealer else 3001}",
19
+ api_key=api_key,
20
+ api_secret=api_secret,
21
+ md_api_key=md_api_key,
22
+ md_api_secret=md_api_secret,
23
+ wrapper=wrapper,
24
+ md_wrapper=md_wrapper,
25
+ ClientID=client_id,
26
+ is_dealer=is_dealer,
27
+ load_instrument=load_instrument,
28
+ )
29
+
30
+
31
+ # c = Jainam(api_key="263c59f6f4819ccbebf318", api_secret="Kqkp821@Jd", md_api_key="534366e91e9bcf84115624", md_api_secret="Yvnf855@bn", client_id="DLL11257")
32
+
33
+ # c = Jainam(api_key="cfd1d450a247a68bfc4447", api_secret="Wvvi122$ST", md_api_key="7e83f15231a2e249938492", md_api_secret="Uyfk361#cn", client_id="DLL9814", is_dealer=True)
@@ -52,11 +52,13 @@ class XTS(Broker):
52
52
  wrapper: str | None = None,
53
53
  md_wrapper: str | None = None,
54
54
  ClientID: str | None = None,
55
+ is_dealer: bool = False,
55
56
  load_instrument: bool = True,
56
57
  ):
57
58
  super().__init__()
58
59
  self.order_updates: Queue[OrderUpdateEvent] | None = order_updates
59
60
  self.root_url = root_url
61
+ self.is_dealer = is_dealer
60
62
 
61
63
  try:
62
64
  if wrapper and md_wrapper and ClientID:
@@ -213,7 +215,12 @@ class XTS(Broker):
213
215
 
214
216
  def orders(self, tag: str | None = None, add_ltp: bool = True) -> pl.DataFrame:
215
217
  api_response = self.invoke_xts_api(
216
- self.wrapper.get_order_book, clientID=self.ClientID
218
+ (
219
+ self.wrapper.get_dealer_orderbook
220
+ if self.is_dealer
221
+ else self.wrapper.get_order_book
222
+ ),
223
+ clientID=None if self.is_dealer else self.ClientID,
217
224
  )
218
225
 
219
226
  api_response = api_response["result"]
@@ -343,7 +350,12 @@ class XTS(Broker):
343
350
 
344
351
  def positions(self, drop_cnc: bool = True) -> pl.DataFrame:
345
352
  api_response = self.invoke_xts_api(
346
- self.wrapper.get_position_daywise, clientID=self.ClientID
353
+ (
354
+ self.wrapper.get_dealerposition_daywise
355
+ if self.is_dealer
356
+ else self.wrapper.get_position_daywise
357
+ ),
358
+ clientID=None if self.is_dealer else self.ClientID,
347
359
  )
348
360
 
349
361
  api_response = api_response["result"]["positionList"]
@@ -266,6 +266,43 @@ class XTSConnect(XTSCommon):
266
266
  response = self._post("order.place", json.dumps(params))
267
267
  return response
268
268
 
269
+ def get_dealer_orderbook(self, clientID: str | None = None):
270
+ """Request Order book gives states of all the orders placed by an user"""
271
+ params: Dict[str, Any] = {}
272
+ if not self.isInvestorClient:
273
+ params["clientID"] = clientID
274
+
275
+ response = self._get("order.dealer.status", params)
276
+ return response
277
+
278
+ def get_dealer_tradebook(self, clientID: str | None = None):
279
+ """Trade book returns a list of all trades executed on a particular day , that were placed by the user . The
280
+ trade book will display all filled and partially filled orders."""
281
+ params: Dict[str, Any] = {}
282
+ if not self.isInvestorClient:
283
+ params["clientID"] = clientID
284
+ response = self._get("dealer.trades", params)
285
+ return response
286
+
287
+ def get_dealerposition_netwise(self, clientID: str | None = None):
288
+ """The positions API positions by net. Net is the actual, current net position portfolio."""
289
+ params: Dict[str, Any] = {"dayOrNet": "NetWise"}
290
+ if not self.isInvestorClient:
291
+ params["clientID"] = clientID
292
+ response = self._get("portfolio.dealerpositions", params)
293
+ return response
294
+
295
+ def get_dealerposition_daywise(self, clientID: str | None = None):
296
+ """The positions API returns positions by day, which is a snapshot of the buying and selling activity for
297
+ that particular day."""
298
+ params: Dict[str, Any] = {"dayOrNet": "DayWise"}
299
+ if not self.isInvestorClient:
300
+ params["clientID"] = clientID
301
+
302
+ response = self._get("portfolio.dealerpositions", params)
303
+
304
+ return response
305
+
269
306
  def place_bracketorder(
270
307
  self,
271
308
  exchangeSegment: XTSTypes.ExchangeType,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quantplay
3
- Version: 2.0.98
3
+ Version: 2.0.100
4
4
  Summary: This python package will be stored in AWS CodeArtifact
5
5
  Home-page:
6
6
  Author:
@@ -16,6 +16,7 @@ quantplay/broker/dhan.py
16
16
  quantplay/broker/five_paisa.py
17
17
  quantplay/broker/flattrade.py
18
18
  quantplay/broker/iifl_xts.py
19
+ quantplay/broker/jainam_xts.py
19
20
  quantplay/broker/kite_utils.py
20
21
  quantplay/broker/kotak.py
21
22
  quantplay/broker/motilal.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.98",
24
+ version="2.0.100",
25
25
  setup_requires=["pytest-runner"],
26
26
  install_requires=requirements,
27
27
  tests_require=[],
File without changes
File without changes
File without changes