From 9fa4bf040404b219a2ad82808ef7169d5dd3c30d Mon Sep 17 00:00:00 2001 From: Marius Grigoriu Date: Fri, 12 Apr 2024 18:38:26 -0700 Subject: [PATCH 1/7] use csv for bulk balance sheet and cash flow --- company_valuation.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/company_valuation.go b/company_valuation.go index 22e53a1..3bb9add 100644 --- a/company_valuation.go +++ b/company_valuation.go @@ -1309,7 +1309,7 @@ func (c *CompanyValuation) BulkBalanceSheetStatement(year int, period string) (s return nil, err } - err = jsoniter.Unmarshal(data.Body(), &sList) + err = gocsv.UnmarshalBytes(data.Body(), &sList) if err != nil { return nil, err } @@ -1329,7 +1329,7 @@ func (c *CompanyValuation) BulkCashFlowStatement(year int, period string) (sList return nil, err } - err = jsoniter.Unmarshal(data.Body(), &sList) + err = gocsv.UnmarshalBytes(data.Body(), &sList) if err != nil { return nil, err } From ff0225a3b327ebab6dcf90691cfbc352de0c4066 Mon Sep 17 00:00:00 2001 From: Marius Grigoriu Date: Thu, 25 Apr 2024 11:05:10 -0700 Subject: [PATCH 2/7] BalanceSheetStatement matches all fields returned by api --- objects/company_valuation.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/objects/company_valuation.go b/objects/company_valuation.go index 0043256..bd8ee10 100644 --- a/objects/company_valuation.go +++ b/objects/company_valuation.go @@ -532,11 +532,13 @@ type IncomeStatementGrowth struct { // BalanceSheetStatement ... type BalanceSheetStatement struct { - Date string `json:"date" csv:"date"` Symbol string `json:"symbol" csv:"symbol"` + Date string `json:"date" csv:"date"` ReportedCurrency string `json:"reportedCurrency" csv:"reportedCurrency"` + Cik string `json:"cik" csv:"cik"` FillingDate string `json:"fillingDate" csv:"fillingDate"` AcceptedDate string `json:"acceptedDate" csv:"acceptedDate"` + CalendarYear string `json:"calendarYear" csv:"calendarYear"` Period string `json:"period" csv:"period"` CashAndCashEquivalents float64 `json:"cashAndCashEquivalents" csv:"cashAndCashEquivalents"` ShortTermInvestments float64 `json:"shortTermInvestments" csv:"shortTermInvestments"` @@ -568,6 +570,7 @@ type BalanceSheetStatement struct { TotalNonCurrentLiabilities float64 `json:"totalNonCurrentLiabilities" csv:"totalNonCurrentLiabilities"` OtherLiabilities float64 `json:"otherLiabilities" csv:"otherLiabilities"` TotalLiabilities float64 `json:"totalLiabilities" csv:"totalLiabilities"` + PreferredStock float64 `json:"preferredStock" csv:"preferredStock"` CommonStock float64 `json:"commonStock" csv:"commonStock"` RetainedEarnings float64 `json:"retainedEarnings" csv:"retainedEarnings"` AccumulatedOtherComprehensiveIncomeLoss float64 `json:"accumulatedOtherComprehensiveIncomeLoss" csv:"accumulatedOtherComprehensiveIncomeLoss"` @@ -579,6 +582,9 @@ type BalanceSheetStatement struct { NetDebt float64 `json:"netDebt" csv:"netDebt"` Link string `json:"link" csv:"link"` FinalLink string `json:"finalLink" csv:"finalLink"` + MinorityInterest float64 `json:"minorityInterest" csv:"minorityInterest"` + CapitalLeaseObligations float64 `json:"capitalLeaseObligations" csv:"capitalLeaseObligations"` + TotalEquity float64 `json:"totalEquity" csv:"totalEquity"` } // BalanceSheetStatementGrowth ... From 4f1f9d395b76d7f5db64c3d96df6f031c7d23fbf Mon Sep 17 00:00:00 2001 From: Marius Grigoriu Date: Thu, 25 Apr 2024 11:20:42 -0700 Subject: [PATCH 3/7] InterestIncome matches what is returned by api --- objects/company_valuation.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/objects/company_valuation.go b/objects/company_valuation.go index bd8ee10..a0e8139 100644 --- a/objects/company_valuation.go +++ b/objects/company_valuation.go @@ -459,11 +459,11 @@ type ETFCountryWeighting struct { type IncomeStatement struct { Date string `json:"date" csv:"date"` Symbol string `json:"symbol" csv:"symbol"` - FillingDate string `json:"fillingDate" csv:"fillingDate"` - Cik string `json:"cik" csv:"cik"` - CalendarYear string `json:"calendarYear" csv:"calendarYear"` ReportedCurrency string `json:"reportedCurrency" csv:"reportedCurrency"` + Cik string `json:"cik" csv:"cik"` + FillingDate string `json:"fillingDate" csv:"fillingDate"` AcceptedDate string `json:"acceptedDate" csv:"acceptedDate"` + CalendarYear string `json:"calendarYear" csv:"calendarYear"` Period string `json:"period" csv:"period"` Revenue float64 `json:"revenue" csv:"revenue"` CostOfRevenue float64 `json:"costOfRevenue" csv:"costOfRevenue"` @@ -494,6 +494,7 @@ type IncomeStatement struct { WeightedAverageShsOutDil float64 `json:"weightedAverageShsOutDil" csv:"weightedAverageShsOutDil"` Link string `json:"link" csv:"link"` FinalLink string `json:"finalLink" csv:"finalLink"` + InterestIncome float64 `json:"interestIncome" csv:"interestIncome"` } // IncomeStatementGrowth ... From c47ffe007bc121a6abc443d7afbc760d2749955f Mon Sep 17 00:00:00 2001 From: Marius Grigoriu Date: Thu, 25 Apr 2024 11:55:21 -0700 Subject: [PATCH 4/7] CashFlowStatement matches what is returned by api --- objects/company_valuation.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/objects/company_valuation.go b/objects/company_valuation.go index a0e8139..62039e8 100644 --- a/objects/company_valuation.go +++ b/objects/company_valuation.go @@ -639,10 +639,12 @@ type BalanceSheetStatementGrowth struct { type CashFlowStatement struct { Date string `json:"date" csv:"date"` Symbol string `json:"symbol" csv:"symbol"` + ReportedCurrency string `json:"reportedCurrency" csv:"reportedCurrency"` + Cik string `json:"cik" csv:"cik"` FillingDate string `json:"fillingDate" csv:"fillingDate"` AcceptedDate string `json:"acceptedDate" csv:"acceptedDate"` + CalendarYear string `json:"calendarYear" csv:"calendarYear"` Period string `json:"period" csv:"period"` - ReportedCurrency string `json:"reportedCurrency" csv:"reportedCurrency"` NetIncome float64 `json:"netIncome" csv:"netIncome"` DepreciationAndAmortization float64 `json:"depreciationAndAmortization" csv:"depreciationAndAmortization"` DeferredIncomeTax float64 `json:"deferredIncomeTax" csv:"deferredIncomeTax"` From 2edacbc015d232b5df0c31ef804b8de50ebfca7b Mon Sep 17 00:00:00 2001 From: Marius Grigoriu Date: Thu, 25 Apr 2024 19:29:48 -0700 Subject: [PATCH 5/7] CalendarYear as int --- objects/company_valuation.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/objects/company_valuation.go b/objects/company_valuation.go index 62039e8..6aadbd2 100644 --- a/objects/company_valuation.go +++ b/objects/company_valuation.go @@ -463,7 +463,7 @@ type IncomeStatement struct { Cik string `json:"cik" csv:"cik"` FillingDate string `json:"fillingDate" csv:"fillingDate"` AcceptedDate string `json:"acceptedDate" csv:"acceptedDate"` - CalendarYear string `json:"calendarYear" csv:"calendarYear"` + CalendarYear int `json:"calendarYear" csv:"calendarYear"` Period string `json:"period" csv:"period"` Revenue float64 `json:"revenue" csv:"revenue"` CostOfRevenue float64 `json:"costOfRevenue" csv:"costOfRevenue"` @@ -539,7 +539,7 @@ type BalanceSheetStatement struct { Cik string `json:"cik" csv:"cik"` FillingDate string `json:"fillingDate" csv:"fillingDate"` AcceptedDate string `json:"acceptedDate" csv:"acceptedDate"` - CalendarYear string `json:"calendarYear" csv:"calendarYear"` + CalendarYear int `json:"calendarYear" csv:"calendarYear"` Period string `json:"period" csv:"period"` CashAndCashEquivalents float64 `json:"cashAndCashEquivalents" csv:"cashAndCashEquivalents"` ShortTermInvestments float64 `json:"shortTermInvestments" csv:"shortTermInvestments"` @@ -643,7 +643,7 @@ type CashFlowStatement struct { Cik string `json:"cik" csv:"cik"` FillingDate string `json:"fillingDate" csv:"fillingDate"` AcceptedDate string `json:"acceptedDate" csv:"acceptedDate"` - CalendarYear string `json:"calendarYear" csv:"calendarYear"` + CalendarYear int `json:"calendarYear" csv:"calendarYear"` Period string `json:"period" csv:"period"` NetIncome float64 `json:"netIncome" csv:"netIncome"` DepreciationAndAmortization float64 `json:"depreciationAndAmortization" csv:"depreciationAndAmortization"` From d3199e0625fa531b8959843fcb8e0b482a1beb16 Mon Sep 17 00:00:00 2001 From: Marius Grigoriu Date: Sat, 18 May 2024 17:12:11 -0700 Subject: [PATCH 6/7] calendarYear is encoded as string for v3 json endpoints --- objects/company_valuation.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/objects/company_valuation.go b/objects/company_valuation.go index 6aadbd2..98a7b66 100644 --- a/objects/company_valuation.go +++ b/objects/company_valuation.go @@ -463,7 +463,7 @@ type IncomeStatement struct { Cik string `json:"cik" csv:"cik"` FillingDate string `json:"fillingDate" csv:"fillingDate"` AcceptedDate string `json:"acceptedDate" csv:"acceptedDate"` - CalendarYear int `json:"calendarYear" csv:"calendarYear"` + CalendarYear int `json:"calendarYear,string" csv:"calendarYear"` Period string `json:"period" csv:"period"` Revenue float64 `json:"revenue" csv:"revenue"` CostOfRevenue float64 `json:"costOfRevenue" csv:"costOfRevenue"` @@ -539,7 +539,7 @@ type BalanceSheetStatement struct { Cik string `json:"cik" csv:"cik"` FillingDate string `json:"fillingDate" csv:"fillingDate"` AcceptedDate string `json:"acceptedDate" csv:"acceptedDate"` - CalendarYear int `json:"calendarYear" csv:"calendarYear"` + CalendarYear int `json:"calendarYear,string" csv:"calendarYear"` Period string `json:"period" csv:"period"` CashAndCashEquivalents float64 `json:"cashAndCashEquivalents" csv:"cashAndCashEquivalents"` ShortTermInvestments float64 `json:"shortTermInvestments" csv:"shortTermInvestments"` @@ -643,7 +643,7 @@ type CashFlowStatement struct { Cik string `json:"cik" csv:"cik"` FillingDate string `json:"fillingDate" csv:"fillingDate"` AcceptedDate string `json:"acceptedDate" csv:"acceptedDate"` - CalendarYear int `json:"calendarYear" csv:"calendarYear"` + CalendarYear int `json:"calendarYear,string" csv:"calendarYear"` Period string `json:"period" csv:"period"` NetIncome float64 `json:"netIncome" csv:"netIncome"` DepreciationAndAmortization float64 `json:"depreciationAndAmortization" csv:"depreciationAndAmortization"` From d458c5463291e517f405988adea77764e255146c Mon Sep 17 00:00:00 2001 From: Marius Grigoriu Date: Thu, 23 May 2024 14:02:35 -0700 Subject: [PATCH 7/7] fix csv fields for NetCashProvidedByOperatingActivities and SellingGeneralAndAdministrativeExpenses --- objects/company_valuation.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/objects/company_valuation.go b/objects/company_valuation.go index 98a7b66..96a5090 100644 --- a/objects/company_valuation.go +++ b/objects/company_valuation.go @@ -472,7 +472,7 @@ type IncomeStatement struct { ResearchAndDevelopmentExpenses float64 `json:"researchAndDevelopmentExpenses" csv:"ResearchAndDevelopmentExpenses"` GeneralAndAdministrativeExpenses float64 `json:"generalAndAdministrativeExpenses" csv:"GeneralAndAdministrativeExpenses"` SellingAndMarketingExpenses float64 `json:"sellingAndMarketingExpenses" csv:"SellingAndMarketingExpenses"` - SellingGeneralAndAdministrativeExpenses float64 `json:"sellingGeneralAndAdministrativeExpenses" csv:"sellingGeneralAndAdministrativeExpenses"` + SellingGeneralAndAdministrativeExpenses float64 `json:"sellingGeneralAndAdministrativeExpenses" csv:"SellingGeneralAndAdministrativeExpenses"` OtherExpenses float64 `json:"otherExpenses" csv:"otherExpenses"` OperatingExpenses float64 `json:"operatingExpenses" csv:"operatingExpenses"` CostAndExpenses float64 `json:"costAndExpenses" csv:"costAndExpenses"` @@ -655,7 +655,7 @@ type CashFlowStatement struct { AccountsPayables float64 `json:"accountsPayables" csv:"accountsPayables"` OtherWorkingCapital float64 `json:"otherWorkingCapital" csv:"otherWorkingCapital"` OtherNonCashItems float64 `json:"otherNonCashItems" csv:"otherNonCashItems"` - NetCashProvidedByOperatingActivities float64 `json:"netCashProvidedByOperatingActivities" csv:"netCashProvidedByOperatingActivities"` + NetCashProvidedByOperatingActivities float64 `json:"netCashProvidedByOperatingActivities" csv:"netCashProvidedByOperatingActivites"` InvestmentsInPropertyPlantAndEquipment float64 `json:"investmentsInPropertyPlantAndEquipment" csv:"investmentsInPropertyPlantAndEquipment"` AcquisitionsNet float64 `json:"acquisitionsNet" csv:"acquisitionsNet"` PurchasesOfInvestments float64 `json:"purchasesOfInvestments" csv:"purchasesOfInvestments"`