Skip to content

Commit 9995166

Browse files
committed
fix test
1 parent c3ecf94 commit 9995166

File tree

3 files changed

+692
-4
lines changed

3 files changed

+692
-4
lines changed

docs/source/notebooks/usage.ipynb

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"### Getting Started With Chart Data"
8+
]
9+
},
10+
{
11+
"cell_type": "code",
12+
"execution_count": 9,
13+
"metadata": {},
14+
"outputs": [],
15+
"source": [
16+
"from pprint import pprint\n",
17+
"from fmp_py.fmp_charts import FmpCharts\n",
18+
"import pendulum\n",
19+
"\n",
20+
"yesterday = pendulum.yesterday().to_date_string()\n",
21+
"four_year_age = pendulum.now().subtract(years=4).to_date_string()"
22+
]
23+
},
24+
{
25+
"cell_type": "markdown",
26+
"metadata": {},
27+
"source": [
28+
"## Basic Historical Data"
29+
]
30+
},
31+
{
32+
"cell_type": "code",
33+
"execution_count": 10,
34+
"metadata": {},
35+
"outputs": [
36+
{
37+
"name": "stdout",
38+
"output_type": "stream",
39+
"text": [
40+
" open low high close volume\n",
41+
"date \n",
42+
"2020-07-27 93.71 93.48 94.91 94.81 121214192\n",
43+
"2020-07-28 94.37 93.25 94.55 93.25 103625500\n",
44+
"2020-07-29 93.75 93.71 95.23 95.04 90329256\n",
45+
"2020-07-30 94.19 93.77 96.30 96.19 158130020\n",
46+
"2020-07-31 102.88 100.83 106.42 106.26 374295468\n",
47+
"... ... ... ... ... ...\n",
48+
"2024-07-19 224.82 223.28 226.80 224.31 49151453\n",
49+
"2024-07-22 227.01 223.09 227.78 223.96 48201835\n",
50+
"2024-07-23 224.37 222.68 226.94 225.01 39960260\n",
51+
"2024-07-24 224.00 217.13 224.80 218.54 61777576\n",
52+
"2024-07-25 218.93 214.62 220.85 217.49 51391199\n",
53+
"\n",
54+
"[1006 rows x 5 columns]\n"
55+
]
56+
}
57+
],
58+
"source": [
59+
"fmp = FmpCharts(symbol=\"AAPL\", from_date=four_year_age, to_date=yesterday)\n",
60+
"\n",
61+
"pprint(fmp.return_chart())"
62+
]
63+
},
64+
{
65+
"cell_type": "markdown",
66+
"metadata": {},
67+
"source": [
68+
"## Add SMA Indicator to Data"
69+
]
70+
},
71+
{
72+
"cell_type": "code",
73+
"execution_count": 11,
74+
"metadata": {},
75+
"outputs": [
76+
{
77+
"name": "stdout",
78+
"output_type": "stream",
79+
"text": [
80+
" open low high close volume sma14\n",
81+
"date \n",
82+
"2020-07-27 93.71 93.48 94.91 94.81 121214192 94.81\n",
83+
"2020-07-28 94.37 93.25 94.55 93.25 103625500 94.03\n",
84+
"2020-07-29 93.75 93.71 95.23 95.04 90329256 94.37\n",
85+
"2020-07-30 94.19 93.77 96.30 96.19 158130020 94.82\n",
86+
"2020-07-31 102.88 100.83 106.42 106.26 374295468 97.11\n",
87+
"... ... ... ... ... ... ...\n",
88+
"2024-07-19 224.82 223.28 226.80 224.31 49151453 227.08\n",
89+
"2024-07-22 227.01 223.09 227.78 223.96 48201835 227.59\n",
90+
"2024-07-23 224.37 222.68 226.94 225.01 39960260 227.93\n",
91+
"2024-07-24 224.00 217.13 224.80 218.54 61777576 227.72\n",
92+
"2024-07-25 218.93 214.62 220.85 217.49 51391199 227.08\n",
93+
"\n",
94+
"[1006 rows x 6 columns]\n"
95+
]
96+
}
97+
],
98+
"source": [
99+
"fmp.sma(14)\n",
100+
"\n",
101+
"pprint(fmp.return_chart())"
102+
]
103+
},
104+
{
105+
"cell_type": "markdown",
106+
"metadata": {},
107+
"source": [
108+
"## Add RSI Indicator to Data"
109+
]
110+
},
111+
{
112+
"cell_type": "code",
113+
"execution_count": 12,
114+
"metadata": {},
115+
"outputs": [
116+
{
117+
"name": "stdout",
118+
"output_type": "stream",
119+
"text": [
120+
" open low high close volume sma14 rsi14\n",
121+
"date \n",
122+
"2020-07-27 93.71 93.48 94.91 94.81 121214192 94.81 100.00\n",
123+
"2020-07-28 94.37 93.25 94.55 93.25 103625500 94.03 0.00\n",
124+
"2020-07-29 93.75 93.71 95.23 95.04 90329256 94.37 55.27\n",
125+
"2020-07-30 94.19 93.77 96.30 96.19 158130020 94.82 67.64\n",
126+
"2020-07-31 102.88 100.83 106.42 106.26 374295468 97.11 91.03\n",
127+
"... ... ... ... ... ... ... ...\n",
128+
"2024-07-19 224.82 223.28 226.80 224.31 49151453 227.08 57.05\n",
129+
"2024-07-22 227.01 223.09 227.78 223.96 48201835 227.59 56.54\n",
130+
"2024-07-23 224.37 222.68 226.94 225.01 39960260 227.93 57.76\n",
131+
"2024-07-24 224.00 217.13 224.80 218.54 61777576 227.72 48.69\n",
132+
"2024-07-25 218.93 214.62 220.85 217.49 51391199 227.08 47.39\n",
133+
"\n",
134+
"[1006 rows x 7 columns]\n"
135+
]
136+
}
137+
],
138+
"source": [
139+
"fmp.rsi(14)\n",
140+
"\n",
141+
"pprint(fmp.return_chart())"
142+
]
143+
}
144+
],
145+
"metadata": {
146+
"kernelspec": {
147+
"display_name": "fmp-py-m43qA0g1-py3.12",
148+
"language": "python",
149+
"name": "python3"
150+
},
151+
"language_info": {
152+
"codemirror_mode": {
153+
"name": "ipython",
154+
"version": 3
155+
},
156+
"file_extension": ".py",
157+
"mimetype": "text/x-python",
158+
"name": "python",
159+
"nbconvert_exporter": "python",
160+
"pygments_lexer": "ipython3",
161+
"version": "3.12.4"
162+
}
163+
},
164+
"nbformat": 4,
165+
"nbformat_minor": 2
166+
}

0 commit comments

Comments
 (0)