quantplay 1.2.64__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.
- {quantplay-1.2.64 → quantplay-1.2.65}/PKG-INFO +1 -1
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/broker/xts.py +31 -16
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay.egg-info/PKG-INFO +1 -1
- {quantplay-1.2.64 → quantplay-1.2.65}/setup.py +1 -1
- {quantplay-1.2.64 → quantplay-1.2.65}/README.md +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/backtest/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/backtest/backtest_trades.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/broker/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/broker/angelone.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/broker/broker_client.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/broker/client.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/broker/finvasia_utils/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/broker/finvasia_utils/shoonya.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/broker/generics/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/broker/generics/broker.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/broker/iifl_xts.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/broker/kite_utils.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/broker/motilal.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/broker/shoonya.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/broker/symphony.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/broker/xts_utils/Connect.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/broker/xts_utils/Exception.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/broker/xts_utils/InteractiveSocketClient.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/broker/xts_utils/MarketDataSocketClient.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/broker/xts_utils/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/broker/zerodha.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/brokerage/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/brokerage/angelone/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/brokerage/angelone/angel_broker.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/brokerage/generics/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/brokerage/generics/broker.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/brokerage/zerodha/ZBroker.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/brokerage/zerodha/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/config/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/config/qplay_config.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/create_sample_data.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/data_modify_script.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/date_fix.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/exception/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/exception/exceptions.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/executor/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/executor/strategy_executor.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/indicators/Indicator.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/indicators/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/indicators/atr.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/model/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/model/exchange/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/model/exchange/instrument.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/model/exchange/order.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/model/exchange/tick.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/model/strategy/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/model/strategy/strategy_response.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/oms/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/order_execution/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/order_execution/execution_algorithm.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/order_execution/mean_price.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/reporting/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/reporting/strategy_report.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/reporting/visuals.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/service.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/services/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/services/market.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/services/tradelens.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/strategies/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/strategies/equities/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/strategies/equities/intraday/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/strategies/equities/overnight/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/strategies/futures/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/strategies/futures/overnight/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/strategies/options/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/strategies/options/intraday/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/strategies/options/intraday/ladder.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/strategies/options/intraday/musk.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/strategies/options/intraday/short_straddle.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/strategy/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/strategy/base.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/strategy_run.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/utils/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/utils/config_util.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/utils/constant.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/utils/data_utils.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/utils/exchange.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/utils/number_utils.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/utils/pickle_utils.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/utils/selenium_utils.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay/utils/transaction_utils.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay.egg-info/SOURCES.txt +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay.egg-info/dependency_links.txt +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay.egg-info/requires.txt +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/quantplay.egg-info/top_level.txt +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/setup.cfg +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/test/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/test/broker/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/test/broker/finvasia.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/test/executor/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/test/executor/strategy_executor.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/test/strategy/__init__.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/test/strategy/base.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/test/strategy/sample_strategy.py +0 -0
- {quantplay-1.2.64 → quantplay-1.2.65}/test/test_motilal.py +0 -0
|
@@ -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[:,
|
|
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"
|
|
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(
|
|
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"],
|
|
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[
|
|
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"
|
|
192
|
-
"SumOfTradedQuantityAndPriceSell"
|
|
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"] =
|
|
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(
|
|
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[:,
|
|
218
|
-
positions.loc[:,
|
|
219
|
-
positions.loc[:,
|
|
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[:,
|
|
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(
|
|
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(
|
|
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"]
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
{quantplay-1.2.64 → quantplay-1.2.65}/quantplay/strategies/options/intraday/short_straddle.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
|