quantplay 1.2.63__tar.gz → 1.2.65__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 (101) hide show
  1. {quantplay-1.2.63 → quantplay-1.2.65}/PKG-INFO +1 -1
  2. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/broker/xts.py +31 -16
  3. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/broker/zerodha.py +3 -3
  4. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/brokerage/generics/broker.py +3 -8
  5. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay.egg-info/PKG-INFO +1 -1
  6. {quantplay-1.2.63 → quantplay-1.2.65}/setup.py +1 -1
  7. {quantplay-1.2.63 → quantplay-1.2.65}/README.md +0 -0
  8. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/__init__.py +0 -0
  9. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/backtest/__init__.py +0 -0
  10. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/backtest/backtest_trades.py +0 -0
  11. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/broker/__init__.py +0 -0
  12. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/broker/angelone.py +0 -0
  13. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/broker/broker_client.py +0 -0
  14. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/broker/client.py +0 -0
  15. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/broker/finvasia_utils/__init__.py +0 -0
  16. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/broker/finvasia_utils/shoonya.py +0 -0
  17. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/broker/generics/__init__.py +0 -0
  18. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/broker/generics/broker.py +0 -0
  19. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/broker/iifl_xts.py +0 -0
  20. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/broker/kite_utils.py +0 -0
  21. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/broker/motilal.py +0 -0
  22. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/broker/shoonya.py +0 -0
  23. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/broker/symphony.py +0 -0
  24. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/broker/xts_utils/Connect.py +0 -0
  25. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/broker/xts_utils/Exception.py +0 -0
  26. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/broker/xts_utils/InteractiveSocketClient.py +0 -0
  27. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/broker/xts_utils/MarketDataSocketClient.py +0 -0
  28. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/broker/xts_utils/__init__.py +0 -0
  29. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/brokerage/__init__.py +0 -0
  30. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/brokerage/angelone/__init__.py +0 -0
  31. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/brokerage/angelone/angel_broker.py +0 -0
  32. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/brokerage/generics/__init__.py +0 -0
  33. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/brokerage/zerodha/ZBroker.py +0 -0
  34. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/brokerage/zerodha/__init__.py +0 -0
  35. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/config/__init__.py +0 -0
  36. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/config/qplay_config.py +0 -0
  37. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/create_sample_data.py +0 -0
  38. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/data_modify_script.py +0 -0
  39. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/date_fix.py +0 -0
  40. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/exception/__init__.py +0 -0
  41. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/exception/exceptions.py +0 -0
  42. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/executor/__init__.py +0 -0
  43. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/executor/strategy_executor.py +0 -0
  44. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/indicators/Indicator.py +0 -0
  45. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/indicators/__init__.py +0 -0
  46. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/indicators/atr.py +0 -0
  47. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/model/__init__.py +0 -0
  48. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/model/exchange/__init__.py +0 -0
  49. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/model/exchange/instrument.py +0 -0
  50. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/model/exchange/order.py +0 -0
  51. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/model/exchange/tick.py +0 -0
  52. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/model/strategy/__init__.py +0 -0
  53. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/model/strategy/strategy_response.py +0 -0
  54. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/oms/__init__.py +0 -0
  55. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/order_execution/__init__.py +0 -0
  56. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/order_execution/execution_algorithm.py +0 -0
  57. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/order_execution/mean_price.py +0 -0
  58. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/reporting/__init__.py +0 -0
  59. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/reporting/strategy_report.py +0 -0
  60. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/reporting/visuals.py +0 -0
  61. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/service.py +0 -0
  62. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/services/__init__.py +0 -0
  63. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/services/market.py +0 -0
  64. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/services/tradelens.py +0 -0
  65. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/strategies/__init__.py +0 -0
  66. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/strategies/equities/__init__.py +0 -0
  67. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/strategies/equities/intraday/__init__.py +0 -0
  68. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/strategies/equities/overnight/__init__.py +0 -0
  69. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/strategies/futures/__init__.py +0 -0
  70. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/strategies/futures/overnight/__init__.py +0 -0
  71. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/strategies/options/__init__.py +0 -0
  72. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/strategies/options/intraday/__init__.py +0 -0
  73. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/strategies/options/intraday/ladder.py +0 -0
  74. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/strategies/options/intraday/musk.py +0 -0
  75. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/strategies/options/intraday/short_straddle.py +0 -0
  76. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/strategy/__init__.py +0 -0
  77. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/strategy/base.py +0 -0
  78. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/strategy_run.py +0 -0
  79. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/utils/__init__.py +0 -0
  80. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/utils/config_util.py +0 -0
  81. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/utils/constant.py +0 -0
  82. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/utils/data_utils.py +0 -0
  83. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/utils/exchange.py +0 -0
  84. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/utils/number_utils.py +0 -0
  85. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/utils/pickle_utils.py +0 -0
  86. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/utils/selenium_utils.py +0 -0
  87. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay/utils/transaction_utils.py +0 -0
  88. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay.egg-info/SOURCES.txt +0 -0
  89. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay.egg-info/dependency_links.txt +0 -0
  90. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay.egg-info/requires.txt +0 -0
  91. {quantplay-1.2.63 → quantplay-1.2.65}/quantplay.egg-info/top_level.txt +0 -0
  92. {quantplay-1.2.63 → quantplay-1.2.65}/setup.cfg +0 -0
  93. {quantplay-1.2.63 → quantplay-1.2.65}/test/__init__.py +0 -0
  94. {quantplay-1.2.63 → quantplay-1.2.65}/test/broker/__init__.py +0 -0
  95. {quantplay-1.2.63 → quantplay-1.2.65}/test/broker/finvasia.py +0 -0
  96. {quantplay-1.2.63 → quantplay-1.2.65}/test/executor/__init__.py +0 -0
  97. {quantplay-1.2.63 → quantplay-1.2.65}/test/executor/strategy_executor.py +0 -0
  98. {quantplay-1.2.63 → quantplay-1.2.65}/test/strategy/__init__.py +0 -0
  99. {quantplay-1.2.63 → quantplay-1.2.65}/test/strategy/base.py +0 -0
  100. {quantplay-1.2.63 → quantplay-1.2.65}/test/strategy/sample_strategy.py +0 -0
  101. {quantplay-1.2.63 → quantplay-1.2.65}/test/test_motilal.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quantplay
3
- Version: 1.2.63
3
+ Version: 1.2.65
4
4
  Summary: This python package will be stored in AWS CodeArtifact
5
5
  Home-page:
6
6
  Author:
@@ -47,7 +47,7 @@ class XTS(Broker):
47
47
  Constants.logger.info("[LOADING_INSTRUMENTS] loading data from cache")
48
48
  except Exception as e:
49
49
  instruments = pd.read_csv(
50
- "https://quantplay-public-data.s3.ap-south-1.amazonaws.com/instruments.csv"
50
+ "https://quantplay-public-data.s3.ap-south-1.amazonaws.com/symbol_data/instruments.csv"
51
51
  )
52
52
  instruments = instruments.to_dict("records")
53
53
  self.symbol_data = {}
@@ -72,6 +72,12 @@ class XTS(Broker):
72
72
  api_response = self.wrapper.get_balance(self.ClientID)
73
73
 
74
74
  if not api_response:
75
+ return {
76
+ "pnl": 0,
77
+ "margin_used": 0,
78
+ "margin_available": 0,
79
+ }
80
+
75
81
  raise Exception(
76
82
  "[XTS_ERROR]: Balance API available for retail API users only, dealers can watch the same on dealer terminal"
77
83
  )
@@ -106,7 +112,7 @@ class XTS(Broker):
106
112
  if len(orders) == 0:
107
113
  return pd.DataFrame(columns=self.orders_column_list)
108
114
 
109
- orders.loc[:, 'tradingsymbol'] = orders.TradingSymbol
115
+ orders.loc[:, "tradingsymbol"] = orders.TradingSymbol
110
116
  orders = pd.merge(
111
117
  orders,
112
118
  positions[["tradingsymbol", "ltp"]],
@@ -130,14 +136,16 @@ class XTS(Broker):
130
136
  "CumulativeQuantity": "filled_quantity",
131
137
  "LeavesQuantity": "pending_quantity",
132
138
  "ProductType": "product",
133
- "OrderStopPrice" : "trigger_price",
139
+ "OrderStopPrice": "trigger_price",
134
140
  "OrderUniqueIdentifier": "tag",
135
141
  },
136
142
  inplace=True,
137
143
  )
138
144
 
139
145
  orders.loc[:, "filled_quantity"] = orders.filled_quantity.astype(float)
140
- orders.loc[:, "average_price"] = np.where(orders.average_price == '', 0, orders.average_price)
146
+ orders.loc[:, "average_price"] = np.where(
147
+ orders.average_price == "", 0, orders.average_price
148
+ )
141
149
  orders.loc[:, "average_price"] = orders.average_price.astype(float)
142
150
  orders.loc[:, "order_id"] = orders.order_id.astype(str)
143
151
 
@@ -154,13 +162,16 @@ class XTS(Broker):
154
162
  ["NSECM", "NSEFO"], ["NSE", "NFO"]
155
163
  )
156
164
  orders.loc[:, "status"] = orders.status.replace(
157
- ["Rejected", "Cancelled", "Filled", "New"], ["REJECTED", "CANCELLED", "COMPLETE", "OPEN"]
165
+ ["Rejected", "Cancelled", "Filled", "New"],
166
+ ["REJECTED", "CANCELLED", "COMPLETE", "OPEN"],
158
167
  )
159
168
  orders.loc[:, "order_type"] = orders.order_type.replace(
160
169
  ["Limit", "StopLimit", "Market"], ["LIMIT", "TRIGGER PENDING", "MARKET"]
161
170
  )
162
171
 
163
- orders = orders[self.orders_column_list + ["price", "trigger_price", "order_type"]]
172
+ orders = orders[
173
+ self.orders_column_list + ["price", "trigger_price", "order_type"]
174
+ ]
164
175
 
165
176
  if tag:
166
177
  orders = orders[orders.tag == tag]
@@ -188,8 +199,8 @@ class XTS(Broker):
188
199
  "OpenBuyQuantity": "buy_quantity",
189
200
  "OpenSellQuantity": "sell_quantity",
190
201
  "Quantity": "quantity",
191
- "SumOfTradedQuantityAndPriceBuy" : "buy_value",
192
- "SumOfTradedQuantityAndPriceSell" : "sell_value",
202
+ "SumOfTradedQuantityAndPriceBuy": "buy_value",
203
+ "SumOfTradedQuantityAndPriceSell": "sell_value",
193
204
  "ProductType": "product",
194
205
  },
195
206
  inplace=True,
@@ -204,7 +215,9 @@ class XTS(Broker):
204
215
  ["NSECM", "NSEFO"], ["NSE", "NFO"]
205
216
  )
206
217
 
207
- positions.loc[:, "exchange_symbol"] = positions["exchange"]+ ":" + positions["ExchangeInstrumentId"]
218
+ positions.loc[:, "exchange_symbol"] = (
219
+ positions["exchange"] + ":" + positions["ExchangeInstrumentId"]
220
+ )
208
221
 
209
222
  symbols = positions.exchange_symbol.unique().tolist()
210
223
  symbol_ltps = self.get_ltps(symbols)
@@ -212,13 +225,15 @@ class XTS(Broker):
212
225
  positions.loc[:, "ltp"] = positions.ExchangeInstrumentId.apply(
213
226
  lambda x: symbol_ltps[int(x)]
214
227
  )
215
- positions.loc[:, "pnl"] = positions.sell_value.astype(float) - positions.buy_value.astype(float)
228
+ positions.loc[:, "pnl"] = positions.sell_value.astype(
229
+ float
230
+ ) - positions.buy_value.astype(float)
216
231
  positions.loc[:, "pnl"] += positions.quantity.astype(float) * positions.ltp
217
- positions.loc[:, 'quantity'] = positions.quantity.astype(int)
218
- positions.loc[:, 'buy_quantity'] = positions.buy_quantity.astype(int)
219
- positions.loc[:, 'sell_quantity'] = positions.sell_quantity.astype(int)
232
+ positions.loc[:, "quantity"] = positions.quantity.astype(int)
233
+ positions.loc[:, "buy_quantity"] = positions.buy_quantity.astype(int)
234
+ positions.loc[:, "sell_quantity"] = positions.sell_quantity.astype(int)
220
235
 
221
- positions.loc[:, 'option_type'] = None
236
+ positions.loc[:, "option_type"] = None
222
237
 
223
238
  return positions[self.positions_column_list]
224
239
 
@@ -343,7 +358,7 @@ class XTS(Broker):
343
358
  order_data = orders[orders.order_id == str(order_id)]
344
359
  if len(order_data) == 0:
345
360
  raise InvalidArgumentException(f"Order [{order_id}] not found")
346
- order_data = order_data.to_dict('records')[0]
361
+ order_data = order_data.to_dict("records")[0]
347
362
 
348
363
  tag = order_data["tag"]
349
364
 
@@ -384,7 +399,7 @@ class XTS(Broker):
384
399
  order_data = orders[orders.order_id == order_id]
385
400
  if len(order_data) == 0:
386
401
  raise InvalidArgumentException(f"Order [{order_id}] not found")
387
- order_data = order_data.to_dict('records')[0]
402
+ order_data = order_data.to_dict("records")[0]
388
403
 
389
404
  price = price or order_data["price"]
390
405
  trigger_price = trigger_price or order_data["trigger_price"]
@@ -441,8 +441,8 @@ class Zerodha(Broker):
441
441
  def account_summary(self):
442
442
  margins = self.wrapper.margins()
443
443
  response = {
444
- 'margin_used': margins['equity']['utilised']['debits'],
445
- 'margin_available': margins['equity']['available']['live_balance'],
446
- 'pnl': self.positions().pnl.sum()
444
+ 'margin_used': float(margins['equity']['utilised']['debits']),
445
+ 'margin_available': float(margins['equity']['available']['live_balance']),
446
+ 'pnl': float(self.positions().pnl.sum())
447
447
  }
448
448
  return response
@@ -87,14 +87,9 @@ class Broker:
87
87
  start_date = end_date - timedelta(days=20)
88
88
  start_date = start_date.replace(minute=0, hour=0)
89
89
 
90
- try:
91
- response = self.get_historical_data(
92
- instrument_id, start_date=start_date, end_date=end_date, interval_max_days=interval_max_days
93
- )
94
- except Exception as e:
95
- Constants.logger.error(f"Skipping {instrument_id} because get historical data failed")
96
- continue
97
-
90
+ response = self.get_historical_data(
91
+ instrument_id, start_date=start_date, end_date=end_date, interval_max_days=interval_max_days
92
+ )
98
93
  for interval, data in response.items():
99
94
  if len(data) > 0:
100
95
  data = self.add_today_candles(data, symbol)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quantplay
3
- Version: 1.2.63
3
+ Version: 1.2.65
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="1.2.63",
24
+ version="1.2.65",
25
25
  setup_requires=["pytest-runner"],
26
26
  install_requires=requirements,
27
27
  tests_require=[],
File without changes
File without changes
File without changes