Getting Started With Chart Data
[9]:
from pprint import pprint
from fmp_py.fmp_charts import FmpCharts
import pendulum
yesterday = pendulum.yesterday().to_date_string()
four_year_age = pendulum.now().subtract(years=4).to_date_string()
Basic Historical Data
[10]:
fmp = FmpCharts(symbol="AAPL", from_date=four_year_age, to_date=yesterday)
pprint(fmp.return_chart())
open low high close volume
date
2020-07-27 93.71 93.48 94.91 94.81 121214192
2020-07-28 94.37 93.25 94.55 93.25 103625500
2020-07-29 93.75 93.71 95.23 95.04 90329256
2020-07-30 94.19 93.77 96.30 96.19 158130020
2020-07-31 102.88 100.83 106.42 106.26 374295468
... ... ... ... ... ...
2024-07-19 224.82 223.28 226.80 224.31 49151453
2024-07-22 227.01 223.09 227.78 223.96 48201835
2024-07-23 224.37 222.68 226.94 225.01 39960260
2024-07-24 224.00 217.13 224.80 218.54 61777576
2024-07-25 218.93 214.62 220.85 217.49 51391199
[1006 rows x 5 columns]
Add SMA Indicator to Data
[11]:
fmp.sma(14)
pprint(fmp.return_chart())
open low high close volume sma14
date
2020-07-27 93.71 93.48 94.91 94.81 121214192 94.81
2020-07-28 94.37 93.25 94.55 93.25 103625500 94.03
2020-07-29 93.75 93.71 95.23 95.04 90329256 94.37
2020-07-30 94.19 93.77 96.30 96.19 158130020 94.82
2020-07-31 102.88 100.83 106.42 106.26 374295468 97.11
... ... ... ... ... ... ...
2024-07-19 224.82 223.28 226.80 224.31 49151453 227.08
2024-07-22 227.01 223.09 227.78 223.96 48201835 227.59
2024-07-23 224.37 222.68 226.94 225.01 39960260 227.93
2024-07-24 224.00 217.13 224.80 218.54 61777576 227.72
2024-07-25 218.93 214.62 220.85 217.49 51391199 227.08
[1006 rows x 6 columns]
Add RSI Indicator to Data
[12]:
fmp.rsi(14)
pprint(fmp.return_chart())
open low high close volume sma14 rsi14
date
2020-07-27 93.71 93.48 94.91 94.81 121214192 94.81 100.00
2020-07-28 94.37 93.25 94.55 93.25 103625500 94.03 0.00
2020-07-29 93.75 93.71 95.23 95.04 90329256 94.37 55.27
2020-07-30 94.19 93.77 96.30 96.19 158130020 94.82 67.64
2020-07-31 102.88 100.83 106.42 106.26 374295468 97.11 91.03
... ... ... ... ... ... ... ...
2024-07-19 224.82 223.28 226.80 224.31 49151453 227.08 57.05
2024-07-22 227.01 223.09 227.78 223.96 48201835 227.59 56.54
2024-07-23 224.37 222.68 226.94 225.01 39960260 227.93 57.76
2024-07-24 224.00 217.13 224.80 218.54 61777576 227.72 48.69
2024-07-25 218.93 214.62 220.85 217.49 51391199 227.08 47.39
[1006 rows x 7 columns]