wiz-trader 0.15.0__py3-none-any.whl → 0.16.0__py3-none-any.whl

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/__init__.py CHANGED
@@ -3,6 +3,6 @@
3
3
  from .quotes import QuotesClient
4
4
  from .apis import WizzerClient
5
5
 
6
- __version__ = "0.15.0"
6
+ __version__ = "0.16.0"
7
7
 
8
8
  __all__ = ["QuotesClient", "WizzerClient"]
wiz_trader/apis/client.py CHANGED
@@ -1162,36 +1162,69 @@ class WizzerClient:
1162
1162
  return self._make_request("PATCH", endpoint, json=params)
1163
1163
 
1164
1164
  def rebalance_basket(
1165
- self,
1166
- trading_symbol: str,
1167
- instruments: List[str],
1168
- execution_policy: str
1169
- ) -> Dict[str, Any]:
1170
- """
1171
- Rebalance a basket with new instruments.
1172
-
1173
- Args:
1174
- trading_symbol (str): Basket trading symbol.
1175
- instruments (List[str]): List of instrument identifiers for the new basket composition.
1176
- execution_policy (str): Rebalance execution policy.
1177
- 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.
1178
1174
 
1179
- Returns:
1180
- Dict[str, Any]: Rebalance response.
1181
- """
1182
- endpoint = self._routes["basket.rebalance"]
1183
-
1184
- data = {
1185
- "tradingSymbol": trading_symbol,
1186
- "instruments": instruments,
1187
- "policies": {
1188
- "execution": execution_policy
1189
- }
1190
- }
1191
-
1192
- logger.debug("Rebalancing basket %s with instruments: %s, policy: %s",
1193
- trading_symbol, instruments, execution_policy)
1194
- return self._make_request("POST", endpoint, json=data)
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)
1195
1228
 
1196
1229
  def exit_all_positions(self) -> Dict[str, Any]:
1197
1230
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wiz_trader
3
- Version: 0.15.0
3
+ Version: 0.16.0
4
4
  Summary: A Python SDK for connecting to the Wizzer.
5
5
  Home-page: https://bitbucket.org/wizzer-tech/quotes_sdk.git
6
6
  Author: Pawan Wagh
@@ -0,0 +1,9 @@
1
+ wiz_trader/__init__.py,sha256=ScYHyaz49WDqsMZQVcJLXExQJp_ZOdSeqRvLIiAS-lI,182
2
+ wiz_trader/apis/__init__.py,sha256=ItWKMOl4omiW0g2f-M7WRW3v-dss_ULd9vYnFyIIT9o,132
3
+ wiz_trader/apis/client.py,sha256=JDw0lMCw79LSU9E0YRHt_2FCAzZTZddweB5EsJChTb4,47054
4
+ wiz_trader/quotes/__init__.py,sha256=RF9g9CNP6bVWlmCh_ad8krm3-EWOIuVfLp0-H9fAeEM,108
5
+ wiz_trader/quotes/client.py,sha256=LJeMcQPjJIRxrTIGalWsLYh_XfinDXBP5-4cNS7qCxc,9709
6
+ wiz_trader-0.16.0.dist-info/METADATA,sha256=Xwzf-z6y-ovu7lq-c5K4tlkiyWafGTzUxwgDKJqrJTk,54024
7
+ wiz_trader-0.16.0.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
8
+ wiz_trader-0.16.0.dist-info/top_level.txt,sha256=lnYS_g8LlA6ryKYnvY8xIQ6K2K-xzOsd-99AWgnW6VY,11
9
+ wiz_trader-0.16.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.3.1)
2
+ Generator: setuptools (80.4.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,9 +0,0 @@
1
- wiz_trader/__init__.py,sha256=3fwdVbFYiQATRbAy1qYqyHPOW1Z0Nw56KDb1zeKEB14,182
2
- wiz_trader/apis/__init__.py,sha256=ItWKMOl4omiW0g2f-M7WRW3v-dss_ULd9vYnFyIIT9o,132
3
- wiz_trader/apis/client.py,sha256=HoMFXfWoO3HdAwPCfOD2_U8nfZJ6iBCB6FnWxzlzl5E,45295
4
- wiz_trader/quotes/__init__.py,sha256=RF9g9CNP6bVWlmCh_ad8krm3-EWOIuVfLp0-H9fAeEM,108
5
- wiz_trader/quotes/client.py,sha256=LJeMcQPjJIRxrTIGalWsLYh_XfinDXBP5-4cNS7qCxc,9709
6
- wiz_trader-0.15.0.dist-info/METADATA,sha256=imCNht3nXlWeViNIFt0_sPyuUv5criLgusNjjkrvUhU,54024
7
- wiz_trader-0.15.0.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
8
- wiz_trader-0.15.0.dist-info/top_level.txt,sha256=lnYS_g8LlA6ryKYnvY8xIQ6K2K-xzOsd-99AWgnW6VY,11
9
- wiz_trader-0.15.0.dist-info/RECORD,,