vortex-api 2.1.4__tar.gz → 2.1.6__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: vortex_api
3
- Version: 2.1.4
3
+ Version: 2.1.6
4
4
  Summary: Vortex APIs to place orders in Rupeezy application
5
5
  Author-email: "Astha Credit & Securities Pvt Ltd." <tech@rupeezy.in>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "vortex_api"
7
- version = "2.1.4"
7
+ version = "2.1.6"
8
8
  description = "Vortex APIs to place orders in Rupeezy application"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -0,0 +1 @@
1
+ __version__ = "2.1.6"
@@ -216,7 +216,16 @@ class VortexAPI:
216
216
  response = requests.request(method, url, headers=headers, json=data,params=params)
217
217
  if self.enable_logging:
218
218
  logging.debug(f"Response received from {url} , body: {response.json()}")
219
- response.raise_for_status()
219
+ if not response.ok:
220
+ try:
221
+ error_body = response.json()
222
+ error_message = error_body.get("message", response.text)
223
+ except Exception:
224
+ error_message = response.text
225
+ raise requests.exceptions.HTTPError(
226
+ f"{response.status_code} {response.reason}: {error_message}",
227
+ response=response,
228
+ )
220
229
  return response.json()
221
230
 
222
231
  def _make_unauth_request(self, method: str, endpoint: str, data: dict = None, params: dict = None) -> dict:
@@ -661,6 +670,289 @@ class VortexAPI:
661
670
 
662
671
  return False
663
672
 
673
+ def mf_holdings(self) -> dict:
674
+ """
675
+ Get the mutual fund holdings of the user.
676
+
677
+ Returns:
678
+ dict: JSON response with the following structure::
679
+
680
+ {
681
+ "status": str,
682
+ "message": str,
683
+ "data": {
684
+ "OverallConfig": {
685
+ "OverAllXirr": float,
686
+ "MarketValueAmount": float,
687
+ "InvestedAmount": float,
688
+ "Returns": float,
689
+ "ReturnsPercentage": float,
690
+ "LastImportedAt": str or None, # ISO datetime
691
+ "FundsImportStatus": str,
692
+ "OneDayReturns": float,
693
+ "OneDayReturnsPercentage": float,
694
+ "NavAsOn": str # ISO datetime
695
+ },
696
+ "IsinWiseData": {
697
+ "<ISIN>": {
698
+ "Name": str,
699
+ "MarketValueAmount": float,
700
+ "InvestedAmount": float,
701
+ "Returns": float,
702
+ "ReturnsPercentage": float,
703
+ "OneDayReturns": float,
704
+ "OneDayReturnsPercentage": float,
705
+ "IsinXirr": float,
706
+ "BseScheme": dict or None,
707
+ "CmotsScheme": dict or None,
708
+ "Folios": [
709
+ {
710
+ "xirr": float,
711
+ "client_code": str,
712
+ "dpam_id": int,
713
+ "folio_number": str,
714
+ "folio_xirr": float,
715
+ "isin": str,
716
+ "co_code": int,
717
+ "name": str,
718
+ "type": str,
719
+ "units": float,
720
+ "redeemable_units": float,
721
+ "market_value_amount": float,
722
+ "redeemable_amount": float,
723
+ "invested_amount": float,
724
+ "nav_value": float,
725
+ "buy_price": float,
726
+ "as_on": str or None,
727
+ "hold_type": str,
728
+ "is_demat": str,
729
+ "one_day_returns": float,
730
+ "one_day_returns_percentage": float
731
+ }
732
+ ]
733
+ }
734
+ }
735
+ }
736
+ }
737
+ """
738
+ endpoint = "/mf/holdings"
739
+ return self._make_api_request("GET", endpoint)
740
+
741
+ def fund_details(self, isin: str) -> dict:
742
+ """
743
+ Get details of a mutual fund scheme by ISIN.
744
+
745
+ Args:
746
+ isin (str): ISIN of the mutual fund scheme
747
+
748
+ Returns:
749
+ dict: JSON response with the following structure::
750
+
751
+ {
752
+ "status": str,
753
+ "data": {
754
+ "assetAllocation": [
755
+ {
756
+ "Isin": str,
757
+ "AssetCode": int,
758
+ "AssetName": str,
759
+ "Holding_CurrentMonth": float,
760
+ "Holding_PrevMonth": float,
761
+ "CurrentMonth": str
762
+ }
763
+ ],
764
+ "sectorAllocation": [
765
+ {
766
+ "Isin": str,
767
+ "VALUE": float,
768
+ "PERC_HOLD": float,
769
+ "SECTOR": str,
770
+ "AsOnDate": str # ISO datetime
771
+ }
772
+ ],
773
+ "holdingAllocation": [
774
+ {
775
+ "Isin": str,
776
+ "co_code": int,
777
+ "co_name": str,
778
+ "invdate": str,
779
+ "InvDate": str, # ISO datetime
780
+ "Perc_hold": float,
781
+ "MktValue": float,
782
+ "TotalShares": float,
783
+ "AssetType": str,
784
+ "rating": str
785
+ }
786
+ ],
787
+ "cmotsDetails": {
788
+ "isin": str,
789
+ "sch_name": str,
790
+ "navrs": float,
791
+ "Navdate": str,
792
+ "FundManager": str,
793
+ "SchemeAUM": float,
794
+ "EXPRATIO": float,
795
+ "riskometervalue": str,
796
+ "BenchmarkName": str,
797
+ "Category": str,
798
+ "fund_rating": int or None,
799
+ ...
800
+ },
801
+ "bseSchemeDetails": {
802
+ "ISIN": str,
803
+ "SchemeCode": str,
804
+ "SchemeName": str,
805
+ "SchemeType": str,
806
+ "SchemePlan": str,
807
+ "PurchaseAllowed": str,
808
+ "RedemptionAllowed": str,
809
+ "SIPFlag": str,
810
+ "MinimumPurchaseAmount": float,
811
+ "MinimumRedemptionQty": float,
812
+ ...
813
+ }
814
+ }
815
+ }
816
+ """
817
+ endpoint = "/mf/fund/details"
818
+ params = {"isin": isin}
819
+ return self._make_api_request("GET", endpoint, params=params)
820
+
821
+ def fund_navs(self, isin: str) -> dict:
822
+ """
823
+ Get historical NAV data for a mutual fund scheme.
824
+
825
+ Args:
826
+ isin (str): ISIN of the mutual fund scheme
827
+
828
+ Returns:
829
+ dict: JSON response with the following structure::
830
+
831
+ {
832
+ "status": str,
833
+ "data": [
834
+ {
835
+ "date": str, # ISO datetime
836
+ "value": float # NAV value
837
+ }
838
+ ]
839
+ }
840
+ """
841
+ endpoint = "/mf/fund/navs"
842
+ params = {"isin": isin}
843
+ return self._make_api_request("GET", endpoint, params=params)
844
+
845
+ def portfolio_impact(self, isin: str, amount: float) -> dict:
846
+ """
847
+ Get the portfolio impact of adding a mutual fund scheme.
848
+
849
+ Args:
850
+ isin (str): ISIN of the mutual fund scheme
851
+ amount (float): Investment amount
852
+
853
+ Returns:
854
+ dict: JSON response with the following structure::
855
+
856
+ {
857
+ "status": str,
858
+ "data": {
859
+ "New": {
860
+ "Returns": float,
861
+ "Risk": float
862
+ },
863
+ "Original": {
864
+ "Returns": float,
865
+ "Risk": float
866
+ }
867
+ }
868
+ }
869
+ """
870
+ endpoint = "/mf/fund/portfolio-impact"
871
+ params = {"isin": isin, "amount": amount}
872
+ return self._make_api_request("GET", endpoint, params=params)
873
+
874
+ def fund_overlap(self, isin: str, amount: float) -> dict:
875
+ """
876
+ Get the fund overlap analysis for a mutual fund scheme against existing holdings.
877
+
878
+ Args:
879
+ isin (str): ISIN of the mutual fund scheme
880
+ amount (float): Investment amount
881
+
882
+ Returns:
883
+ dict: JSON response with the following structure::
884
+
885
+ {
886
+ "status": str,
887
+ "data": {
888
+ "Value": float,
889
+ "Overlaps": [
890
+ {
891
+ "Isin": str,
892
+ "Holdings": [
893
+ {
894
+ "Name": str,
895
+ "Value": float
896
+ }
897
+ ]
898
+ }
899
+ ]
900
+ }
901
+ }
902
+ """
903
+ endpoint = "/mf/fund/portfolio-overlap"
904
+ params = {"isin": isin, "amount": amount}
905
+ return self._make_api_request("GET", endpoint, params=params)
906
+
907
+ def sip_book(self) -> dict:
908
+ """
909
+ Get the SIP (Systematic Investment Plan) book of the user.
910
+
911
+ Returns:
912
+ dict: JSON response with the following structure::
913
+
914
+ {
915
+ "status": str,
916
+ "data": [
917
+ {
918
+ "ID": int,
919
+ "CreatedAt": str, # ISO datetime
920
+ "UpdatedAt": str, # ISO datetime
921
+ "transactionCode": str,
922
+ "isin": str,
923
+ "amount": float,
924
+ "clientCode": str,
925
+ "schemeCode": str,
926
+ "remarks": str,
927
+ "startDate": str, # ISO datetime
928
+ "startDay": int,
929
+ "modifiedStartDate": str or None, # ISO datetime
930
+ "mandateId": str,
931
+ "state": str,
932
+ "frequency": str,
933
+ "stepUp": bool,
934
+ "stepUpFrequency": str,
935
+ "stepUpPercentage": float,
936
+ "stepUpAmount": float,
937
+ "isAmcSip": bool,
938
+ "initialInvestmentAmount": float,
939
+ "buySellType": str,
940
+ "nextInstallmentDate": str or None, # ISO datetime
941
+ "installmentNumber": int,
942
+ "schemeName": str,
943
+ "coCode": int,
944
+ "schemes_details": {
945
+ "bseSchemeDetails": dict,
946
+ "cmotsDetails": dict,
947
+ "nfoDetails": dict
948
+ }
949
+ }
950
+ ]
951
+ }
952
+ """
953
+ endpoint = "/mf/purchases/synthetic/plan"
954
+ return self._make_api_request("GET", endpoint)
955
+
664
956
  def save_backtest_result(self, stats, name: str, symbol: str = "", description: str = "", tags: list = None) -> dict:
665
957
  """
666
958
  Save backtest results to Rupeezy for viewing on the developer portal.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vortex_api
3
- Version: 2.1.4
3
+ Version: 2.1.6
4
4
  Summary: Vortex APIs to place orders in Rupeezy application
5
5
  Author-email: "Astha Credit & Securities Pvt Ltd." <tech@rupeezy.in>
6
6
  License: MIT
@@ -1 +0,0 @@
1
- __version__ = "2.1.4"
File without changes
File without changes
File without changes