wiz-trader 0.14.0__tar.gz → 0.16.0__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.
- {wiz_trader-0.14.0/src/wiz_trader.egg-info → wiz_trader-0.16.0}/PKG-INFO +1 -1
- {wiz_trader-0.14.0 → wiz_trader-0.16.0}/pyproject.toml +1 -1
- {wiz_trader-0.14.0 → wiz_trader-0.16.0}/setup.py +1 -1
- {wiz_trader-0.14.0 → wiz_trader-0.16.0}/src/wiz_trader/__init__.py +1 -1
- {wiz_trader-0.14.0 → wiz_trader-0.16.0}/src/wiz_trader/apis/client.py +94 -29
- {wiz_trader-0.14.0 → wiz_trader-0.16.0/src/wiz_trader.egg-info}/PKG-INFO +1 -1
- {wiz_trader-0.14.0 → wiz_trader-0.16.0}/MANIFEST.in +0 -0
- {wiz_trader-0.14.0 → wiz_trader-0.16.0}/README.md +0 -0
- {wiz_trader-0.14.0 → wiz_trader-0.16.0}/setup.cfg +0 -0
- {wiz_trader-0.14.0 → wiz_trader-0.16.0}/src/wiz_trader/apis/__init__.py +0 -0
- {wiz_trader-0.14.0 → wiz_trader-0.16.0}/src/wiz_trader/quotes/__init__.py +0 -0
- {wiz_trader-0.14.0 → wiz_trader-0.16.0}/src/wiz_trader/quotes/client.py +0 -0
- {wiz_trader-0.14.0 → wiz_trader-0.16.0}/src/wiz_trader.egg-info/SOURCES.txt +0 -0
- {wiz_trader-0.14.0 → wiz_trader-0.16.0}/src/wiz_trader.egg-info/dependency_links.txt +0 -0
- {wiz_trader-0.14.0 → wiz_trader-0.16.0}/src/wiz_trader.egg-info/requires.txt +0 -0
- {wiz_trader-0.14.0 → wiz_trader-0.16.0}/src/wiz_trader.egg-info/top_level.txt +0 -0
- {wiz_trader-0.14.0 → wiz_trader-0.16.0}/tests/test_apis.py +0 -0
- {wiz_trader-0.14.0 → wiz_trader-0.16.0}/tests/test_quotes.py +0 -0
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
2
2
|
|
3
3
|
setup(
|
4
4
|
name='wiz_trader',
|
5
|
-
version='0.
|
5
|
+
version='0.16.0',
|
6
6
|
description='A Python SDK for connecting to the Wizzer.',
|
7
7
|
long_description=open('README.md').read() if open('README.md') else "",
|
8
8
|
long_description_content_type='text/markdown',
|
@@ -110,6 +110,9 @@ class WizzerClient:
|
|
110
110
|
"datahub.indices": "/datahub/indices",
|
111
111
|
"datahub.index.components": "/datahub/index/components",
|
112
112
|
"datahub.historical.ohlcv": "/datahub/historical/ohlcv",
|
113
|
+
|
114
|
+
# Instrument & asset class endpoints
|
115
|
+
"instrument.metrics": "/instruments/metrics",
|
113
116
|
}
|
114
117
|
|
115
118
|
def __init__(
|
@@ -1159,36 +1162,69 @@ class WizzerClient:
|
|
1159
1162
|
return self._make_request("PATCH", endpoint, json=params)
|
1160
1163
|
|
1161
1164
|
def rebalance_basket(
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
trading_symbol (str): Basket trading symbol.
|
1172
|
-
instruments (List[str]): List of instrument identifiers for the new basket composition.
|
1173
|
-
execution_policy (str): Rebalance execution policy.
|
1174
|
-
Options: "full_rebalance", "entry_only", "exit_only".
|
1165
|
+
self,
|
1166
|
+
trading_symbol: str,
|
1167
|
+
instruments: List[str],
|
1168
|
+
execution_policy: str,
|
1169
|
+
order_type: str = None,
|
1170
|
+
product: str = None
|
1171
|
+
) -> Dict[str, Any]:
|
1172
|
+
"""
|
1173
|
+
Rebalance a basket with new instruments.
|
1175
1174
|
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1175
|
+
Args:
|
1176
|
+
trading_symbol (str): Basket trading symbol.
|
1177
|
+
instruments (List[str]): List of instrument identifiers for the new basket composition.
|
1178
|
+
execution_policy (str): Rebalance execution policy.
|
1179
|
+
Options: REBALANCE_FULL, REBALANCE_ENTRY_ONLY, REBALANCE_EXIT_ONLY.
|
1180
|
+
order_type (str, optional): Order type to use for rebalance orders.
|
1181
|
+
Options: ORDER_TYPE_MARKET, ORDER_TYPE_LIMIT
|
1182
|
+
product (str, optional): Product type to use for rebalance orders.
|
1183
|
+
Options: PRODUCT_CNC, PRODUCT_MIS
|
1184
|
+
|
1185
|
+
Returns:
|
1186
|
+
Dict[str, Any]: Rebalance response.
|
1187
|
+
"""
|
1188
|
+
endpoint = "/baskets/rebalance"
|
1189
|
+
|
1190
|
+
# Validate execution policy
|
1191
|
+
valid_execution_policies = [self.REBALANCE_FULL, self.REBALANCE_ENTRY_ONLY, self.REBALANCE_EXIT_ONLY]
|
1192
|
+
if execution_policy not in valid_execution_policies:
|
1193
|
+
raise ValueError(f"execution_policy must be one of {valid_execution_policies}")
|
1194
|
+
|
1195
|
+
# Build the basic request payload
|
1196
|
+
data = {
|
1197
|
+
"tradingSymbol": trading_symbol,
|
1198
|
+
"instruments": instruments,
|
1199
|
+
"policies": {
|
1200
|
+
"execution": execution_policy
|
1201
|
+
}
|
1202
|
+
}
|
1203
|
+
|
1204
|
+
# Add order policies if specified
|
1205
|
+
if order_type or product:
|
1206
|
+
order_policies = {}
|
1207
|
+
|
1208
|
+
if order_type:
|
1209
|
+
valid_order_types = [self.ORDER_TYPE_MARKET, self.ORDER_TYPE_LIMIT]
|
1210
|
+
if order_type not in valid_order_types:
|
1211
|
+
raise ValueError(f"order_type must be one of {valid_order_types}")
|
1212
|
+
order_policies["orderType"] = order_type
|
1213
|
+
|
1214
|
+
if product:
|
1215
|
+
valid_products = [self.PRODUCT_CNC, self.PRODUCT_MIS, self.PRODUCT_NRML]
|
1216
|
+
if product not in valid_products:
|
1217
|
+
raise ValueError(f"product must be one of {valid_products}")
|
1218
|
+
order_policies["product"] = product
|
1219
|
+
|
1220
|
+
if order_policies:
|
1221
|
+
data["policies"]["orders"] = order_policies
|
1222
|
+
|
1223
|
+
logger.debug("Rebalancing basket %s with instruments: %s, policy: %s, order settings: %s",
|
1224
|
+
trading_symbol, instruments, execution_policy,
|
1225
|
+
{"order_type": order_type, "product": product})
|
1226
|
+
|
1227
|
+
return self._make_request("POST", endpoint, json=data)
|
1192
1228
|
|
1193
1229
|
def exit_all_positions(self) -> Dict[str, Any]:
|
1194
1230
|
"""
|
@@ -1233,6 +1269,35 @@ class WizzerClient:
|
|
1233
1269
|
logger.debug("Exiting all positions for strategy: %s", strategy_id)
|
1234
1270
|
return self._make_request("POST", endpoint, json=data)
|
1235
1271
|
|
1272
|
+
# =====INSTRUMENT & ASSET CLASS METHODS =====
|
1273
|
+
|
1274
|
+
def get_instrument_metrics(self, identifiers: List[str]) -> List[Dict[str, Any]]:
|
1275
|
+
"""
|
1276
|
+
Get detailed metrics for instruments by their identifiers.
|
1277
|
+
|
1278
|
+
Args:
|
1279
|
+
identifiers (List[str]): List of instrument identifiers in the format
|
1280
|
+
"EXCHANGE:SYMBOL:TOKEN" (e.g., "NSE:SBIN:3045").
|
1281
|
+
|
1282
|
+
Returns:
|
1283
|
+
List[Dict[str, Any]]: List of instrument metrics.
|
1284
|
+
|
1285
|
+
Example:
|
1286
|
+
>>> client.get_instrument_metrics([
|
1287
|
+
... "NSE:SBIN:3045",
|
1288
|
+
... "NSE:RELIANCE:2885",
|
1289
|
+
... "NSE:NIFTY26DEC11000CE:61009"
|
1290
|
+
... ])
|
1291
|
+
"""
|
1292
|
+
endpoint = self._routes["instrument.metrics"]
|
1293
|
+
data = {
|
1294
|
+
"identifiers": identifiers
|
1295
|
+
}
|
1296
|
+
|
1297
|
+
logger.debug("Fetching instrument metrics for identifiers: %s", identifiers)
|
1298
|
+
response = self._make_request("POST", endpoint, json=data)
|
1299
|
+
return response
|
1300
|
+
|
1236
1301
|
def _make_request(
|
1237
1302
|
self,
|
1238
1303
|
method: str,
|
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
|