재테크/기타 아이디어
미국 공시 재무제표 파이썬 SEC API로 한번에 조회하기 - US-GAAP 항목 확인
OLOGY
2025. 1. 7. 14:25
미국 공시 재무제표를 파이썬을 이용하여 조회할 수 있다. SEC 홈페이지에 들어가보면 SEC API에 대한 설명이 있는데 이를 이용할 것이다. 미국 재무제표 공시는 표준화가 되어있어서 일괄적으로 불러올 수 있게 되어있다.
https://www.sec.gov/search-filings/edgar-application-programming-interfaces
import requests
url = "https://data.sec.gov/api/xbrl/companyfacts/CIK0001490978.json"
response = requests.get(url, headers={"User-Agent": "이름 이메일주소@gmail.com"})
companyfacts_json = response.json()
위 코드를 통해 company facts를 조회할 수 있다.
companyfacts_json['facts']['us-gaap'].keys()
>>
AccountsPayableCurrent
AccountsReceivableNetCurrent
AccruedPayrollTaxesCurrent
AccumulatedDepreciationDepletionAndAmortizationPropertyPlantAndEquipment
AccumulatedOtherComprehensiveIncomeLossNetOfTax
AdditionalPaidInCapitalCommonStock
AdjustmentsToAdditionalPaidInCapitalSharebasedCompensationRequisiteServicePeriodRecognitionValue
AllocatedShareBasedCompensationExpense
AllowanceForDoubtfulAccountsReceivableCurrent
AntidilutiveSecuritiesExcludedFromComputationOfEarningsPerShareAmount
Assets
AssetsCurrent
AssetsFairValueDisclosure
CapitalExpendituresIncurredButNotYetPaid
CashAndCashEquivalentsAtCarryingValue
CashCashEquivalentsRestrictedCashAndRestrictedCashEquivalents
CashCashEquivalentsRestrictedCashAndRestrictedCashEquivalentsPeriodIncreaseDecreaseExcludingExchangeRateEffect
CashEquivalentsAtCarryingValue
CommonStockParOrStatedValuePerShare
CommonStockSharesAuthorized
CommonStockSharesIssued
CommonStockSharesOutstanding
CommonStockValue
ComprehensiveIncomeNetOfTax
ContractWithCustomerAssetNet
ContractWithCustomerLiabilityRevenueRecognized
CostOfRevenue
CurrentFederalTaxExpenseBenefit
CurrentForeignTaxExpenseBenefit
CurrentIncomeTaxExpenseBenefit
CurrentStateAndLocalTaxExpenseBenefit
DebtIssuanceCostsIncurredDuringNoncashOrPartialNoncashTransaction
DeferredRevenue
DeferredRevenueCurrent
DeferredRevenueNoncurrent
DeferredTaxAssetsGross
DeferredTaxAssetsLiabilitiesNet
DeferredTaxAssetsNet
DeferredTaxAssetsOperatingLossCarryforwards
DeferredTaxAssetsOperatingLossCarryforwardsDomestic
DeferredTaxAssetsOperatingLossCarryforwardsStateAndLocal
DeferredTaxAssetsTaxCreditCarryforwards
DeferredTaxAssetsTaxDeferredExpenseReservesAndAccrualsAccruedLiabilities
DeferredTaxAssetsValuationAllowance
DeferredTaxLiabilitiesPrepaidExpenses
DeferredTaxLiabilitiesUnrealizedGainsOnTradingSecurities
DefinedContributionPlanCostRecognized
DefinedContributionPlanEmployerMatchingContributionPercent
DefinedContributionPlanEmployerMatchingContributionPercentOfMatch
Depreciation
DepreciationDepletionAndAmortization
EarningsPerShareBasic
EarningsPerShareBasicAndDiluted
EarningsPerShareDiluted
EffectiveIncomeTaxRateContinuingOperations
EffectiveIncomeTaxRateReconciliationAtFederalStatutoryIncomeTaxRate
EffectiveIncomeTaxRateReconciliationChangeInDeferredTaxAssetsValuationAllowance
EffectiveIncomeTaxRateReconciliationNondeductibleExpenseShareBasedCompensationCost
EffectiveIncomeTaxRateReconciliationOtherAdjustments
EffectiveIncomeTaxRateReconciliationStateAndLocalIncomeTaxes
EffectiveIncomeTaxRateReconciliationTaxContingencies
EffectiveIncomeTaxRateReconciliationTaxCreditsResearch
EmployeeServiceShareBasedCompensationNonvestedAwardsTotalCompensationCostNotYetRecognizedStockOptions
EquityMethodInvestmentOwnershipPercentage
EquityMethodInvestments
FairValueAssetsLevel1ToLevel2TransfersAmount
FairValueAssetsLevel2ToLevel1TransfersAmount
FairValueAssetsMeasuredOnRecurringBasisChangeInUnrealizedGainLoss
FairValueMeasurementWithUnobservableInputsReconciliationRecurringBasisAssetTransfersIntoLevel3
FairValueMeasurementWithUnobservableInputsReconciliationRecurringBasisAssetValue
GainLossOnSaleOfPropertyPlantEquipment
GeneralAndAdministrativeExpense
GrossProfit
ImpairmentOfLongLivedAssetsHeldForUse
IncomeLossFromContinuingOperationsBeforeIncomeTaxesDomestic
IncomeLossFromContinuingOperationsBeforeIncomeTaxesExtraordinaryItemsNoncontrollingInterest
IncomeLossFromContinuingOperationsBeforeIncomeTaxesForeign
IncomeLossFromContinuingOperationsBeforeIncomeTaxesMinorityInterestAndIncomeLossFromEquityMethodInvestments
IncomeLossFromEquityMethodInvestments
IncomeTaxExpenseBenefit
IncomeTaxesPaidNet
IncomeTaxReconciliationChangeInDeferredTaxAssetsValuationAllowance
IncreaseDecreaseInAccountsPayable
IncreaseDecreaseInAccountsReceivable
IncreaseDecreaseInDeferredRevenue
IncreaseDecreaseInEmployeeRelatedLiabilities
IncreaseDecreaseInEquitySecuritiesFvNi
IncreaseDecreaseInOtherAccruedLiabilities
IncreaseDecreaseInPrepaidDeferredExpenseAndOtherAssets
InterestCostsCapitalized
InvestmentIncomeInterest
LeaseCost
LesseeOperatingLeaseLiabilityPaymentsDue
LesseeOperatingLeaseLiabilityPaymentsDueAfterYearFive
LesseeOperatingLeaseLiabilityPaymentsDueNextTwelveMonths
LesseeOperatingLeaseLiabilityPaymentsDueYearFive
LesseeOperatingLeaseLiabilityPaymentsDueYearFour
LesseeOperatingLeaseLiabilityPaymentsDueYearThree
LesseeOperatingLeaseLiabilityPaymentsDueYearTwo
LesseeOperatingLeaseLiabilityPaymentsRemainderOfFiscalYear
LesseeOperatingLeaseLiabilityUndiscountedExcessAmount
Liabilities
LiabilitiesAndStockholdersEquity
LiabilitiesCurrent
MarketableSecuritiesCurrent
MinorityInterest
NetCashProvidedByUsedInFinancingActivities
NetCashProvidedByUsedInInvestingActivities
NetCashProvidedByUsedInOperatingActivities
NetIncomeLoss
NetIncomeLossAttributableToNoncontrollingInterest
NoncashOrPartNoncashAcquisitionFixedAssetsAcquired1
NoncontrollingInterestIncreaseFromSubsidiaryEquityIssuance
NonoperatingIncomeExpense
NumberOfReportableSegments
OperatingExpenses
OperatingIncomeLoss
OperatingLeaseCost
OperatingLeaseLiability
OperatingLeaseLiabilityCurrent
OperatingLeaseLiabilityNoncurrent
OperatingLeasePayments
OperatingLeaseRightOfUseAsset
OperatingLeaseWeightedAverageDiscountRatePercent
OtherAccruedLiabilitiesCurrent
OtherAssetsNoncurrent
OtherComprehensiveIncomeUnrealizedHoldingGainLossOnSecuritiesArisingDuringPeriodNetOfTax
OtherLiabilitiesNoncurrent
PaymentsOfFinancingCosts
PaymentsToAcquireEquityMethodInvestments
PaymentsToAcquireMarketableSecurities
PaymentsToAcquirePropertyPlantAndEquipment
PreferredStockParOrStatedValuePerShare
PreferredStockSharesAuthorized
PreferredStockSharesIssued
PreferredStockSharesOutstanding
PrepaidExpenseCurrent
ProceedsFromEquityMethodInvestmentDividendsOrDistributionsReturnOfCapital
ProceedsFromIssuanceInitialPublicOffering
ProceedsFromIssuanceOfPreferredStockAndPreferenceStock
ProceedsFromMinorityShareholders
ProceedsFromSaleAndMaturityOfMarketableSecurities
ProceedsFromSaleOfEquityMethodInvestments
ProceedsFromStockOptionsExercised
ProfitLoss
PropertyPlantAndEquipmentGross
PropertyPlantAndEquipmentNet
ResearchAndDevelopmentExpense
RestrictedCashCurrent
RetainedEarningsAccumulatedDeficit
RevenueFromContractWithCustomerExcludingAssessedTax
RevenueRemainingPerformanceObligation
RevenueRemainingPerformanceObligationPercentage
RoyaltyExpense
SellingAndMarketingExpense
ShareBasedCompensation
ShareBasedCompensationArrangementByShareBasedPaymentAwardFairValueAssumptionsExpectedVolatilityRate
ShareBasedCompensationArrangementByShareBasedPaymentAwardFairValueAssumptionsRiskFreeInterestRate
ShareBasedCompensationArrangementByShareBasedPaymentAwardNumberOfSharesAvailableForGrant
ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsExercisableNumber
ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsExercisableWeightedAverageExercisePrice
ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsExercisesInPeriodTotalIntrinsicValue
ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsExpirationsInPeriod
ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsForfeituresInPeriod
ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsGrantsInPeriodGross
ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsGrantsInPeriodWeightedAverageGrantDateFairValue
ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsOutstandingIntrinsicValue
ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsOutstandingNumber
ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsOutstandingWeightedAverageExercisePrice
ShareBasedCompensationArrangementsByShareBasedPaymentAwardOptionsExercisesInPeriodWeightedAverageExercisePrice
ShareBasedCompensationArrangementsByShareBasedPaymentAwardOptionsExpirationsInPeriodWeightedAverageExercisePrice
ShareBasedCompensationArrangementsByShareBasedPaymentAwardOptionsForfeituresInPeriodWeightedAverageExercisePrice
ShareBasedCompensationArrangementsByShareBasedPaymentAwardOptionsGrantsInPeriodWeightedAverageExercisePrice
SharebasedCompensationArrangementBySharebasedPaymentAwardOptionsExercisableIntrinsicValue1
SharebasedCompensationArrangementBySharebasedPaymentAwardOptionsVestedInPeriodFairValue1
StockholdersEquity
StockholdersEquityIncludingPortionAttributableToNoncontrollingInterest
StockIssuedDuringPeriodSharesStockOptionsExercised
StockIssuedDuringPeriodValueConversionOfConvertibleSecurities
StockIssuedDuringPeriodValueNewIssues
StockIssuedDuringPeriodValueStockOptionsExercised
TemporaryEquityCarryingAmountAttributableToParent
UnrecognizedTaxBenefits
UnrecognizedTaxBenefitsDecreasesResultingFromPriorPeriodTaxPositions
UnrecognizedTaxBenefitsIncreasesResultingFromCurrentPeriodTaxPositions
UnrecognizedTaxBenefitsIncreasesResultingFromPriorPeriodTaxPositions
WeightedAverageNumberOfDilutedSharesOutstanding
WeightedAverageNumberOfShareOutstandingBasicAndDiluted
WeightedAverageNumberOfSharesOutstandingBasic
DeferredTaxAssetsDeferredIncome
BusinessCombinationRecognizedIdentifiableAssetsAcquiredAndLiabilitiesAssumedAssets
BusinessCombinationRecognizedIdentifiableAssetsAcquiredAndLiabilitiesAssumedCashAndEquivalents
BusinessCombinationRecognizedIdentifiableAssetsAcquiredAndLiabilitiesAssumedCurrentAssetsOther
BusinessCombinationRecognizedIdentifiableAssetsAcquiredAndLiabilitiesAssumedCurrentAssetsReceivables
BusinessCombinationRecognizedIdentifiableAssetsAcquiredAndLiabilitiesAssumedCurrentLiabilities
BusinessCombinationRecognizedIdentifiableAssetsAcquiredAndLiabilitiesAssumedDeferredTaxLiabilities
BusinessCombinationRecognizedIdentifiableAssetsAcquiredAndLiabilitiesAssumedIndefiniteLivedIntangibleAssets
BusinessCombinationRecognizedIdentifiableAssetsAcquiredAndLiabilitiesAssumedLiabilities
BusinessCombinationRecognizedIdentifiableAssetsAcquiredAndLiabilitiesAssumedNet
BusinessCombinationRecognizedIdentifiableAssetsAcquiredAndLiabilitiesAssumedPropertyPlantAndEquipment
FiniteLivedIntangibleAssetsNet
Goodwill
IntangibleAssetsNetExcludingGoodwill
PaymentsToAcquireBusinessesNetOfCashAcquired
GainLossOnTerminationOfLease
IncreaseDecreaseInOperatingLeaseLiability
OtherNonoperatingIncomeExpense
PreferredStockValue
ShareBasedCompensationArrangementByShareBasedPaymentAwardFairValueAssumptionsExpectedDividendRate
AmortizationOfIntangibleAssets
AvailableForSaleSecuritiesDebtSecurities
CashAndCashEquivalentsFairValueDisclosure
CashCashEquivalentsRestrictedCashAndRestrictedCashEquivalentsPeriodIncreaseDecreaseIncludingExchangeRateEffect
ContractWithCustomerLiabilityCurrent
ContractWithCustomerLiabilityNoncurrent
ConversionOfStockAmountConverted1
DeferredFederalIncomeTaxExpenseBenefit
DeferredForeignIncomeTaxExpenseBenefit
DeferredIncomeTaxExpenseBenefit
DeferredStateAndLocalIncomeTaxExpenseBenefit
EquityMethodInvestmentsFairValueDisclosure
IncreaseDecreaseInContractWithCustomerLiability
Revenues
AccruedIncomeTaxesCurrent
EquitySecuritiesFvNiRealizedGainLoss
FairValueMeasurementWithUnobservableInputsReconciliationRecurringBasisAssetGainLossIncludedInEarnings1
IncreaseDecreaseInAccruedIncomeTaxesPayable
IncrementalCommonSharesAttributableToShareBasedPaymentArrangements
FinanceLeasePrincipalPayments
DeferredTaxAssetsInProcessResearchAndDevelopment
EquitySecuritiesFvNiGainLoss
FairValueMeasurementWithUnobservableInputsReconciliationRecurringBasisAssetTransfersOutOfLevel3
FinanceLeaseRightOfUseAssetBeforeAccumulatedAmortization
LossContingencyAccrualAtCarryingValue
NoncontrollingInterestDecreaseFromDeconsolidation
PropertyPlantAndEquipmentAndFinanceLeaseRightOfUseAssetAfterAccumulatedDepreciationAndAmortization
PropertyPlantAndEquipmentAndFinanceLeaseRightOfUseAssetBeforeAccumulatedDepreciationAndAmortization
EquitySecuritiesFvNiUnrealizedGainLoss
ProceedsFromIssuanceOfCommonStock
SaleOfStockConsiderationReceivedOnTransaction
StockIssuedDuringPeriodValueRestrictedStockAwardNetOfForfeitures
진짜 엄청나게 많은데다가 가독성이 좋지 않아서 좀 어려운데
우선 대표적으로 우리가 재무제표에서 보는 항목들만 뽑아서 만들어보았다.
# Income Statement Items
income_statement = [
'Revenues', 'RevenueFromContractWithCustomerExcludingAssessedTax',
'CostOfRevenue', 'GrossProfit', 'ResearchAndDevelopmentExpense',
'SellingAndMarketingExpense', 'GeneralAndAdministrativeExpense',
'OperatingExpenses', 'OperatingIncomeLoss',
'NonoperatingIncomeExpense', 'IncomeLossFromContinuingOperationsBeforeIncomeTaxesDomestic',
'IncomeLossFromContinuingOperationsBeforeIncomeTaxesForeign',
'IncomeLossFromEquityMethodInvestments', 'IncomeTaxExpenseBenefit',
'NetIncomeLoss', 'NetIncomeLossAttributableToNoncontrollingInterest',
'ComprehensiveIncomeNetOfTax', 'EarningsPerShareBasic',
'EarningsPerShareDiluted'
]
# Balance Sheet Items
balance_sheet = [
# Assets
'Assets', 'AssetsCurrent', 'CashAndCashEquivalentsAtCarryingValue',
'MarketableSecuritiesCurrent', 'AccountsReceivableNetCurrent',
'AllowanceForDoubtfulAccountsReceivableCurrent', 'PrepaidExpenseCurrent',
'PropertyPlantAndEquipmentNet', 'IntangibleAssetsNetExcludingGoodwill',
'Goodwill', 'DeferredTaxAssetsNet', 'OtherAssetsNoncurrent',
# Liabilities
'Liabilities', 'LiabilitiesCurrent', 'AccountsPayableCurrent',
'DeferredRevenue', 'DeferredRevenueCurrent', 'DeferredRevenueNoncurrent',
'OtherAccruedLiabilitiesCurrent', 'OperatingLeaseLiabilityCurrent',
'OperatingLeaseLiabilityNoncurrent', 'DeferredTaxLiabilitiesPrepaidExpenses',
# Stockholders' Equity
'StockholdersEquity', 'AdditionalPaidInCapitalCommonStock',
'RetainedEarningsAccumulatedDeficit', 'AccumulatedOtherComprehensiveIncomeLossNetOfTax',
'CommonStockSharesIssued', 'CommonStockSharesOutstanding',
'CommonStockValue'
]
# Cash Flow Statement Items
cash_flow_statement = [
'NetCashProvidedByUsedInOperatingActivities',
'NetCashProvidedByUsedInInvestingActivities',
'NetCashProvidedByUsedInFinancingActivities',
'PaymentsToAcquirePropertyPlantAndEquipment',
'ProceedsFromSaleAndMaturityOfMarketableSecurities',
'ProceedsFromIssuanceOfCommonStock',
'IncreaseDecreaseInAccountsReceivable',
'IncreaseDecreaseInAccountsPayable',
'IncreaseDecreaseInDeferredRevenue',
'IncreaseDecreaseInPrepaidDeferredExpenseAndOtherAssets'
]