An Exception was encountered at 'In [5]'.

TheDailyCalls.com Notebook¶

This notebook contains the year to date growth performance of the:

  • Market performance
  • Dow Jones Industrial Average components
  • SPY sectors
In [1]:
import yfinance as yf
import pandas as pd
import numpy as np
from wallstreet import get_moving_avg, get_dow_list, get_ytd_return, get_ytd_growth_percentage, get_spdr_sectors, get_daily_returns
from datetime import datetime
In [2]:
datetime.now()
Out[2]:
datetime.datetime(2023, 10, 30, 15, 20, 3, 608828)
In [3]:
pd.options.display.float_format = '{:.2f}%'.format

Let's look at the market¶

Market Performance YTD Growth¶

In [4]:
market = ['SPY','^NDX','^RUT','^DJI' ] 
market_df = get_ytd_growth_percentage(market)
- SPY: No data found for this date range, symbol may be delisted

Execution using papermill encountered an exception here and stopped:

In [5]:
market_df = market_df.sort_values(by='growth',ascending=False)
market_df.set_index('ticker')
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Input In [5], in <module>
----> 1 market_df = market_df.sort_values(by='growth',ascending=False)
      2 market_df.set_index('ticker')

File ~/anaconda3/envs/nb/lib/python3.10/site-packages/pandas/util/_decorators.py:311, in deprecate_nonkeyword_arguments.<locals>.decorate.<locals>.wrapper(*args, **kwargs)
    305 if len(args) > num_allow_args:
    306     warnings.warn(
    307         msg.format(arguments=arguments),
    308         FutureWarning,
    309         stacklevel=stacklevel,
    310     )
--> 311 return func(*args, **kwargs)

File ~/anaconda3/envs/nb/lib/python3.10/site-packages/pandas/core/frame.py:6259, in DataFrame.sort_values(self, by, axis, ascending, inplace, kind, na_position, ignore_index, key)
   6256 elif len(by):
   6258     by = by[0]
-> 6259     k = self._get_label_or_level_values(by, axis=axis)
   6261     # need to rewrap column in Series to apply key function
   6262     if key is not None:
   6263         # error: Incompatible types in assignment (expression has type
   6264         # "Series", variable has type "ndarray")

File ~/anaconda3/envs/nb/lib/python3.10/site-packages/pandas/core/generic.py:1779, in NDFrame._get_label_or_level_values(self, key, axis)
   1777     values = self.axes[axis].get_level_values(key)._values
   1778 else:
-> 1779     raise KeyError(key)
   1781 # Check for duplicates
   1782 if values.ndim > 1:

KeyError: 'growth'

Dow Jones Industrial Growth Percentage¶

In [ ]:
dow = get_dow_list()
dow_df = get_ytd_growth_percentage(dow)
In [ ]:
dow_df = dow_df.sort_values(by='growth',ascending=False)
dow_df.set_index('ticker')

SPDR Sectors YTD Growth Percentage¶

In [ ]:
spdr = get_ytd_growth_percentage(get_spdr_sectors())
In [ ]:
spdr = spdr.sort_values(by='growth',ascending=False)
spdr.set_index('ticker')

Disclaimer: I am not a professional investment adviser and my opinions are based on my own technical analysis. Please consult an investment professional before making investment decisions.