Data Classes
Add a Data Source
To add a data source, you first need to import the data classes. The following example will import insider trading data:
from surmount.data import InsiderTrading
Next, add the data source to the data list, with a separate instance of the class for every ticker you want data for:
self.data_list = [InsiderTrading("AAPL")]
Finally, you can access the data from the data
parameter in the run function:
insider_trading_dict = data[("insider_trading", "AAPL")]
Data Classes
data.InstitutionalOwnership
Add to data list: InstitutionalOwnership("AAPL")
Data dictionary access: ("institutional_ownership", "AAPL")
Contains institutional stock ownership data in the following format:
[
{
"symbol": "AAPL",
"cik": "0000320193",
"date": "2022-12-31",
"investorsHolding": 4322,
"lastInvestorsHolding": 4189,
"investorsHoldingChange": 133,
"numberOf13Fshares": 9328570063,
"lastNumberOf13Fshares": 9185100866,
"numberOf13FsharesChange": 143469197,
"totalInvested": 1259491958234,
"lastTotalInvested": 1663982277483,
"totalInvestedChange": -404490319249,
"ownershipPercent": 57.14,
"lastOwnershipPercent": 56.2612,
"ownershipPercentChange": 0.8788,
"newPositions": 321,
"lastNewPositions": 111,
"newPositionsChange": 210,
"increasedPositions": 1527,
"lastIncreasedPositions": 1651,
"increasedPositionsChange": -124,
"closedPositions": 95,
"lastClosedPositions": 72,
"closedPositionsChange": 23,
"reducedPositions": 2240,
"lastReducedPositions": 2132,
"reducedPositionsChange": 108,
"totalCalls": 37201304688,
"lastTotalCalls": 3002662883440,
"totalCallsChange": -2965461578752,
"totalPuts": 33685223389,
"lastTotalPuts": 50897951618820,
"totalPutsChange": -50864266395431,
"putCallRatio": 0.9055,
"lastPutCallRatio": 16.9509,
"putCallRatioChange": -16.0455
}
]
data.InsiderTrading
Add to data list: InsiderTrading("AAPL")
Data dictionary access: ("insider_trading", "AAPL")
Contains insider trading data in the following format:
[
{
"symbol": "AAPL",
"filingDate": "2022-10-04 22:05:07",
"transactionDate": "2022-10-03",
"reportingCik": "0001767094",
"transactionType": "S-Sale",
"securitiesOwned": 270196,
"securitiesTransacted": 42393,
"companyCik": "0000320193",
"reportingName": "O'BRIEN DEIRDRE",
"typeOfOwner": "officer: Senior Vice President",
"link": "https://www.sec.gov/Archives/edgar/data/320193/000032019322000097/0000320193-22-000097-index.htm",
"securityName": "Common Stock",
"price": 141.09,
"formType": "4",
"acquistionOrDisposition": "D"
}
]
data.SocialSentiment
Add to data list: SocialSentiment("AAPL")
Data dictionary access: ("social_sentiment", "AAPL")
Contains social sentiment data in the following format:
[
{
"date": "2022-06-30 23:00:00",
"symbol": "AAPL",
"stocktwitsPosts": 13,
"twitterPosts": 163,
"stocktwitsComments": 9,
"twitterComments": 7769,
"stocktwitsLikes": 16,
"twitterLikes": 40957,
"stocktwitsImpressions": 15141,
"twitterImpressions": 1576854,
"stocktwitsSentiment": 0.5411,
"twitterSentiment": 0.5888
}
]
data.Dividend
Add to data list: Dividend("AAPL")
Data dictionary access: ("dividend", "AAPL")
Contains stock dividend data in the following format:
[
{
"date": "2023-02-10",
"label": "February 10, 23",
"adjDividend": 0.23,
"dividend": 0.23,
"recordDate": "2023-02-13",
"paymentDate": "2023-02-16",
"declarationDate": "2023-02-02"
}
]
data.FinancialStatement
Add to data list: FinancialStatement("AAPL")
Data dictionary access: ("financial_statement", "AAPL")
Contains financial statement data in the following format:
[
{
"date": "2022-09-24",
"symbol": "AAPL",
"reportedCurrency": "USD",
"cik": "0000320193",
"fillingDate": "2022-10-28",
"acceptedDate": "2022-10-27 18:01:14",
"calendarYear": "2022",
"period": "FY",
"revenue": 394328000000,
"costOfRevenue": 223546000000,
"grossProfit": 170782000000,
"grossProfitRatio": 0.4330963056,
"researchAndDevelopmentExpenses": 26251000000,
"generalAndAdministrativeExpenses": 0,
"sellingAndMarketingExpenses": 0,
"sellingGeneralAndAdministrativeExpenses": 25094000000,
"otherExpenses": -334000000,
"operatingExpenses": 51345000000,
"costAndExpenses": 274891000000,
"interestIncome": 2825000000,
"interestExpense": 2931000000,
"depreciationAndAmortization": 11104000000,
"ebitda": 130541000000,
"ebitdaratio": 0.3310467428,
"operatingIncome": 119437000000,
"operatingIncomeRatio": 0.302887444,
"totalOtherIncomeExpensesNet": -334000000,
"incomeBeforeTax": 119103000000,
"incomeBeforeTaxRatio": 0.3020404333,
"incomeTaxExpense": 19300000000,
"netIncome": 99803000000,
"netIncomeRatio": 0.2530964071,
"eps": 6.15,
"epsdiluted": 6.11,
"weightedAverageShsOut": 16215963000,
"weightedAverageShsOutDil": 16325819000,
"link": "https://www.sec.gov/Archives/edgar/data/320193/000032019322000108/0000320193-22-000108-index.htm",
"finalLink": "https://www.sec.gov/Archives/edgar/data/320193/000032019322000108/aapl-20220924.htm"
}
]
data.Ratios
Add to data list: Ratios("AAPL")
Data dictionary access: ("ratios", "AAPL")
Contains financial ratios data in the following format:
[
{
"symbol": "AAPL",
"date": "2023-07-01",
"calendarYear": "2023",
"period": "Q3",
"currentRatio": 0.9815625425125837,
"quickRatio": 0.8135848211070477,
"cashRatio": 0.22733129006185832,
"daysOfSalesOutstanding": 174.85836888883458,
"daysOfInventoryOutstanding": 14.57760444209413,
"operatingCycle": 57.69336663386155,
"daysOfPayablesOutstanding": 92.60774722369116,
"cashConversionCycle": -34.91438058982961,
"grossProfitMargin": 0.44516302553883397,
"operatingProfitMargin": 0.2811594557257601,
"pretaxProfitMargin": 0.2779197281073878,
"netProfitMargin": 0.24305292370135825,
"effectiveTaxRate": 0.12545638499098227,
"returnOnAssets": 0.059339537604689616,
"returnOnEquity": 0.32984371370740284,
"returnOnCapitalEmployed": 0.10947518743305962,
"netIncomePerEBT": 0.8745436150090178,
"ebtPerEbit": 0.9884772588920776,
"ebitPerRevenue": 0.2811594557257601,
"debtRatio": 0.32617195661387666,
"debtEquityRatio": 1.8130537213392175,
"longTermDebtToCapitalization": 0.6193501531466102,
"totalDebtToCapitalization": 0.6445144319803721,
"interestCoverage": 23.044088176352705,
"cashFlowToDebtRatio": 0.24139824304538798,
"companyEquityMultiplier": 5.558582473371603,
"receivablesTurnover": 2.0874036645740826,
"payablesTurnover": 0.9718409387781323,
"inventoryTurnover": 6.173853897428922,
"fixedAssetTurnover": 1.878231917336395,
"assetTurnover": 0.24414245548266167,
"operatingCashFlowPerShare": 1.6805101718006317,
"freeCashFlowPerShare": 1.5471778067673214,
"cashPerShare": 3.980350134740222,
"payoutRatio": 0.19360193149237967,
"operatingCashFlowSalesRatio": 0.3225057153685343,
"freeCashFlowOperatingCashFlowRatio": 0.9206595905989385,
"cashFlowCoverageRatios": 0.24139824304538798,
"shortTermCoverageRatios": 2.3534659648496743,
"capitalExpenditureCoverageRatio": -12.603917821309127,
"dividendPaidAndCapexCoverageRatio": 15.022779043280183,
"dividendPayoutRatio": 0.19360193149237964,
"priceBookValueRatio": 50.517075149815845,
"priceToBookRatio": 50.517075149815845,
"priceToSalesRatio": 37.224668234531826,
"priceEarningsRatio": 38.28864478119813,
"priceToFreeCashFlowsRatio": 125.37020577181208,
"priceToOperatingCashFlowsRatio": 115.4232823191812,
"priceCashFlowRatio": 115.4232823191812,
"priceEarningsToGrowthRatio": -2.2531394813551207,
"priceSalesRatio": 37.224668234531826,
"dividendYield": 0.0012640949594764,
"enterpriseValueMultiple": 135.9134788929472,
"priceFairValue": 50.517075149815845
}
]
data.ExecutiveComp
Add to data list: ExecutiveComp("AAPL")
Data dictionary access: ("executive_comp", "AAPL")
Contains executive compensation data in the following format:
[
{
"symbol": "AAPL",
"price": 178.72,
"beta": 1.286802,
"volAvg": 58405568,
"mktCap": 2794144143933,
"lastDiv": 0.96,
"range": "124.17-198.23",
"changes": -0.13,
"companyName": "Apple Inc.",
"currency": "USD",
"cik": "0000320193",
"isin": "US0378331005",
"cusip": "037833100",
"exchange": "NASDAQ Global Select",
"exchangeShortName": "NASDAQ",
"industry": "Consumer Electronics",
"website": "https://www.apple.com",
"description": "Apple Inc. designs, manufactures, and markets smartphones, personal computers, tablets, wearables, and accessories worldwide. It also sells various related services. In addition, the company offers iPhone, a line of smartphones; Mac, a line of personal computers; iPad, a line of multi-purpose tablets; AirPods Max, an over-ear wireless headphone; and wearables, home, and accessories comprising AirPods, Apple TV, Apple Watch, Beats products, HomePod, and iPod touch. Further, it provides AppleCare support services; cloud services store services; and operates various platforms, including the App Store that allow customers to discover and download applications and digital content, such as books, music, video, games, and podcasts. Additionally, the company offers various services, such as Apple Arcade, a game subscription service; Apple Music, which offers users a curated listening experience with on-demand radio stations; Apple News+, a subscription news and magazine service; Apple TV+, which offers exclusive original content; Apple Card, a co-branded credit card; and Apple Pay, a cashless payment service, as well as licenses its intellectual property. The company serves consumers, and small and mid-sized businesses; and the education, enterprise, and government markets. It distributes third-party applications for its products through the App Store. The company also sells its products through its retail and online stores, and direct sales force; and third-party cellular network carriers, wholesalers, retailers, and resellers. Apple Inc. was incorporated in 1977 and is headquartered in Cupertino, California.",
"ceo": "Mr. Timothy D. Cook",
"sector": "Technology",
"country": "US",
"fullTimeEmployees": "164000",
"phone": "408 996 1010",
"address": "One Apple Park Way",
"city": "Cupertino",
"state": "CA",
"zip": "95014",
"dcfDiff": 4.15176,
"dcf": 150.082,
"image": "https://financialmodelingprep.com/image-stock/AAPL.png",
"ipoDate": "1980-12-12",
"defaultImage": false,
"isEtf": false,
"isActivelyTrading": true,
"isAdr": false,
"isFund": false
}
]
data.SectorsPERatio
Add to data list: SectorsPERatio("NYSE")
Data dictionary access: ("sectors_pe_ratio", "NYSE")
Contains price/earnings ratios for various sectors in the following format:
[
{
"date": "2023-03-03",
"sector": "Basic Materials",
"exchange": "NYSE",
"pe": "18.33197269872979"
}
]
data.IndustriesPERatio
Add to data list: IndustriesPERatio("NYSE")
Data dictionary access: ("industries_pe_ratio", "NYSE")
Contains price/earnings ratios for various industries in the following format:
[
{
"date": "2023-03-03",
"industry": "Advertising Agencies",
"exchange": "NYSE",
"pe": "3.4058333333333337"
}
]
data.GDPAllCountries
Add to data list: GDPALLCountries()
Data dictionary access: ("gdp_by_country")
Contains GDP data in the following format:
[
{
"date": "2021-01-01",
"country": "Serbia",
"id": 13455,
"value": 63068134601.1254
}
]
data.LaborForceParticipation
Add to data list: LaborForceParticipation()
Data dictionary access: ("labor_force_participation_rate")
Contains labor force participation rate data in the following format:
[
{
"date": "2022-01-01",
"country": "Alabama",
"id": 5328,
"value": 56.4
}
]
data.HouseholdDebtToGDP
Add to data list: HouseholdDebtToGDP()
Data dictionary access: ("household_debt_to_gdp")
Contains United States household debt to GDP ratios in the following format:
[
{
"date": "2021-01-01",
"id": 65,
"value": 75.3120260740148
}
]
data.TotalDebtToEquity
Add to data list: TotalDebtToEquity()
Data dictionary access: ("total_debt_to_equity")
Contains United States total debt to equity ratios in the following format:
[
{
"date": "2022-01-01",
"id": 69,
"value": 81.2372123014568
}
]
data.HousingCPI
Add to data list: HousingCPI()
Data dictionary access: ("housing_cpi")
Contains United States housing CPI data in the following format:
[
{
"date": "2022-01-01",
"id": 661,
"value": 290.151
}
]
data.ConsumerDebtAsDisposableIncome
Add to data list: ConsumerDebtAsDisposableIncome()
Data dictionary access: ("consumer_debt_as_percent_disposable_income")
Contains consumer debt service pay as a percent of disposable income in the following format:
[
{
"date": "2021-01-01",
"id": 165,
"value": 4.845927
}
]
data.HouseholdDebtAsDisposableIncome
Add to data list: HouseholdDebtAsDisposableIncome()
Data dictionary access: ("household_debt_as_percent_disposable_income")
Contains household debt service pay as a percent of disposable income in the following format:
[
{
"date": "2022-01-01",
"id": 169,
"value": 9.534599
}
]
data.MortgageDebtAsDisposableIncome
Add to data list: MortgageDebtAsDisposableIncome()
Data dictionary access: ("mortgage_debt_as_percent_disposable_income")
Contains mortgage debt service pay as a percent of disposable income in the following format:
[
{
"date": "2022-01-01",
"id": 169,
"value": 3.898285
}
]
data.HouseholdObligationsAsDisposableIncome
Add to data list: HouseholdObligationsAsDisposableIncome()
Data dictionary access: ("household_obligations_as_percent_disposable_income")
Contains household financial obligations as a percent of disposable income in the following format:
[
{
"date": "2022-01-01",
"id": 169,
"value": 14.265082
}
]
data.OwnerOccupiedHousing
Add to data list: OwnerOccupiedHousing()
Data dictionary access: ("owner_occupied_housing")
Contains United States owner occupied housing data (in thousands of units) in the following format:
[
{
"date": "2022-01-01",
"id": 88,
"value": 83544
}
]
data.RenterOccupiedHousing
Add to data list: RenterOccupiedHousing()
Data dictionary access: ("renter_occupied_housing")
Contains United States renter occupied housing data (in thousands of units) in the following format:
[
{
"date": "2022-01-01",
"id": 88,
"value": 44230
},
]
data.VacantHousing
Add to data list: VacantHousing()
Data dictionary access: ("vacant_housing")
Contains United States vacant housing data (in thousands of units) in the following format:
[
{
"date": "2022-01-01",
"id": 88,
"value": 15166
},
]
data.VacantHousingForRent
Add to data list: VacantHousingForRent()
Data dictionary access: ("vacant_housing_for_rent")
Contains United States vacant housing available for rent data (in thousands of units) in the following format:
[
{
"date": "2022-01-01",
"id": 88,
"value": 2735
},
]
data.M1MoneyStock
Add to data list: M1MoneyStock()
Data dictionary access: ("m1_money_stock")
Contains United States M1 money supply data in the following format:
[
{
"date": "2021-02-01",
"id": 1,
"value": 18115.2
},
]
data.M1Velocity
Add to data list: M1Velocity()
Data dictionary access: ("m1_velocity")
Contains United States M1 money velocity (ratio of nominal GDP to money supply) data in the following format:
[
{
"date": "2021-10-01",
"id": 1,
"value": 1.18
},
]
data.M2MoneyStock
Add to data list: M2MoneyStock()
Data dictionary access: ("m2_money_stock")
Contains United States M2 money supply data in the following format:
[
{
"date": "2021-02-01",
"id": 1,
"value": 19411.7
},
]
data.M2Velocity
Add to data list: M2Velocity()
Data dictionary access: ("m2_velocity")
Contains United States M2 money velocity (ratio of nominal GDP to money supply) data in the following format:
[
{
"date": "2021-10-01",
"id": 1,
"value": 1.12
},
]
data.StLouisMonetaryBase
Add to data list: StLouisMonetaryBase()
Data dictionary access: ("stlouis_adjusted_monetary_base")
Contains St. Louis adjusted monetary base data in the following format:
[
{
"date": "2019-12-18",
"id": 1,
"value": 3382.8
},
]