wiz-trader 0.13.0__tar.gz → 0.14.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wiz_trader
3
- Version: 0.13.0
3
+ Version: 0.14.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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "wiz_trader"
7
- version = "0.13.0"
7
+ version = "0.14.0"
8
8
  description = "A Python SDK for connecting to the Wizzer."
9
9
  readme = "README.md"
10
10
  authors = [
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='wiz_trader',
5
- version='0.13.0',
5
+ version='0.14.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',
@@ -3,6 +3,6 @@
3
3
  from .quotes import QuotesClient
4
4
  from .apis import WizzerClient
5
5
 
6
- __version__ = "0.13.0"
6
+ __version__ = "0.14.0"
7
7
 
8
8
  __all__ = ["QuotesClient", "WizzerClient"]
@@ -61,11 +61,29 @@ class WizzerClient:
61
61
  SEGMENT_BSE_CM = "BSECM" # BSE Cash Market
62
62
  SEGMENT_NSE_FO = "NSEFO" # NSE Futures and Options
63
63
  SEGMENT_WZREQ = "WZREQ" # Wizzer Basket Segment
64
+
65
+ # Order status constants
66
+ ORDER_STATUS_OPEN = "OPEN"
67
+ ORDER_STATUS_CANCELLED = "CANCELLED"
68
+ ORDER_STATUS_REJECTED = "REJECTED"
69
+ ORDER_STATUS_PENDING = "PENDING"
70
+ ORDER_STATUS_COMPLETED = "COMPLETED"
71
+
72
+ # Trading mode constants
73
+ TRADING_MODE_PAPER = "paper_trading"
74
+ TRADING_MODE_ADVICES = "advices"
75
+ TRADING_MODE_TRADING_AND_ADVICES = "trading_and_advices"
76
+
77
+ # Rebalance execution policies
78
+ REBALANCE_FULL = "full_rebalance"
79
+ REBALANCE_ENTRY_ONLY = "entry_only"
80
+ REBALANCE_EXIT_ONLY = "exit_only"
64
81
 
65
82
  # URIs to various API endpoints
66
83
  _routes = {
67
84
  # Order related endpoints
68
85
  "order.place": "/orders",
86
+ "order.get": "/orders",
69
87
  "order.modify": "/orders/{order_id}",
70
88
  "order.cancel": "/orders/{order_id}",
71
89
  "order.info": "/orders/{order_id}",
@@ -241,7 +259,6 @@ class WizzerClient:
241
259
  variety: str = None,
242
260
  stoploss: float = 0,
243
261
  target: float = 0,
244
- segment: Optional[str] = None,
245
262
  exchange_token: Optional[int] = None,
246
263
  broker: str = None,
247
264
  strategy: Optional[Dict[str, str]] = None
@@ -283,16 +300,6 @@ class WizzerClient:
283
300
  if variety is None:
284
301
  variety = self.VARIETY_REGULAR
285
302
 
286
- # Determine segment if not provided
287
- if not segment:
288
- segment = f"{exchange}CM"
289
- # If exchange is NSE, use the NSE_CM constant
290
- if exchange == self.EXCHANGE_NSE:
291
- segment = self.SEGMENT_NSE_CM
292
- # If exchange is BSE, use the BSE_CM constant
293
- elif exchange == self.EXCHANGE_BSE:
294
- segment = self.SEGMENT_BSE_CM
295
-
296
303
  # Get strategy information
297
304
  strategy_info = self._get_strategy(strategy)
298
305
 
@@ -310,7 +317,6 @@ class WizzerClient:
310
317
  "variety": variety,
311
318
  "stoploss": stoploss,
312
319
  "target": target,
313
- "segment": segment,
314
320
  "strategy": strategy_info
315
321
  }
316
322
 
@@ -319,7 +325,7 @@ class WizzerClient:
319
325
  data["exchangeToken"] = exchange_token
320
326
 
321
327
  logger.debug("Placing order: %s", data)
322
- return self._make_request("POST", self._routes["order.place"], json=data)
328
+ return self._make_request("POST", endpoint, json=data)
323
329
 
324
330
  def modify_order(
325
331
  self,
@@ -355,7 +361,480 @@ class WizzerClient:
355
361
 
356
362
  logger.debug("Cancelling order: %s", order_id)
357
363
  return self._make_request("DELETE", endpoint)
358
-
364
+
365
+ def get_orders(
366
+ self,
367
+ trading_modes: Optional[List[str]] = None,
368
+ order_statuses: Optional[List[str]] = None,
369
+ from_date: Optional[str] = None,
370
+ to_date: Optional[str] = None,
371
+ trading_symbols: Optional[List[str]] = None,
372
+ page_no: int = 1,
373
+ paginate: bool = False
374
+ ) -> List[Dict[str, Any]]:
375
+ """
376
+ Get orders with optional filtering.
377
+
378
+ Args:
379
+ trading_modes (Optional[List[str]], optional): Filter by trading modes.
380
+ Valid values: "paper_trading", "advices", "trading_and_advices".
381
+ order_statuses (Optional[List[str]], optional): Filter by order statuses.
382
+ Valid values: "OPEN", "CANCELLED", "REJECTED", "PENDING", "COMPLETED".
383
+ from_date (Optional[str], optional): Start date in YYYY-MM-DD format. Defaults to today.
384
+ to_date (Optional[str], optional): End date in YYYY-MM-DD format. Defaults to today.
385
+ trading_symbols (Optional[List[str]], optional): Filter by trading symbols.
386
+ page_no (int, optional): Page number for pagination. Defaults to 1.
387
+ paginate (bool, optional): Whether to automatically fetch all pages. Defaults to False.
388
+
389
+ Returns:
390
+ List[Dict[str, Any]]: List of orders matching the filter criteria.
391
+ """
392
+ endpoint = self._routes["order.get"]
393
+
394
+ # Build the base parameters without list items
395
+ params = {}
396
+
397
+ # Handle single parameters
398
+ if from_date:
399
+ params["fromDateRange"] = from_date
400
+
401
+ if to_date:
402
+ params["toDateRange"] = to_date
403
+
404
+ if not paginate:
405
+ params["pageNo"] = page_no
406
+
407
+ # Validate trading modes
408
+ if trading_modes:
409
+ for mode in trading_modes:
410
+ if mode not in [self.TRADING_MODE_PAPER, self.TRADING_MODE_ADVICES, self.TRADING_MODE_TRADING_AND_ADVICES]:
411
+ raise ValueError(f"Invalid trading mode: {mode}")
412
+
413
+ # Validate order statuses
414
+ if order_statuses:
415
+ for status in order_statuses:
416
+ if status not in [self.ORDER_STATUS_OPEN, self.ORDER_STATUS_CANCELLED,
417
+ self.ORDER_STATUS_REJECTED, self.ORDER_STATUS_PENDING,
418
+ self.ORDER_STATUS_COMPLETED]:
419
+ raise ValueError(f"Invalid order status: {status}")
420
+
421
+ # Handle pagination with properly formatted parameters
422
+ if paginate:
423
+ return self._paginate_orders(endpoint, params, trading_modes, order_statuses, trading_symbols)
424
+ else:
425
+ logger.debug("Fetching orders with params: %s", params)
426
+ return self._make_request_with_multi_params(
427
+ "GET",
428
+ endpoint,
429
+ params=params,
430
+ trading_modes=trading_modes,
431
+ order_statuses=order_statuses,
432
+ trading_symbols=trading_symbols
433
+ )
434
+
435
+ def _make_request_with_multi_params(
436
+ self,
437
+ method: str,
438
+ endpoint: str,
439
+ params: Dict[str, Any],
440
+ trading_modes: Optional[List[str]] = None,
441
+ order_statuses: Optional[List[str]] = None,
442
+ trading_symbols: Optional[List[str]] = None
443
+ ) -> Any:
444
+ """
445
+ Make an HTTP request with multiple parameters having the same name.
446
+
447
+ Args:
448
+ method (str): HTTP method (GET, POST, etc.)
449
+ endpoint (str): API endpoint path.
450
+ params (Dict[str, Any]): Base query parameters.
451
+ trading_modes (Optional[List[str]]): List of trading modes.
452
+ order_statuses (Optional[List[str]]): List of order statuses.
453
+ trading_symbols (Optional[List[str]]): List of trading symbols.
454
+
455
+ Returns:
456
+ Any: Parsed JSON response.
457
+ """
458
+ url = f"{self.base_url}{endpoint}"
459
+
460
+ # Start with the base parameters
461
+ all_params = params.copy()
462
+
463
+ # Create a session to manually handle parameter encoding
464
+ session = requests.Session()
465
+ req = requests.Request(method, url, headers=self.headers, params=all_params)
466
+ prepped = req.prepare()
467
+
468
+ # Build the URL with additional repeated parameters
469
+ query_parts = []
470
+ if prepped.url.find('?') >= 0:
471
+ query_parts.append(prepped.url.split('?', 1)[1])
472
+
473
+ # Add repeated parameters
474
+ if trading_modes:
475
+ for mode in trading_modes:
476
+ query_parts.append(f"tradingMode={mode}")
477
+
478
+ if order_statuses:
479
+ for status in order_statuses:
480
+ query_parts.append(f"orderStatus={status}")
481
+
482
+ if trading_symbols:
483
+ for symbol in trading_symbols:
484
+ query_parts.append(f"tradingSymbols={symbol}")
485
+
486
+ # Build the final URL
487
+ final_url = prepped.url.split('?')[0]
488
+ if query_parts:
489
+ final_url += '?' + '&'.join(query_parts)
490
+
491
+ try:
492
+ logger.debug("%s request to %s", method, final_url)
493
+ response = session.send(prepped)
494
+ response.url = final_url
495
+ response.raise_for_status()
496
+ return response.json()
497
+ except requests.RequestException as e:
498
+ logger.error("API request failed: %s", e, exc_info=True)
499
+ if hasattr(e.response, 'text'):
500
+ logger.error("Response content: %s", e.response.text)
501
+ raise
502
+
503
+ def _paginate_orders(
504
+ self,
505
+ endpoint: str,
506
+ params: Dict[str, Any],
507
+ trading_modes: Optional[List[str]] = None,
508
+ order_statuses: Optional[List[str]] = None,
509
+ trading_symbols: Optional[List[str]] = None
510
+ ) -> List[Dict[str, Any]]:
511
+ """
512
+ Internal method to handle pagination for orders API with multi-value parameters.
513
+
514
+ Args:
515
+ endpoint (str): API endpoint.
516
+ params (Dict[str, Any]): Base query parameters.
517
+ trading_modes (Optional[List[str]]): List of trading modes.
518
+ order_statuses (Optional[List[str]]): List of order statuses.
519
+ trading_symbols (Optional[List[str]]): List of trading symbols.
520
+
521
+ Returns:
522
+ List[Dict[str, Any]]: Combined results from all pages.
523
+ """
524
+ all_orders = []
525
+ page_no = 1
526
+ total_count = None
527
+ page_size = 50 # API returns 50 orders per page
528
+
529
+ while True:
530
+ current_params = params.copy()
531
+ current_params["pageNo"] = page_no
532
+ logger.debug("Fetching orders page %d", page_no)
533
+
534
+ # Build the URL with the session to get the properly formatted parameters
535
+ session = requests.Session()
536
+ req = requests.Request("GET", f"{self.base_url}{endpoint}", headers=self.headers, params=current_params)
537
+ prepped = req.prepare()
538
+
539
+ # Build the URL with additional repeated parameters
540
+ query_parts = []
541
+ if prepped.url.find('?') >= 0:
542
+ query_parts.append(prepped.url.split('?', 1)[1])
543
+
544
+ # Add repeated parameters
545
+ if trading_modes:
546
+ for mode in trading_modes:
547
+ query_parts.append(f"tradingMode={mode}")
548
+
549
+ if order_statuses:
550
+ for status in order_statuses:
551
+ query_parts.append(f"orderStatus={status}")
552
+
553
+ if trading_symbols:
554
+ for symbol in trading_symbols:
555
+ query_parts.append(f"tradingSymbols={symbol}")
556
+
557
+ # Build the final URL
558
+ final_url = prepped.url.split('?')[0]
559
+ if query_parts:
560
+ final_url += '?' + '&'.join(query_parts)
561
+
562
+ # Make the request
563
+ try:
564
+ logger.debug("GET request to %s", final_url)
565
+ prepped.url = final_url
566
+ response = session.send(prepped)
567
+ response.raise_for_status()
568
+
569
+ # Get orders from the current page
570
+ orders = response.json()
571
+ all_orders.extend(orders)
572
+
573
+ # Check if we need to fetch more pages
574
+ if total_count is None and "X-Total-Count" in response.headers:
575
+ try:
576
+ total_count = int(response.headers["X-Total-Count"])
577
+ logger.debug("Total orders count: %d", total_count)
578
+ except (ValueError, TypeError):
579
+ logger.warning("Could not parse X-Total-Count header")
580
+ break
581
+
582
+ # If we've fetched all orders or there are no more pages, stop
583
+ if not orders or len(all_orders) >= total_count or total_count is None:
584
+ break
585
+
586
+ # Move to the next page
587
+ page_no += 1
588
+
589
+ except requests.RequestException as e:
590
+ logger.error("API request failed during pagination: %s", e, exc_info=True)
591
+ if hasattr(e.response, 'text'):
592
+ logger.error("Response content: %s", e.response.text)
593
+ raise
594
+
595
+ logger.info("Fetched %d orders in total", len(all_orders))
596
+ return all_orders
597
+
598
+ def get_open_orders(
599
+ self,
600
+ trading_modes: Optional[List[str]] = None,
601
+ from_date: Optional[str] = None,
602
+ to_date: Optional[str] = None,
603
+ trading_symbols: Optional[List[str]] = None,
604
+ paginate: bool = False
605
+ ) -> List[Dict[str, Any]]:
606
+ """
607
+ Get open orders with optional filtering.
608
+
609
+ Args:
610
+ trading_modes (Optional[List[str]], optional): Filter by trading modes.
611
+ from_date (Optional[str], optional): Start date in YYYY-MM-DD format.
612
+ to_date (Optional[str], optional): End date in YYYY-MM-DD format.
613
+ trading_symbols (Optional[List[str]], optional): Filter by trading symbols.
614
+ paginate (bool, optional): Whether to automatically fetch all pages.
615
+
616
+ Returns:
617
+ List[Dict[str, Any]]: List of open orders matching the filter criteria.
618
+ """
619
+ return self.get_orders(
620
+ trading_modes=trading_modes,
621
+ order_statuses=[self.ORDER_STATUS_OPEN],
622
+ from_date=from_date,
623
+ to_date=to_date,
624
+ trading_symbols=trading_symbols,
625
+ paginate=paginate
626
+ )
627
+
628
+ def get_completed_orders(
629
+ self,
630
+ trading_modes: Optional[List[str]] = None,
631
+ from_date: Optional[str] = None,
632
+ to_date: Optional[str] = None,
633
+ trading_symbols: Optional[List[str]] = None,
634
+ paginate: bool = False
635
+ ) -> List[Dict[str, Any]]:
636
+ """
637
+ Get completed orders with optional filtering.
638
+
639
+ Args:
640
+ trading_modes (Optional[List[str]], optional): Filter by trading modes.
641
+ from_date (Optional[str], optional): Start date in YYYY-MM-DD format.
642
+ to_date (Optional[str], optional): End date in YYYY-MM-DD format.
643
+ trading_symbols (Optional[List[str]], optional): Filter by trading symbols.
644
+ paginate (bool, optional): Whether to automatically fetch all pages.
645
+
646
+ Returns:
647
+ List[Dict[str, Any]]: List of completed orders matching the filter criteria.
648
+ """
649
+ return self.get_orders(
650
+ trading_modes=trading_modes,
651
+ order_statuses=[self.ORDER_STATUS_COMPLETED],
652
+ from_date=from_date,
653
+ to_date=to_date,
654
+ trading_symbols=trading_symbols,
655
+ paginate=paginate
656
+ )
657
+
658
+ def get_pending_orders(
659
+ self,
660
+ trading_modes: Optional[List[str]] = None,
661
+ from_date: Optional[str] = None,
662
+ to_date: Optional[str] = None,
663
+ trading_symbols: Optional[List[str]] = None,
664
+ paginate: bool = False
665
+ ) -> List[Dict[str, Any]]:
666
+ """
667
+ Get pending orders with optional filtering.
668
+
669
+ Args:
670
+ trading_modes (Optional[List[str]], optional): Filter by trading modes.
671
+ from_date (Optional[str], optional): Start date in YYYY-MM-DD format.
672
+ to_date (Optional[str], optional): End date in YYYY-MM-DD format.
673
+ trading_symbols (Optional[List[str]], optional): Filter by trading symbols.
674
+ paginate (bool, optional): Whether to automatically fetch all pages.
675
+
676
+ Returns:
677
+ List[Dict[str, Any]]: List of pending orders matching the filter criteria.
678
+ """
679
+ return self.get_orders(
680
+ trading_modes=trading_modes,
681
+ order_statuses=[self.ORDER_STATUS_PENDING],
682
+ from_date=from_date,
683
+ to_date=to_date,
684
+ trading_symbols=trading_symbols,
685
+ paginate=paginate
686
+ )
687
+
688
+ def get_cancelled_orders(
689
+ self,
690
+ trading_modes: Optional[List[str]] = None,
691
+ from_date: Optional[str] = None,
692
+ to_date: Optional[str] = None,
693
+ trading_symbols: Optional[List[str]] = None,
694
+ paginate: bool = False
695
+ ) -> List[Dict[str, Any]]:
696
+ """
697
+ Get cancelled orders with optional filtering.
698
+
699
+ Args:
700
+ trading_modes (Optional[List[str]], optional): Filter by trading modes.
701
+ from_date (Optional[str], optional): Start date in YYYY-MM-DD format.
702
+ to_date (Optional[str], optional): End date in YYYY-MM-DD format.
703
+ trading_symbols (Optional[List[str]], optional): Filter by trading symbols.
704
+ paginate (bool, optional): Whether to automatically fetch all pages.
705
+
706
+ Returns:
707
+ List[Dict[str, Any]]: List of cancelled orders matching the filter criteria.
708
+ """
709
+ return self.get_orders(
710
+ trading_modes=trading_modes,
711
+ order_statuses=[self.ORDER_STATUS_CANCELLED],
712
+ from_date=from_date,
713
+ to_date=to_date,
714
+ trading_symbols=trading_symbols,
715
+ paginate=paginate
716
+ )
717
+
718
+ def get_rejected_orders(
719
+ self,
720
+ trading_modes: Optional[List[str]] = None,
721
+ from_date: Optional[str] = None,
722
+ to_date: Optional[str] = None,
723
+ trading_symbols: Optional[List[str]] = None,
724
+ paginate: bool = False
725
+ ) -> List[Dict[str, Any]]:
726
+ """
727
+ Get rejected orders with optional filtering.
728
+
729
+ Args:
730
+ trading_modes (Optional[List[str]], optional): Filter by trading modes.
731
+ from_date (Optional[str], optional): Start date in YYYY-MM-DD format.
732
+ to_date (Optional[str], optional): End date in YYYY-MM-DD format.
733
+ trading_symbols (Optional[List[str]], optional): Filter by trading symbols.
734
+ paginate (bool, optional): Whether to automatically fetch all pages.
735
+
736
+ Returns:
737
+ List[Dict[str, Any]]: List of rejected orders matching the filter criteria.
738
+ """
739
+ return self.get_orders(
740
+ trading_modes=trading_modes,
741
+ order_statuses=[self.ORDER_STATUS_REJECTED],
742
+ from_date=from_date,
743
+ to_date=to_date,
744
+ trading_symbols=trading_symbols,
745
+ paginate=paginate
746
+ )
747
+
748
+ def get_paper_traded_orders(
749
+ self,
750
+ order_statuses: Optional[List[str]] = None,
751
+ from_date: Optional[str] = None,
752
+ to_date: Optional[str] = None,
753
+ trading_symbols: Optional[List[str]] = None,
754
+ paginate: bool = False
755
+ ) -> List[Dict[str, Any]]:
756
+ """
757
+ Get paper traded orders with optional filtering.
758
+
759
+ Args:
760
+ order_statuses (Optional[List[str]], optional): Filter by order statuses.
761
+ from_date (Optional[str], optional): Start date in YYYY-MM-DD format.
762
+ to_date (Optional[str], optional): End date in YYYY-MM-DD format.
763
+ trading_symbols (Optional[List[str]], optional): Filter by trading symbols.
764
+ paginate (bool, optional): Whether to automatically fetch all pages.
765
+
766
+ Returns:
767
+ List[Dict[str, Any]]: List of paper traded orders matching the filter criteria.
768
+ """
769
+ return self.get_orders(
770
+ trading_modes=[self.TRADING_MODE_PAPER],
771
+ order_statuses=order_statuses,
772
+ from_date=from_date,
773
+ to_date=to_date,
774
+ trading_symbols=trading_symbols,
775
+ paginate=paginate
776
+ )
777
+
778
+ def get_advised_orders(
779
+ self,
780
+ order_statuses: Optional[List[str]] = None,
781
+ from_date: Optional[str] = None,
782
+ to_date: Optional[str] = None,
783
+ trading_symbols: Optional[List[str]] = None,
784
+ paginate: bool = False
785
+ ) -> List[Dict[str, Any]]:
786
+ """
787
+ Get advised orders with optional filtering.
788
+
789
+ Args:
790
+ order_statuses (Optional[List[str]], optional): Filter by order statuses.
791
+ from_date (Optional[str], optional): Start date in YYYY-MM-DD format.
792
+ to_date (Optional[str], optional): End date in YYYY-MM-DD format.
793
+ trading_symbols (Optional[List[str]], optional): Filter by trading symbols.
794
+ paginate (bool, optional): Whether to automatically fetch all pages.
795
+
796
+ Returns:
797
+ List[Dict[str, Any]]: List of advised orders matching the filter criteria.
798
+ """
799
+ return self.get_orders(
800
+ trading_modes=[self.TRADING_MODE_ADVICES],
801
+ order_statuses=order_statuses,
802
+ from_date=from_date,
803
+ to_date=to_date,
804
+ trading_symbols=trading_symbols,
805
+ paginate=paginate
806
+ )
807
+
808
+ def get_live_traded_orders(
809
+ self,
810
+ order_statuses: Optional[List[str]] = None,
811
+ from_date: Optional[str] = None,
812
+ to_date: Optional[str] = None,
813
+ trading_symbols: Optional[List[str]] = None,
814
+ paginate: bool = False
815
+ ) -> List[Dict[str, Any]]:
816
+ """
817
+ Get live traded orders with optional filtering.
818
+
819
+ Args:
820
+ order_statuses (Optional[List[str]], optional): Filter by order statuses.
821
+ from_date (Optional[str], optional): Start date in YYYY-MM-DD format.
822
+ to_date (Optional[str], optional): End date in YYYY-MM-DD format.
823
+ trading_symbols (Optional[List[str]], optional): Filter by trading symbols.
824
+ paginate (bool, optional): Whether to automatically fetch all pages.
825
+
826
+ Returns:
827
+ List[Dict[str, Any]]: List of live traded orders matching the filter criteria.
828
+ """
829
+ return self.get_orders(
830
+ trading_modes=[self.TRADING_MODE_TRADING_AND_ADVICES],
831
+ order_statuses=order_statuses,
832
+ from_date=from_date,
833
+ to_date=to_date,
834
+ trading_symbols=trading_symbols,
835
+ paginate=paginate
836
+ )
837
+
359
838
  def get_order(self, order_id: str) -> Dict[str, Any]:
360
839
  """
361
840
  Get details of a specific order by ID.
@@ -682,7 +1161,8 @@ class WizzerClient:
682
1161
  def rebalance_basket(
683
1162
  self,
684
1163
  trading_symbol: str,
685
- instruments: List[str]
1164
+ instruments: List[str],
1165
+ execution_policy: str
686
1166
  ) -> Dict[str, Any]:
687
1167
  """
688
1168
  Rebalance a basket with new instruments.
@@ -690,6 +1170,8 @@ class WizzerClient:
690
1170
  Args:
691
1171
  trading_symbol (str): Basket trading symbol.
692
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".
693
1175
 
694
1176
  Returns:
695
1177
  Dict[str, Any]: Rebalance response.
@@ -698,10 +1180,14 @@ class WizzerClient:
698
1180
 
699
1181
  data = {
700
1182
  "tradingSymbol": trading_symbol,
701
- "instruments": instruments
1183
+ "instruments": instruments,
1184
+ "policies": {
1185
+ "execution": execution_policy
1186
+ }
702
1187
  }
703
1188
 
704
- logger.debug("Rebalancing basket %s with instruments: %s", trading_symbol, instruments)
1189
+ logger.debug("Rebalancing basket %s with instruments: %s, policy: %s",
1190
+ trading_symbol, instruments, execution_policy)
705
1191
  return self._make_request("POST", endpoint, json=data)
706
1192
 
707
1193
  def exit_all_positions(self) -> Dict[str, Any]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wiz_trader
3
- Version: 0.13.0
3
+ Version: 0.14.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
File without changes
File without changes
File without changes