DealCloud SDK - Python
DealCloud SDK is a wrapper around the DealCloud API, designed to assist clients and partners to build on top of our platform quickly and easily.
Features
- Ease of Development: Wraps the DealCloud API with a pythonic interface. Allowing the developer to focus on requirements rather than managing HTTP requests.
- Best Practice: Built by Intapp, and implements our best practices for working with the DealCloud API.
- Fast: The DealCloud SDK manages asynchronous requests under the hood, so that larger tasks are done as quickly as possible.
Installation
pip install dealcloud-sdk
Example
Reading Data
Read from an object, filter the results and save to a file.
from dealcloud_sdk import DealCloud
# create DealCloud SDK client, using credentials from a JSON config file
dc = DealCloud.from_json("path/to/json_config_file.json", "creds.dc")
# read data from the company object into a pandas DataFrame.
data = dc.read_data("Company", resolve="name")
# filter companies on "CompanyType" to return only operating companies
data = data[data["CompanyType"] == "Operating Company"]
# save the result to a CSV file
data.to_csv('output/OpCos.csv')
Writing Data
Create a Company.
from dealcloud_sdk import DealCloud
# create DealCloud SDK client, using credentials from a JSON config file
dc = DealCloud.from_json("path/to/json_config_file.json", "creds.dc")
# define a company to create
company = [
{
"CompanyName": "Intapp Inc.",
"BusinessDescription": "Intelligence, Applied.",
}
]
# write the company to DealCloud
dc.insert_data("Company", company)
More Complex: Fetch stock price information from Yahoo finance, and write the information to a stock price object in DealCloud.
from dealcloud_sdk import DealCloud
import yfinance as yf
if __name__ == "__main__":
# create DealCloud SDK client, using credentials from a JSON config file
dc = DealCloud.from_json("path/to/json_config_file.json", "creds.dc")
# fetch the previous day's market data for a ticker from yahoo finance
ticker = "INTA"
inta = yf.Ticker(ticker)
day_info = inta.history(period="1day").reset_index()
# add the ticker to the DataFrame as a lookup value to tag a Company
day_info["Ticker"] = ticker
# rename fields to match DealCloud API Names
day_info.rename({"Stock Splicts": "StockSplits"}, axis=1, inplace=True)
"""
day_info is now a DataFrame that looks like this, all of these fields exist in DealCloud:
Date Open High Low Close Volume Dividends StockSplits Ticker
0 2024-01-03 00:00:00-05:00 36.650002 37.080002 36.139999 36.450001 307600 0.0 0.0 INTA
"""
# create the Stock Price record in DealCloud, using the "Ticker" field on the Company object as an ID
# to tag the Company record to the Stock Price Record
dc.insert_data("StockPrices", day_info, use_dealcloud_ids=False, lookup_column="Ticker")