Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #35 from svscorp/get_investment_originators_overvi…
Browse files Browse the repository at this point in the history
…ew_feature

[FEATURE] Added "get_investment_originators_overview" API to get percentages of funds allocated in different Loan Originators
  • Loading branch information
thicccat688 authored Nov 23, 2023
2 parents c36fa6f + b1f8d99 commit 31e4eee
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Investor/portfolio data functions:
get_overview -> Gets portfolio overview (Balance, total invested, total profit, net annual return, etc.).
get_profit_overview -> Gets portfolio's profit on a daily, monthly or yearly basis (Data used in your profile's profit chart).
get_investment_status -> Gets percentage of funds in different investment statuses (Current, late by 1-15 days, 16-30 days, and 31-60 days).
get_investment_originators_overview -> Gets percentage of funds in different loan originators.

Marketplace/loan data functions:
get_loans & get_loans_page -> Gets loans available for investment in the Peerberry marketplace according to the filters you specify. get_loans_page also returns metadata.
Expand Down
7 changes: 7 additions & 0 deletions peerberrypy/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ def get_investment_status(self) -> dict:

return Utils.parse_peerberry_items(self._session.request(url=ENDPOINTS.INVESTMENTS_STATUS_URI))

def get_investment_originators_overview(self) -> dict:
"""
:return: Percentage of funds in current loan originators
"""

return Utils.parse_peerberry_originators(self._session.request(url=ENDPOINTS.INVESTMENTS_ORIGINATORS_URI))

def get_loans(
self,
quantity: int,
Expand Down
1 change: 1 addition & 0 deletions peerberrypy/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ENDPOINTS:

INVESTMENTS_STATUS_URI = f'{BASE_URI}/v2/investor/overview/investment_statuses/current'
INVESTMENTS_URI = f'{BASE_URI}/v1/investor/investments'
INVESTMENTS_ORIGINATORS_URI = f'{BASE_URI}/v1/investor/overview/originators'
INVESTMENTS_AGREEMENT_URI = f'{BASE_URI}/v1/investments'

LOANS_URI = f'{BASE_URI}/v1/loans'
Expand Down
9 changes: 9 additions & 0 deletions peerberrypy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,12 @@ def parse_peerberry_items(__obj: dict) -> dict:
parsed_obj[k] = v

return parsed_obj

@staticmethod
def parse_peerberry_originators(__obj: list) -> dict:
parsed_obj = {}

for i in __obj:
parsed_obj[i['originator']] = i

return parsed_obj

0 comments on commit 31e4eee

Please sign in to comment.