From 9e0ab17a1d6cf930860ec64603b89ce83861f641 Mon Sep 17 00:00:00 2001 From: Artem Veremey Date: Tue, 23 Mar 2021 22:22:05 -0700 Subject: [PATCH 1/5] Adding MarketWatch unit test --- tests/data/fa_market_watch_api.yaml | 9422 ++++++++++++++++++++++++ tests/test_fa_market_watch_api_unit.py | 30 + 2 files changed, 9452 insertions(+) create mode 100644 tests/data/fa_market_watch_api.yaml create mode 100644 tests/test_fa_market_watch_api_unit.py diff --git a/tests/data/fa_market_watch_api.yaml b/tests/data/fa_market_watch_api.yaml new file mode 100644 index 00000000000..e277f6d7789 --- /dev/null +++ b/tests/data/fa_market_watch_api.yaml @@ -0,0 +1,9422 @@ +test_prepare_df_financials: + base_annual_income: + ticker: "AAPL" + statement: "income" + mock_market_watch: | + + + + AAPL | Apple Inc. Annual Income Statement | MarketWatch + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ + + + + + + +
+
+
+ + + +
+ + + +
+ + + +
+ + +
+ +
+
+ + + +
+
+ +
+
+ + + +
+ + + + +
+ +
+ +
+ + + + +
+ + + +
+ +
+
+ +
+ + + +
+
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Dow + 32,688.32 + + -42.88 + + -0.13% + + + + +
+ + S&P 500 + 3,939.63 + + -0.96 + + -0.02% + + + + +
+ + Nasdaq + 13,337.47 + + -40.07 + + -0.30% + + + + +
+ + GlobalDow + 3,794.08 + + -29.77 + + -0.78% + + + + +
+ + Gold + 1,726.70 + + -11.40 + + -0.66% + + + + +
+ + Oil + 59.14 + + -2.42 + + -3.93% + + + + +
+
+
+
+
+
+
+ + + + +
+
+
+
+ + +
+ + + +
+ + +
+ + +
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + + + +
+
+ + + +
+ + + + + + +
+
+
+ +
+
    +
    + + | +
    +
    + AAPL + U.S.: Nasdaq +
    + + + +
    +
    + +
    +
    +
    +
    +
    +

    Apple Inc.

    + +
    +
    +
    +
    + + + + +
    + AAPLUS
    Open
    Back To Top
    +
    + Last Updated: Mar 23, 2021 12:33 p.m. EDT + Real time quote +
    +
    +

    + $ + 122.85 +

    + + + -0.54 + -0.44% + +
    +
    + + + + + + + + + + + +
    Previous Close
    $123.39
    +
    +
    + + +
    +
    + +
    +
    +
    +
    +
    +
    + + + + + + +
    +
    +
    + + +
    + Advanced Charting +
    + + +
    +
      +
    • $
    • +
    • %
    • +
    • Vol
    • +
    +
    +
    +
    +
    + + + + + +
    + Volume: 46.69M + 65 Day Avg: 111.17M +
    +
    +
    + 42% vs Avg +
    +
    +
    + + + +
    + 122.54 + Day Range + 124.24 +
    +
    +
    + +
    +
    +
    + + + +
    + 58.58 + 52 Week Range + 145.09 +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + +
    + + + + + +
    +
    + +
    +
    + + + +
    +

    + Your Watchlists +

    +
    + + + + +
    +
    +
    Customize MarketWatch
    +

    Have Watchlists? Log in to see them here or sign up to get started.

    +
    +
    + Create Account + … or Log In +
    +
    + + + + +
    +
    +
    +
    + + +
    +
    + +
    + + + + + + + + + + + +
    +
    Symbol
    + Company +
    +
    Price
    + Chg/Chg % +
    + + +
    + + +
    +
    +
    +
    No Items in Watchlist
    +

    There are currently no items in this Watchlist.

    +
    + +
    +
    + +
    +
    +
    +
    No Saved Watchlists
    +

    Create a list of the investments you want to track.

    +
    + +
    +
    + + +
    +
    +
    +
    Uh oh
    +

    Something went wrong while loading Watchlist.

    +
    + +
    +
    + +
    + +
    +

    + Recently Viewed Tickers +

    +
    + +
    +
    +
    +

    No Recent Tickers

    +

    Visit a quote page and your recently viewed tickers will be displayed here.

    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + + +
    + + + + + +
    +

    Financials

    + +
    +
    + + + + + + + +
    +
    +
    +
    + + + + +
    +

    + AAPL Finanicals +

    +
    +
    + + + + +
    + + +
    + + +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    Item
    +
    Item
    +
    2016
    2017
    2018
    2019
    2020
    5-year trend
    +
    Sales/Revenue
    +
    Sales/Revenue
    +
    214.23B
    228.57B
    265.81B
    259.97B
    274.15B
    +
    Sales Growth
    +
    Sales Growth
    +
    -
    6.70%
    16.29%
    -2.20%
    5.46%
    +
    Cost of Goods Sold (COGS) incl. D&A
    +
    Cost of Goods Sold (COGS) incl. D&A
    +
    131.51B
    141.7B
    163.83B
    162.26B
    170.14B
    +
    COGS Growth
    +
    COGS Growth
    +
    -
    7.75%
    15.61%
    -0.95%
    4.86%
    +
    COGS excluding D&A
    +
    COGS excluding D&A
    +
    121.71B
    132.3B
    154.53B
    150.96B
    159.09B
    +
    Depreciation & Amortization Expense
    +
    Depreciation & Amortization Expense
    +
    9.8B
    9.4B
    9.3B
    11.3B
    11.06B
    +
    Depreciation
    +
    Depreciation
    +
    8.3B
    8.2B
    9.3B
    11.3B
    11.06B
    +
    Amortization of Intangibles
    +
    Amortization of Intangibles
    +
    1.5B
    1.2B
    -
    -
    -
    +
    Gross Income
    +
    Gross Income
    +
    82.72B
    86.87B
    101.98B
    97.7B
    104.01B
    +
    Gross Income Growth
    +
    Gross Income Growth
    +
    -
    5.02%
    17.40%
    -4.20%
    6.45%
    +
    Gross Profit Margin
    +
    Gross Profit Margin
    +
    -
    -
    -
    -
    37.94%
    +
    SG&A Expense
    +
    SG&A Expense
    +
    24.24B
    26.84B
    30.94B
    34.46B
    38.67B
    +
    SGA Growth
    +
    SGA Growth
    +
    -
    10.74%
    15.27%
    11.38%
    12.20%
    +
    Research & Development
    +
    Research & Development
    +
    10.05B
    11.58B
    14.24B
    16.22B
    18.75B
    +
    Other SG&A
    +
    Other SG&A
    +
    14.19B
    15.26B
    16.71B
    18.25B
    19.92B
    +
    Other Operating Expense
    +
    Other Operating Expense
    +
    -
    -
    -
    -
    -
    +
    Unusual Expense
    +
    Unusual Expense
    +
    (548M)
    -
    -
    -
    (465M)
    +
    EBIT after Unusual Expense
    +
    EBIT after Unusual Expense
    +
    59.03B
    -
    -
    -
    65.8B
    +
    Non Operating Income/Expense
    +
    Non Operating Income/Expense
    +
    (200M)
    1.18B
    (585M)
    1.11B
    397M
    +
    Non-Operating Interest Income
    +
    Non-Operating Interest Income
    +
    4B
    5.2B
    5.69B
    4.96B
    3.76B
    +
    Equity in Affiliates (Pretax)
    +
    Equity in Affiliates (Pretax)
    +
    -
    -
    -
    -
    -
    +
    Interest Expense
    +
    Interest Expense
    +
    1.46B
    2.32B
    3.24B
    3.58B
    2.87B
    +
    Interest Expense Growth
    +
    Interest Expense Growth
    +
    -
    59.55%
    39.47%
    10.37%
    -19.66%
    +
    Gross Interest Expense
    +
    Gross Interest Expense
    +
    1.46B
    2.32B
    3.24B
    3.58B
    2.87B
    +
    Interest Capitalized
    +
    Interest Capitalized
    +
    -
    -
    -
    -
    -
    +
    Pretax Income
    +
    Pretax Income
    +
    61.37B
    64.09B
    72.9B
    65.74B
    67.09B
    +
    Pretax Income Growth
    +
    Pretax Income Growth
    +
    -
    4.43%
    13.75%
    -9.83%
    2.06%
    +
    Pretax Margin
    +
    Pretax Margin
    +
    -
    -
    -
    -
    24.47%
    +
    Income Tax
    +
    Income Tax
    +
    15.69B
    15.74B
    13.37B
    10.48B
    9.68B
    +
    Income Tax - Current Domestic
    +
    Income Tax - Current Domestic
    +
    8.64B
    8.1B
    41.98B
    6.86B
    6.76B
    +
    Income Tax - Current Foreign
    +
    Income Tax - Current Foreign
    +
    2.11B
    1.67B
    3.99B
    3.96B
    3.13B
    +
    Income Tax - Deferred Domestic
    +
    Income Tax - Deferred Domestic
    +
    4.91B
    5.98B
    (33.77B)
    (3.01B)
    (3.6B)
    +
    Income Tax - Deferred Foreign
    +
    Income Tax - Deferred Foreign
    +
    33M
    (16M)
    1.18B
    2.67B
    3.38B
    +
    Income Tax Credits
    +
    Income Tax Credits
    +
    -
    -
    -
    -
    -
    +
    Equity in Affiliates
    +
    Equity in Affiliates
    +
    -
    -
    -
    -
    -
    +
    Other After Tax Income (Expense)
    +
    Other After Tax Income (Expense)
    +
    -
    -
    -
    -
    -
    +
    Consolidated Net Income
    +
    Consolidated Net Income
    +
    45.69B
    48.35B
    59.53B
    55.26B
    57.41B
    +
    Minority Interest Expense
    +
    Minority Interest Expense
    +
    -
    -
    -
    -
    -
    +
    Net Income
    +
    Net Income
    +
    45.69B
    48.35B
    59.53B
    55.26B
    57.41B
    +
    Net Income Growth
    +
    Net Income Growth
    +
    -
    5.83%
    23.12%
    -7.18%
    3.90%
    +
    Net Margin Growth
    +
    Net Margin Growth
    +
    -
    -
    -
    -
    20.94%
    +
    Extraordinaries & Discontinued Operations
    +
    Extraordinaries & Discontinued Operations
    +
    -
    -
    -
    -
    -
    +
    Extra Items & Gain/Loss Sale Of Assets
    +
    Extra Items & Gain/Loss Sale Of Assets
    +
    -
    -
    -
    -
    -
    +
    Cumulative Effect - Accounting Chg
    +
    Cumulative Effect - Accounting Chg
    +
    -
    -
    -
    -
    -
    +
    Discontinued Operations
    +
    Discontinued Operations
    +
    -
    -
    -
    -
    -
    +
    Net Income After Extraordinaries
    +
    Net Income After Extraordinaries
    +
    45.69B
    48.35B
    59.53B
    55.26B
    57.41B
    +
    Preferred Dividends
    +
    Preferred Dividends
    +
    -
    -
    -
    -
    -
    +
    Net Income Available to Common
    +
    Net Income Available to Common
    +
    45.69B
    48.35B
    59.53B
    55.26B
    57.41B
    +
    EPS (Basic)
    +
    EPS (Basic)
    +
    2.09
    2.32
    3
    2.99
    3.31
    +
    EPS (Basic) Growth
    +
    EPS (Basic) Growth
    +
    -
    11.02%
    29.56%
    -0.37%
    10.60%
    +
    Basic Shares Outstanding
    +
    Basic Shares Outstanding
    +
    21.88B
    20.87B
    19.82B
    18.47B
    17.35B
    +
    EPS (Diluted)
    +
    EPS (Diluted)
    +
    2.08
    2.3
    2.98
    2.97
    3.28
    +
    EPS (Diluted) Growth
    +
    EPS (Diluted) Growth
    +
    -
    10.83%
    29.32%
    -0.20%
    10.23%
    +
    Diluted Shares Outstanding
    +
    Diluted Shares Outstanding
    +
    22B
    21.01B
    20B
    18.6B
    17.53B
    +
    EBITDA
    +
    EBITDA
    +
    68.28B
    69.43B
    80.34B
    74.54B
    76.4B
    +
    EBITDA Growth
    +
    EBITDA Growth
    +
    -
    1.68%
    15.72%
    -7.22%
    2.49%
    +
    EBITDA Margin
    +
    EBITDA Margin
    +
    -
    -
    -
    -
    27.87%
    +
    +
    +
    + +
    +
    +
    + +
    + +
    +
    + +
    +
    +
    + + +
    + + + + + + + +
    + + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + +
    + +
    + + + + + + + + + + expected_result: | + ,Item,2016,2017,2018,2019,2020 + 0,Sales/Revenue,214.23B,228.57B,265.81B,259.97B,274.15B + 1,Sales Growth,-,6.70%,16.29%,-2.20%,5.46% + 2,Cost of Goods Sold (COGS) incl. D&A,131.51B,141.7B,163.83B,162.26B,170.14B + 3,COGS Growth,-,7.75%,15.61%,-0.95%,4.86% + 4,COGS excluding D&A,121.71B,132.3B,154.53B,150.96B,159.09B + 5,Depreciation & Amortization Expense,9.8B,9.4B,9.3B,11.3B,11.06B + 6,Depreciation,8.3B,8.2B,9.3B,11.3B,11.06B + 7,Amortization of Intangibles,1.5B,1.2B,-,-,- + 8,Gross Income,82.72B,86.87B,101.98B,97.7B,104.01B + 9,Gross Income Growth,-,5.02%,17.40%,-4.20%,6.45% + 10,Gross Profit Margin,-,-,-,-,37.94% + 11,SG&A Expense,24.24B,26.84B,30.94B,34.46B,38.67B + 12,SGA Growth,-,10.74%,15.27%,11.38%,12.20% + 13,Research & Development,10.05B,11.58B,14.24B,16.22B,18.75B + 14,Other SG&A,14.19B,15.26B,16.71B,18.25B,19.92B + 15,Other Operating Expense,-,-,-,-,- + 16,Unusual Expense,(548M),-,-,-,(465M) + 17,EBIT after Unusual Expense,59.03B,-,-,-,65.8B + 18,Non Operating Income/Expense,(200M),1.18B,(585M),1.11B,397M + 19,Non-Operating Interest Income,4B,5.2B,5.69B,4.96B,3.76B + 20,Equity in Affiliates (Pretax),-,-,-,-,- + 21,Interest Expense,1.46B,2.32B,3.24B,3.58B,2.87B + 22,Interest Expense Growth,-,59.55%,39.47%,10.37%,-19.66% + 23,Gross Interest Expense,1.46B,2.32B,3.24B,3.58B,2.87B + 24,Interest Capitalized,-,-,-,-,- + 25,Pretax Income,61.37B,64.09B,72.9B,65.74B,67.09B + 26,Pretax Income Growth,-,4.43%,13.75%,-9.83%,2.06% + 27,Pretax Margin,-,-,-,-,24.47% + 28,Income Tax,15.69B,15.74B,13.37B,10.48B,9.68B + 29,Income Tax - Current Domestic,8.64B,8.1B,41.98B,6.86B,6.76B + 30,Income Tax - Current Foreign,2.11B,1.67B,3.99B,3.96B,3.13B + 31,Income Tax - Deferred Domestic,4.91B,5.98B,(33.77B),(3.01B),(3.6B) + 32,Income Tax - Deferred Foreign,33M,(16M),1.18B,2.67B,3.38B + 33,Income Tax Credits,-,-,-,-,- + 34,Equity in Affiliates,-,-,-,-,- + 35,Other After Tax Income (Expense),-,-,-,-,- + 36,Consolidated Net Income,45.69B,48.35B,59.53B,55.26B,57.41B + 37,Minority Interest Expense,-,-,-,-,- + 38,Net Income,45.69B,48.35B,59.53B,55.26B,57.41B + 39,Net Income Growth,-,5.83%,23.12%,-7.18%,3.90% + 40,Net Margin Growth,-,-,-,-,20.94% + 41,Extraordinaries & Discontinued Operations,-,-,-,-,- + 42,Extra Items & Gain/Loss Sale Of Assets,-,-,-,-,- + 43,Cumulative Effect - Accounting Chg,-,-,-,-,- + 44,Discontinued Operations,-,-,-,-,- + 45,Net Income After Extraordinaries,45.69B,48.35B,59.53B,55.26B,57.41B + 46,Preferred Dividends,-,-,-,-,- + 47,Net Income Available to Common,45.69B,48.35B,59.53B,55.26B,57.41B + 48,EPS (Basic),2.09,2.32,3,2.99,3.31 + 49,EPS (Basic) Growth,-,11.02%,29.56%,-0.37%,10.60% + 50,Basic Shares Outstanding,21.88B,20.87B,19.82B,18.47B,17.35B + 51,EPS (Diluted),2.08,2.3,2.98,2.97,3.28 + 52,EPS (Diluted) Growth,-,10.83%,29.32%,-0.20%,10.23% + 53,Diluted Shares Outstanding,22B,21.01B,20B,18.6B,17.53B + 54,EBITDA,68.28B,69.43B,80.34B,74.54B,76.4B + 55,EBITDA Growth,-,1.68%,15.72%,-7.22%,2.49% + 56,EBITDA Margin,-,-,-,-,27.87% + base_annual_balance: + ticker: "AAPL" + statement: "balance" + mock_market_watch: | + + + + AAPL | Apple Inc. Annual Balance Sheet | MarketWatch + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    + + + + + + + +
    +
    +
    + + + +
    + + + +
    + + + +
    + + +
    + +
    +
    + + + +
    +
    + +
    +
    + + + +
    + + + + +
    + +
    + +
    + + + + +
    + + + +
    + +
    +
    + +
    + + + +
    +
    +
    + +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + Dow + 32,680.02 + + -51.18 + + -0.16% + + + + +
    + + S&P 500 + 3,938.99 + + -1.60 + + -0.04% + + + + +
    + + Nasdaq + 13,334.02 + + -43.53 + + -0.33% + + + + +
    + + GlobalDow + 3,792.85 + + -31.00 + + -0.81% + + + + +
    + + Gold + 1,726.60 + + -11.50 + + -0.66% + + + + +
    + + Oil + 59.17 + + -2.39 + + -3.88% + + + + +
    +
    +
    +
    +
    +
    +
    + + + + +
    +
    +
    +
    + + +
    + + + +
    + + +
    + + +
    + + +
    +
    + +
    +
    + + +
    +
    + +
    +
    + + +
    +
    + +
    +
    + + +
    +
    + +
    +
    + + + + +
    +
    + + + +
    + + + + + + +
    +
    +
    + +
    +
      +
      + + | +
      +
      + AAPL + U.S.: Nasdaq +
      + + + +
      +
      + +
      +
      +
      +
      +
      +

      Apple Inc.

      + +
      +
      +
      +
      + + + + +
      + AAPLUS
      Open
      Back To Top
      +
      + Last Updated: Mar 23, 2021 12:35 p.m. EDT + Real time quote +
      +
      +

      + $ + 122.77 +

      + + + -0.62 + -0.50% + +
      +
      + + + + + + + + + + + +
      Previous Close
      $123.39
      +
      +
      + + +
      +
      + +
      +
      +
      +
      +
      +
      + + + + + + +
      +
      +
      + + +
      + Advanced Charting +
      + + +
      +
        +
      • $
      • +
      • %
      • +
      • Vol
      • +
      +
      +
      +
      +
      + + + + + +
      + Volume: 47.18M + 65 Day Avg: 111.17M +
      +
      +
      + 42% vs Avg +
      +
      +
      + + + +
      + 122.54 + Day Range + 124.24 +
      +
      +
      + +
      +
      +
      + + + +
      + 58.58 + 52 Week Range + 145.09 +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      + + +
      + + + + + +
      +
      + +
      +
      + + + +
      +

      + Your Watchlists +

      +
      + + + + +
      +
      +
      Customize MarketWatch
      +

      Have Watchlists? Log in to see them here or sign up to get started.

      +
      +
      + Create Account + … or Log In +
      +
      + + + + +
      +
      +
      +
      + + +
      +
      + +
      + + + + + + + + + + + +
      +
      Symbol
      + Company +
      +
      Price
      + Chg/Chg % +
      + + +
      + + +
      +
      +
      +
      No Items in Watchlist
      +

      There are currently no items in this Watchlist.

      +
      + +
      +
      + +
      +
      +
      +
      No Saved Watchlists
      +

      Create a list of the investments you want to track.

      +
      + +
      +
      + + +
      +
      +
      +
      Uh oh
      +

      Something went wrong while loading Watchlist.

      +
      + +
      +
      + +
      + +
      +

      + Recently Viewed Tickers +

      +
      + +
      +
      +
      +

      No Recent Tickers

      +

      Visit a quote page and your recently viewed tickers will be displayed here.

      +
      +
      + +
      +
      +
      +
      + +
      +
      +
      +
      + + +
      + + + + + +
      +

      Financials

      + +
      +
      + + + + + + + +
      +
      +
      +
      + + + + +
      +

      + AAPL Finanicals +

      +
      +
      + + + + +
      + + +
      + + +
      +
      +

      + Assets +

      + Fiscal year is October-September. All values USD. +
      +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      Item
      +
      Item
      +
      2016
      2017
      2018
      2019
      2020
      5-year trend
      +
      Cash & Short Term Investments
      +
      Cash & Short Term Investments
      +
      67.16B
      74.18B
      66.3B
      100.58B
      90.98B
      +
      Cash & Short Term Investments Growth
      +
      Cash & Short Term Investments Growth
      +
      -
      10.46%
      -10.62%
      51.70%
      -9.55%
      +
      Cash Only
      +
      Cash Only
      +
      12.27B
      14.52B
      19.66B
      28.12B
      19.98B
      +
      Short-Term Investments
      +
      Short-Term Investments
      +
      54.89B
      59.67B
      46.64B
      72.46B
      71B
      +
      Cash & ST Investments / Total Assets
      +
      Cash & ST Investments / Total Assets
      +
      20.88%
      19.76%
      18.13%
      29.71%
      28.09%
      +
      Total Accounts Receivable
      +
      Total Accounts Receivable
      +
      29.3B
      35.67B
      49B
      45.8B
      37.45B
      +
      Total Accounts Receivable Growth
      +
      Total Accounts Receivable Growth
      +
      -
      21.76%
      37.34%
      -6.51%
      -18.25%
      +
      Accounts Receivables, Net
      +
      Accounts Receivables, Net
      +
      15.75B
      17.87B
      23.19B
      22.93B
      16.12B
      +
      Accounts Receivables, Gross
      +
      Accounts Receivables, Gross
      +
      15.81B
      17.93B
      23.19B
      22.93B
      16.12B
      +
      Bad Debt/Doubtful Accounts
      +
      Bad Debt/Doubtful Accounts
      +
      (53M)
      (58M)
      -
      -
      -
      +
      Other Receivable
      +
      Other Receivable
      +
      13.55B
      17.8B
      25.81B
      22.88B
      21.33B
      +
      Accounts Receivable Turnover
      +
      Accounts Receivable Turnover
      +
      7.31
      6.41
      5.43
      5.68
      7.32
      +
      Inventories
      +
      Inventories
      +
      2.13B
      4.86B
      3.96B
      4.11B
      4.06B
      +
      Finished Goods
      +
      Finished Goods
      +
      2.13B
      4.86B
      3.96B
      4.11B
      4.06B
      +
      Work in Progress
      +
      Work in Progress
      +
      -
      -
      -
      -
      -
      +
      Raw Materials
      +
      Raw Materials
      +
      -
      -
      -
      -
      -
      +
      Progress Payments & Other
      +
      Progress Payments & Other
      +
      -
      -
      -
      -
      -
      +
      Other Current Assets
      +
      Other Current Assets
      +
      8.28B
      13.94B
      12.09B
      12.33B
      11.23B
      +
      Miscellaneous Current Assets
      +
      Miscellaneous Current Assets
      +
      8.28B
      13.94B
      12.09B
      12.33B
      11.23B
      +
      Total Current Assets
      +
      Total Current Assets
      +
      106.87B
      128.65B
      131.34B
      162.82B
      143.71B
      +
      Net Property, Plant & Equipment
      +
      Net Property, Plant & Equipment
      +
      27.01B
      33.78B
      41.3B
      37.38B
      45.34B
      +
      Property, Plant & Equipment - Gross
      +
      Property, Plant & Equipment - Gross
      +
      61.25B
      75.08B
      90.4B
      95.96B
      112.1B
      +
      Buildings
      +
      Buildings
      +
      10.19B
      13.59B
      16.22B
      17.09B
      17.95B
      +
      Land & Improvements
      +
      Land & Improvements
      +
      -
      -
      -
      -
      -
      +
      Computer Software and Equipment
      +
      Computer Software and Equipment
      +
      -
      -
      -
      -
      -
      +
      Other Property, Plant & Equipment
      +
      Other Property, Plant & Equipment
      +
      6.52B
      7.28B
      8.21B
      9.08B
      10.28B
      +
      Accumulated Depreciation
      +
      Accumulated Depreciation
      +
      34.24B
      41.29B
      49.1B
      58.58B
      66.76B
      +
      Total Investments and Advances
      +
      Total Investments and Advances
      +
      170.43B
      194.71B
      170.8B
      106.7B
      102.62B
      +
      Other Long-Term Investments
      +
      Other Long-Term Investments
      +
      170.43B
      194.71B
      170.8B
      106.7B
      102.62B
      +
      Long-Term Note Receivables
      +
      Long-Term Note Receivables
      +
      -
      -
      -
      -
      -
      +
      Intangible Assets
      +
      Intangible Assets
      +
      8.62B
      8.02B
      -
      -
      -
      +
      Net Goodwill
      +
      Net Goodwill
      +
      5.41B
      5.72B
      -
      -
      -
      +
      Net Other Intangibles
      +
      Net Other Intangibles
      +
      3.21B
      2.3B
      -
      -
      -
      +
      Other Assets
      +
      Other Assets
      +
      8.76B
      10.16B
      22.28B
      31.62B
      32.22B
      +
      Total Assets
      +
      Total Assets
      +
      321.69B
      375.32B
      365.73B
      338.52B
      323.89B
      +
      Total Assets Growth
      +
      Total Assets Growth
      +
      -
      16.67%
      -2.56%
      -7.44%
      -4.32%
      +
      +
      +
      +
      +
      +

      + Liabilities & Shareholders' Equity +

      + All values USD. +
      +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      Item
      +
      Item
      +
      2016
      2017
      2018
      2019
      2020
      5-year trend
      +
      ST Debt & Current Portion LT Debt
      +
      ST Debt & Current Portion LT Debt
      +
      11.61B
      18.47B
      20.75B
      16.24B
      15.23B
      +
      Short Term Debt
      +
      Short Term Debt
      +
      8.11B
      11.98B
      11.96B
      5.98B
      6.43B
      +
      Current Portion of Long Term Debt
      +
      Current Portion of Long Term Debt
      +
      3.5B
      6.5B
      8.78B
      10.26B
      8.8B
      +
      Accounts Payable
      +
      Accounts Payable
      +
      37.29B
      49.05B
      55.89B
      46.24B
      42.3B
      +
      Accounts Payable Growth
      +
      Accounts Payable Growth
      +
      -
      31.52%
      13.94%
      -17.27%
      -8.52%
      +
      Income Tax Payable
      +
      Income Tax Payable
      +
      -
      -
      -
      -
      -
      +
      Other Current Liabilities
      +
      Other Current Liabilities
      +
      30.11B
      33.29B
      40.23B
      43.24B
      47.87B
      +
      Dividends Payable
      +
      Dividends Payable
      +
      -
      -
      -
      -
      -
      +
      Accrued Payroll
      +
      Accrued Payroll
      +
      -
      -
      -
      -
      -
      +
      Miscellaneous Current Liabilities
      +
      Miscellaneous Current Liabilities
      +
      30.11B
      33.29B
      40.23B
      43.24B
      47.87B
      +
      Total Current Liabilities
      +
      Total Current Liabilities
      +
      79.01B
      100.81B
      116.87B
      105.72B
      105.39B
      +
      Long-Term Debt
      +
      Long-Term Debt
      +
      75.43B
      97.21B
      93.74B
      91.81B
      107.05B
      +
      Long-Term Debt excl. Capitalized Leases
      +
      Long-Term Debt excl. Capitalized Leases
      +
      75.43B
      97.21B
      93.74B
      91.81B
      98.67B
      +
      Non-Convertible Debt
      +
      Non-Convertible Debt
      +
      75.43B
      97.21B
      93.74B
      91.81B
      98.67B
      +
      Convertible Debt
      +
      Convertible Debt
      +
      -
      -
      -
      -
      -
      +
      Capitalized Lease Obligations
      +
      Capitalized Lease Obligations
      +
      -
      -
      -
      -
      637M
      +
      Provision for Risks & Charges
      +
      Provision for Risks & Charges
      +
      -
      -
      33.59B
      29.55B
      28.17B
      +
      Deferred Taxes
      +
      Deferred Taxes
      +
      34.72B
      39.91B
      11.52B
      16.92B
      -
      +
      Deferred Taxes - Credits
      +
      Deferred Taxes - Credits
      +
      34.72B
      39.91B
      11.52B
      16.92B
      -
      +
      Deferred Taxes - Debit
      +
      Deferred Taxes - Debit
      +
      -
      -
      -
      -
      -
      +
      Other Liabilities
      +
      Other Liabilities
      +
      4.29B
      3.34B
      2.87B
      4.04B
      17.94B
      +
      Other Liabilities (excl. Deferred Income)
      +
      Other Liabilities (excl. Deferred Income)
      +
      1.36B
      504M
      71M
      4.04B
      17.94B
      +
      Deferred Income
      +
      Deferred Income
      +
      2.93B
      2.84B
      2.8B
      -
      -
      +
      Total Liabilities
      +
      Total Liabilities
      +
      193.44B
      241.27B
      258.58B
      248.03B
      258.55B
      +
      Non-Equity Reserves
      +
      Non-Equity Reserves
      +
      -
      -
      -
      -
      -
      +
      Total Liabilities / Total Assets
      +
      Total Liabilities / Total Assets
      +
      60.13%
      64.28%
      70.70%
      73.27%
      79.83%
      +
      Preferred Stock (Carrying Value)
      +
      Preferred Stock (Carrying Value)
      +
      -
      -
      -
      -
      -
      +
      Redeemable Preferred Stock
      +
      Redeemable Preferred Stock
      +
      -
      -
      -
      -
      -
      +
      Non-Redeemable Preferred Stock
      +
      Non-Redeemable Preferred Stock
      +
      -
      -
      -
      -
      -
      +
      Common Equity (Total)
      +
      Common Equity (Total)
      +
      128.25B
      134.05B
      107.15B
      90.49B
      65.34B
      +
      Common Equity / Total Assets
      +
      Common Equity / Total Assets
      +
      39.87%
      35.72%
      29.30%
      26.73%
      20.17%
      +
      Common Stock Par/Carry Value
      +
      Common Stock Par/Carry Value
      +
      31.25B
      35.87B
      40.2B
      45.17B
      50.78B
      +
      Retained Earnings
      +
      Retained Earnings
      +
      96.36B
      98.33B
      70.4B
      45.9B
      14.97B
      +
      ESOP Debt Guarantee
      +
      ESOP Debt Guarantee
      +
      -
      -
      -
      -
      -
      +
      Cumulative Translation Adjustment/Unrealized For. Exch. Gain
      +
      Cumulative Translation Adjustment/Unrealized For. Exch. Gain
      +
      (578M)
      (354M)
      (1.06B)
      (1.46B)
      (1.38B)
      +
      Unrealized Gain/Loss Marketable Securities
      +
      Unrealized Gain/Loss Marketable Securities
      +
      1.17B
      328M
      (3.21B)
      707M
      1.85B
      +
      Revaluation Reserves
      +
      Revaluation Reserves
      +
      -
      -
      -
      -
      -
      +
      Treasury Stock
      +
      Treasury Stock
      +
      -
      -
      -
      -
      -
      +
      Total Shareholders' Equity
      +
      Total Shareholders' Equity
      +
      128.25B
      134.05B
      107.15B
      90.49B
      65.34B
      +
      Total Shareholders' Equity / Total Assets
      +
      Total Shareholders' Equity / Total Assets
      +
      39.87%
      35.72%
      29.30%
      26.73%
      20.17%
      +
      Accumulated Minority Interest
      +
      Accumulated Minority Interest
      +
      -
      -
      -
      -
      -
      +
      Total Equity
      +
      Total Equity
      +
      128.25B
      134.05B
      107.15B
      90.49B
      65.34B
      +
      Liabilities & Shareholders' Equity
      +
      Liabilities & Shareholders' Equity
      +
      321.69B
      375.32B
      365.73B
      338.52B
      323.89B
      +
      +
      +
      + +
      +
      +
      + +
      + +
      +
      + +
      +
      +
      + + +
      + + + + + + + +
      + + +
      +
      + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + +
      + + +
      + +
      + + + + + + + + + + expected_result: | + ,Item,2016,2017,2018,2019,2020 + 0,Cash & Short Term Investments,67.16B,74.18B,66.3B,100.58B,90.98B + 1,Cash & Short Term Investments Growth,-,10.46%,-10.62%,51.70%,-9.55% + 2,Cash Only,12.27B,14.52B,19.66B,28.12B,19.98B + 3,Short-Term Investments,54.89B,59.67B,46.64B,72.46B,71B + 4,Cash & ST Investments / Total Assets,20.88%,19.76%,18.13%,29.71%,28.09% + 5,Total Accounts Receivable,29.3B,35.67B,49B,45.8B,37.45B + 6,Total Accounts Receivable Growth,-,21.76%,37.34%,-6.51%,-18.25% + 7,"Accounts Receivables, Net",15.75B,17.87B,23.19B,22.93B,16.12B + 8,"Accounts Receivables, Gross",15.81B,17.93B,23.19B,22.93B,16.12B + 9,Bad Debt/Doubtful Accounts,(53M),(58M),-,-,- + 10,Other Receivable,13.55B,17.8B,25.81B,22.88B,21.33B + 11,Accounts Receivable Turnover,7.31,6.41,5.43,5.68,7.32 + 12,Inventories,2.13B,4.86B,3.96B,4.11B,4.06B + 13,Finished Goods,2.13B,4.86B,3.96B,4.11B,4.06B + 14,Work in Progress,-,-,-,-,- + 15,Raw Materials,-,-,-,-,- + 16,Progress Payments & Other,-,-,-,-,- + 17,Other Current Assets,8.28B,13.94B,12.09B,12.33B,11.23B + 18,Miscellaneous Current Assets,8.28B,13.94B,12.09B,12.33B,11.23B + 19,Total Current Assets,106.87B,128.65B,131.34B,162.82B,143.71B + 20,"Net Property, Plant & Equipment",27.01B,33.78B,41.3B,37.38B,45.34B + 21,"Property, Plant & Equipment - Gross",61.25B,75.08B,90.4B,95.96B,112.1B + 22,Buildings,10.19B,13.59B,16.22B,17.09B,17.95B + 23,Land & Improvements,-,-,-,-,- + 24,Computer Software and Equipment,-,-,-,-,- + 25,"Other Property, Plant & Equipment",6.52B,7.28B,8.21B,9.08B,10.28B + 26,Accumulated Depreciation,34.24B,41.29B,49.1B,58.58B,66.76B + 27,Total Investments and Advances,170.43B,194.71B,170.8B,106.7B,102.62B + 28,Other Long-Term Investments,170.43B,194.71B,170.8B,106.7B,102.62B + 29,Long-Term Note Receivables,-,-,-,-,- + 30,Intangible Assets,8.62B,8.02B,-,-,- + 31,Net Goodwill,5.41B,5.72B,-,-,- + 32,Net Other Intangibles,3.21B,2.3B,-,-,- + 33,Other Assets,8.76B,10.16B,22.28B,31.62B,32.22B + 34,Total Assets,321.69B,375.32B,365.73B,338.52B,323.89B + 35,Total Assets Growth,-,16.67%,-2.56%,-7.44%,-4.32% + base_annual_cashflow: + ticker: "AAPL" + statement: "cashflow" + mock_market_watch: | + + + + + + + AAPL | Apple Inc. Annual Cash Flow Statement | MarketWatch + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      + +
      + + + + + + + +
      +
      +
      + + + +
      + + + +
      + + + +
      + + +
      + +
      +
      + + + +
      +
      + +
      +
      + + + +
      + + + + +
      + +
      + +
      + + + + +
      + + + +
      + +
      +
      + +
      + + + +
      +
      +
      + +
      + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + Dow + 32,426.94 + + -304.26 + + -0.93% + + + + +
      + + S&P 500 + 3,909.77 + + -30.82 + + -0.78% + + + + +
      + + Nasdaq + 13,229.64 + + -147.90 + + -1.11% + + + + +
      + + GlobalDow + 3,773.15 + + -50.70 + + -1.33% + + + + +
      + + Gold + 1,725.30 + + -12.80 + + -0.74% + + + + +
      + + Oil + 57.71 + + -3.85 + + -6.25% + + + + +
      +
      +
      +
      +
      +
      +
      + + + + +
      +
      +
      +
      + + +
      + + + +
      + + +
      + + +
      + + +
      +
      + +
      +
      + + +
      +
      + +
      +
      + + +
      +
      + +
      +
      + + +
      +
      + +
      +
      + + + + +
      +
      + + + +
      + + + + + + +
      +
      +
      + +
      +
        +
        + + | +
        +
        + AAPL + U.S.: Nasdaq +
        + + + +
        +
        + +
        +
        +
        +
        +
        +

        Apple Inc.

        + +
        +
        +
        +
        + + + + +
        + AAPLUS
        Open
        Back To Top
        +
        + Last Updated: Mar 23, 2021 3:23 p.m. EDT + Real time quote +
        +
        +

        + $ + 122.68 +

        + + + -0.71 + -0.58% + +
        +
        + + + + + + + + + + + +
        Previous Close
        $123.39
        +
        +
        + + +
        +
        + +
        +
        +
        +
        +
        +
        + + + + + + +
        +
        +
        + + +
        + Advanced Charting +
        + + +
        +
          +
        • $
        • +
        • %
        • +
        • Vol
        • +
        +
        +
        +
        +
        + + + + + +
        + Volume: 73.66M + 65 Day Avg: 111.17M +
        +
        +
        + 66% vs Avg +
        +
        +
        + + + +
        + 122.35 + Day Range + 124.24 +
        +
        +
        + +
        +
        +
        + + + +
        + 58.58 + 52 Week Range + 145.09 +
        +
        +
        +
        +
        +
        +
        +
        +
        +
        + + +
        + + + + + +
        +
        + +
        +
        + + + +
        +

        + Your Watchlists +

        +
        + + + + +
        +
        +
        Customize MarketWatch
        +

        Have Watchlists? Log in to see them here or sign up to get started.

        +
        +
        + Create Account + … or Log In +
        +
        + + + + +
        +
        +
        +
        + + +
        +
        + +
        + + + + + + + + + + + +
        +
        Symbol
        + Company +
        +
        Price
        + Chg/Chg % +
        + + +
        + + +
        +
        +
        +
        No Items in Watchlist
        +

        There are currently no items in this Watchlist.

        +
        + +
        +
        + +
        +
        +
        +
        No Saved Watchlists
        +

        Create a list of the investments you want to track.

        +
        + +
        +
        + + +
        +
        +
        +
        Uh oh
        +

        Something went wrong while loading Watchlist.

        +
        + +
        +
        + +
        + +
        +

        + Recently Viewed Tickers +

        +
        + +
        +
        +
        +

        No Recent Tickers

        +

        Visit a quote page and your recently viewed tickers will be displayed here.

        +
        +
        + +
        +
        +
        +
        + +
        +
        +
        +
        + + +
        + + + + + +
        +

        Financials

        + +
        +
        + + + + + + + +
        +
        +
        +
        + + + + +
        +

        + AAPL Finanicals +

        +
        +
        + + + + +
        + + +
        + + +
        +
        +

        + Operating Activities +

        + Fiscal year is October-September. All values USD. +
        +
        +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        +
        Item
        +
        Item
        +
        2016
        2017
        2018
        2019
        2020
        5-year trend
        +
        Net Income before Extraordinaries
        +
        Net Income before Extraordinaries
        +
        45.69B
        48.35B
        59.53B
        55.26B
        57.41B
        +
        Net Income Growth
        +
        Net Income Growth
        +
        -
        5.83%
        23.12%
        -7.18%
        3.90%
        +
        Depreciation, Depletion & Amortization
        +
        Depreciation, Depletion & Amortization
        +
        10.51B
        10.16B
        10.9B
        12.55B
        11.06B
        +
        Depreciation and Depletion
        +
        Depreciation and Depletion
        +
        -
        -
        10.9B
        12.55B
        11.06B
        +
        Amortization of Intangible Assets
        +
        Amortization of Intangible Assets
        +
        -
        -
        -
        -
        -
        +
        Deferred Taxes & Investment Tax Credit
        +
        Deferred Taxes & Investment Tax Credit
        +
        4.94B
        5.97B
        (32.59B)
        (340M)
        (215M)
        +
        Deferred Taxes
        +
        Deferred Taxes
        +
        4.94B
        5.97B
        (32.59B)
        (340M)
        (215M)
        +
        Investment Tax Credit
        +
        Investment Tax Credit
        +
        -
        -
        -
        -
        -
        +
        Other Funds
        +
        Other Funds
        +
        4.21B
        4.67B
        4.9B
        5.42B
        6.73B
        +
        Funds from Operations
        +
        Funds from Operations
        +
        65.34B
        69.15B
        42.74B
        72.88B
        74.98B
        +
        Extraordinaries
        +
        Extraordinaries
        +
        -
        -
        -
        -
        -
        +
        Changes in Working Capital
        +
        Changes in Working Capital
        +
        484M
        (5.55B)
        34.69B
        (3.49B)
        5.69B
        +
        Receivables
        +
        Receivables
        +
        1.04B
        (6.35B)
        (13.33B)
        3.18B
        8.47B
        +
        Accounts Payable
        +
        Accounts Payable
        +
        1.79B
        9.62B
        9.18B
        (1.92B)
        (4.06B)
        +
        Other Assets/Liabilities
        +
        Other Assets/Liabilities
        +
        (2.57B)
        (6.1B)
        38.02B
        (4.45B)
        1.41B
        +
        Net Operating Cash Flow
        +
        Net Operating Cash Flow
        +
        65.82B
        63.6B
        77.43B
        69.39B
        80.67B
        +
        Net Operating Cash Flow Growth
        +
        Net Operating Cash Flow Growth
        +
        -
        -3.38%
        21.76%
        -10.39%
        16.26%
        +
        Net Operating Cash Flow / Sales
        +
        Net Operating Cash Flow / Sales
        +
        30.73%
        27.82%
        29.13%
        26.69%
        29.43%
        +
        +
        +
        +
        +
        +

        + Investing Activities +

        + All values USD. +
        +
        +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        +
        Item
        +
        Item
        +
        2016
        2017
        2018
        2019
        2020
        5-year trend
        +
        Capital Expenditures
        +
        Capital Expenditures
        +
        (13.55B)
        (12.8B)
        (13.31B)
        (10.5B)
        (7.31B)
        +
        Capital Expenditures Growth
        +
        Capital Expenditures Growth
        +
        -
        5.56%
        -4.05%
        21.17%
        30.36%
        +
        Capital Expenditures / Sales
        +
        Capital Expenditures / Sales
        +
        -6.32%
        -5.60%
        -5.01%
        -4.04%
        -2.67%
        +
        Capital Expenditures (Fixed Assets)
        +
        Capital Expenditures (Fixed Assets)
        +
        (12.73B)
        (12.45B)
        (13.31B)
        (10.5B)
        (7.31B)
        +
        Capital Expenditures (Other Assets)
        +
        Capital Expenditures (Other Assets)
        +
        (814M)
        (344M)
        -
        -
        -
        +
        Net Assets from Acquisitions
        +
        Net Assets from Acquisitions
        +
        (297M)
        (329M)
        (721M)
        (624M)
        (1.52B)
        +
        Sale of Fixed Assets & Businesses
        +
        Sale of Fixed Assets & Businesses
        +
        -
        -
        -
        -
        -
        +
        Purchase/Sale of Investments
        +
        Purchase/Sale of Investments
        +
        (30.63B)
        (33.15B)
        30.85B
        58.09B
        5.34B
        +
        Purchase of Investments
        +
        Purchase of Investments
        +
        (142.43B)
        (159.49B)
        (73.23B)
        (40.63B)
        (115.15B)
        +
        Sale/Maturity of Investments
        +
        Sale/Maturity of Investments
        +
        111.79B
        126.34B
        104.07B
        98.72B
        120.48B
        +
        Other Uses
        +
        Other Uses
        +
        (1.5B)
        (395M)
        (745M)
        (1.08B)
        (791M)
        +
        Other Sources
        +
        Other Sources
        +
        407M
        627M
        -
        -
        -
        +
        Net Investing Cash Flow
        +
        Net Investing Cash Flow
        +
        (45.98B)
        (46.45B)
        16.07B
        45.9B
        (4.29B)
        +
        Net Investing Cash Flow Growth
        +
        Net Investing Cash Flow Growth
        +
        -
        -1.02%
        134.59%
        185.67%
        -109.35%
        +
        Net Investing Cash Flow / Sales
        +
        Net Investing Cash Flow / Sales
        +
        -21.46%
        -20.32%
        6.04%
        17.65%
        -1.56%
        +
        +
        +
        +
        +
        +

        + Financing Activities +

        + All values USD. +
        +
        +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        +
        Item
        +
        Item
        +
        2016
        2017
        2018
        2019
        2020
        5-year trend
        +
        Cash Dividends Paid - Total
        +
        Cash Dividends Paid - Total
        +
        (12.15B)
        (12.77B)
        (13.71B)
        (14.12B)
        (14.08B)
        +
        Common Dividends
        +
        Common Dividends
        +
        (12.15B)
        (12.77B)
        (13.71B)
        (14.12B)
        (14.08B)
        +
        Preferred Dividends
        +
        Preferred Dividends
        +
        -
        -
        -
        -
        -
        +
        Change in Capital Stock
        +
        Change in Capital Stock
        +
        (29.23B)
        (32.35B)
        (72.07B)
        (66.12B)
        (71.48B)
        +
        Repurchase of Common & Preferred Stk.
        +
        Repurchase of Common & Preferred Stk.
        +
        (29.72B)
        (32.9B)
        (72.74B)
        (66.9B)
        (72.36B)
        +
        Sale of Common & Preferred Stock
        +
        Sale of Common & Preferred Stock
        +
        495M
        555M
        669M
        781M
        880M
        +
        Proceeds from Stock Options
        +
        Proceeds from Stock Options
        +
        495M
        555M
        669M
        781M
        880M
        +
        Other Proceeds from Sale of Stock
        +
        Other Proceeds from Sale of Stock
        +
        -
        -
        -
        -
        -
        +
        Issuance/Reduction of Debt, Net
        +
        Issuance/Reduction of Debt, Net
        +
        22.06B
        29.01B
        432M
        (7.82B)
        2.5B
        +
        Change in Current Debt
        +
        Change in Current Debt
        +
        (397M)
        3.85B
        (37M)
        (5.98B)
        (963M)
        +
        Change in Long-Term Debt
        +
        Change in Long-Term Debt
        +
        22.45B
        25.16B
        469M
        (1.84B)
        3.46B
        +
        Issuance of Long-Term Debt
        +
        Issuance of Long-Term Debt
        +
        24.95B
        28.66B
        6.97B
        6.96B
        16.09B
        +
        Reduction in Long-Term Debt
        +
        Reduction in Long-Term Debt
        +
        (2.5B)
        (3.5B)
        (6.5B)
        (8.81B)
        (12.63B)
        +
        Other Funds
        +
        Other Funds
        +
        (1.16B)
        (1.25B)
        (2.53B)
        (2.92B)
        (3.76B)
        +
        Other Uses
        +
        Other Uses
        +
        (1.57B)
        (1.87B)
        (2.53B)
        (2.92B)
        (3.76B)
        +
        Other Sources
        +
        Other Sources
        +
        407M
        627M
        -
        -
        -
        +
        Net Financing Cash Flow
        +
        Net Financing Cash Flow
        +
        (20.48B)
        (17.35B)
        (87.88B)
        (90.98B)
        (86.82B)
        +
        Net Financing Cash Flow Growth
        +
        Net Financing Cash Flow Growth
        +
        -
        15.31%
        -406.58%
        -3.53%
        4.57%
        +
        Net Financing Cash Flow / Sales
        +
        Net Financing Cash Flow / Sales
        +
        -9.56%
        -7.59%
        -33.06%
        -35.00%
        -31.67%
        +
        Exchange Rate Effect
        +
        Exchange Rate Effect
        +
        -
        -
        -
        -
        -
        +
        Miscellaneous Funds
        +
        Miscellaneous Funds
        +
        -
        -
        -
        -
        -
        +
        Net Change in Cash
        +
        Net Change in Cash
        +
        (636M)
        (195M)
        5.62B
        24.31B
        (10.44B)
        +
        Free Cash Flow
        +
        Free Cash Flow
        +
        53.09B
        51.15B
        64.12B
        58.9B
        73.37B
        +
        Free Cash Flow Growth
        +
        Free Cash Flow Growth
        +
        -
        -3.66%
        25.37%
        -8.15%
        24.57%
        +
        Free Cash Flow Yield
        +
        Free Cash Flow Yield
        +
        -
        -
        -
        -
        3.01
        +
        +
        +
        + +
        +
        +
        + +
        + +
        +
        + +
        +
        +
        + + +
        + + + + + + + +
        + + +
        +
        + +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + +
        + + +
        + +
        + + + + + + + + + + expected_result: | + ,Item,2016,2017,2018,2019,2020 + 0,Net Income before Extraordinaries,45.69B,48.35B,59.53B,55.26B,57.41B + 1,Net Income Growth,-,5.83%,23.12%,-7.18%,3.90% + 2,"Depreciation, Depletion & Amortization",10.51B,10.16B,10.9B,12.55B,11.06B + 3,Depreciation and Depletion,-,-,10.9B,12.55B,11.06B + 4,Amortization of Intangible Assets,-,-,-,-,- + 5,Deferred Taxes & Investment Tax Credit,4.94B,5.97B,(32.59B),(340M),(215M) + 6,Deferred Taxes,4.94B,5.97B,(32.59B),(340M),(215M) + 7,Investment Tax Credit,-,-,-,-,- + 8,Other Funds,4.21B,4.67B,4.9B,5.42B,6.73B + 9,Funds from Operations,65.34B,69.15B,42.74B,72.88B,74.98B + 10,Extraordinaries,-,-,-,-,- + 11,Changes in Working Capital,484M,(5.55B),34.69B,(3.49B),5.69B + 12,Receivables,1.04B,(6.35B),(13.33B),3.18B,8.47B + 13,Accounts Payable,1.79B,9.62B,9.18B,(1.92B),(4.06B) + 14,Other Assets/Liabilities,(2.57B),(6.1B),38.02B,(4.45B),1.41B + 15,Net Operating Cash Flow,65.82B,63.6B,77.43B,69.39B,80.67B + 16,Net Operating Cash Flow Growth,-,-3.38%,21.76%,-10.39%,16.26% + 17,Net Operating Cash Flow / Sales,30.73%,27.82%,29.13%,26.69%,29.43% diff --git a/tests/test_fa_market_watch_api_unit.py b/tests/test_fa_market_watch_api_unit.py new file mode 100644 index 00000000000..480c861f707 --- /dev/null +++ b/tests/test_fa_market_watch_api_unit.py @@ -0,0 +1,30 @@ +""" fundamental_analysis/market_watch_api.py tests """ +import unittest +from unittest import mock + +# pylint: disable=unused-import +from gamestonk_terminal.test_helper import ( # noqa: F401 + parametrize_from_file, + pytest_generate_tests, +) + +from gamestonk_terminal.fundamental_analysis.market_watch_api import ( + prepare_df_financials, +) + +assertions = unittest.TestCase("__init__") + + +class TestFaMarketWatchApiUnit: + @mock.patch("gamestonk_terminal.fundamental_analysis.market_watch_api.requests") + @parametrize_from_file( + "test_prepare_df_financials", + "../tests/data/fa_market_watch_api.yaml", + ) + def test_prepare_df_financials( + self, mock_request_get, ticker, statement, mock_market_watch, expected_result + ): + mock_request_get.get().text = mock_market_watch + ret = prepare_df_financials(ticker, statement) + + assertions.assertEqual(ret.to_csv(), expected_result) From a361bdcb6226aba300007b761af7f8ec2cee4848 Mon Sep 17 00:00:00 2001 From: Artem Veremey Date: Tue, 23 Mar 2021 22:25:11 -0700 Subject: [PATCH 2/5] Setting codespell to ignore YAMLs --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 59b23e270f8..c9133a741ed 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,7 +26,7 @@ jobs: - run: pip install bandit black codespell flake8 mypy pyupgrade safety pylint - run: bandit -r . || true - run: black --check . - - run: codespell --ignore-words-list="mape","ba" --quiet-level=2 --skip=".git" + - run: codespell --ignore-words-list="mape","ba" --quiet-level=2 --skip=".git" --skip=".yaml" - run: flake8 . --count --ignore=E203,W503 --max-line-length=122 --show-source --statistics - run: mypy --ignore-missing-imports . - run: shopt -s globstar && pyupgrade --py36-plus **/*.py From d6f284e2e27cd26eb853b69a96098dabb40aac45 Mon Sep 17 00:00:00 2001 From: Artem Veremey Date: Tue, 23 Mar 2021 22:34:38 -0700 Subject: [PATCH 3/5] Adding a wildcard --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c9133a741ed..9a1a62fd675 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,7 +26,7 @@ jobs: - run: pip install bandit black codespell flake8 mypy pyupgrade safety pylint - run: bandit -r . || true - run: black --check . - - run: codespell --ignore-words-list="mape","ba" --quiet-level=2 --skip=".git" --skip=".yaml" + - run: codespell --ignore-words-list="mape","ba" --quiet-level=2 --skip=".git" --skip="*.yaml" --skip="*.json" - run: flake8 . --count --ignore=E203,W503 --max-line-length=122 --show-source --statistics - run: mypy --ignore-missing-imports . - run: shopt -s globstar && pyupgrade --py36-plus **/*.py From 3b0c3a36c5622f662bb703d7dab2b76b38efb40d Mon Sep 17 00:00:00 2001 From: Artem Veremey Date: Tue, 23 Mar 2021 22:38:21 -0700 Subject: [PATCH 4/5] Disable too-many-arguments in this instance --- tests/test_fa_market_watch_api_unit.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_fa_market_watch_api_unit.py b/tests/test_fa_market_watch_api_unit.py index 480c861f707..72e0afb8861 100644 --- a/tests/test_fa_market_watch_api_unit.py +++ b/tests/test_fa_market_watch_api_unit.py @@ -21,6 +21,7 @@ class TestFaMarketWatchApiUnit: "test_prepare_df_financials", "../tests/data/fa_market_watch_api.yaml", ) + # pylint: disable=too-many-arguments def test_prepare_df_financials( self, mock_request_get, ticker, statement, mock_market_watch, expected_result ): From 85511baa425d63921ad2de5fe766fbad10a561e7 Mon Sep 17 00:00:00 2001 From: Artem Veremey Date: Tue, 23 Mar 2021 23:22:56 -0700 Subject: [PATCH 5/5] On Windows we get Windows and Unix line ending mixed --- tests/test_fa_market_watch_api_unit.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_fa_market_watch_api_unit.py b/tests/test_fa_market_watch_api_unit.py index 72e0afb8861..9ca4dbb786a 100644 --- a/tests/test_fa_market_watch_api_unit.py +++ b/tests/test_fa_market_watch_api_unit.py @@ -28,4 +28,8 @@ class TestFaMarketWatchApiUnit: mock_request_get.get().text = mock_market_watch ret = prepare_df_financials(ticker, statement) - assertions.assertEqual(ret.to_csv(), expected_result) + assertions.assertEqual.__self__.maxDiff = None + assertions.assertEqual( + ret.to_csv().replace("\r\n", "\n"), + expected_result.replace("\r\n", "\n"), + )