Skip to content

Commit 9cc9508

Browse files
committed
Added Highcharts Stock chart type demos.
1 parent 36a13eb commit 9cc9508

File tree

5 files changed

+759
-0
lines changed

5 files changed

+759
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "a518f4fc-72a6-40ba-a109-b1ba91640e44",
6+
"metadata": {},
7+
"source": [
8+
"# Candlestick Chart\n",
9+
"Renders a Candlestick chart of the AAPL (Apple) stock price for a given period of time."
10+
]
11+
},
12+
{
13+
"cell_type": "markdown",
14+
"id": "896b9416-fd0b-4d57-8048-1ede94014c7e",
15+
"metadata": {},
16+
"source": [
17+
"## Import Dependencies"
18+
]
19+
},
20+
{
21+
"cell_type": "code",
22+
"execution_count": null,
23+
"id": "c6f4b449-9437-4eb9-98fb-99c8e3141f62",
24+
"metadata": {
25+
"tags": []
26+
},
27+
"outputs": [],
28+
"source": [
29+
"from highcharts_stock.chart import Chart\n",
30+
"from highcharts_stock.options.series.candlestick import CandlestickSeries\n",
31+
"import requests"
32+
]
33+
},
34+
{
35+
"cell_type": "markdown",
36+
"id": "1ec75703-f9f8-4c54-bdac-5e027780e9f3",
37+
"metadata": {},
38+
"source": [
39+
"## Retrieve Data"
40+
]
41+
},
42+
{
43+
"cell_type": "code",
44+
"execution_count": null,
45+
"id": "cb492896-d889-4908-98ab-b33dd0ddcf87",
46+
"metadata": {
47+
"tags": []
48+
},
49+
"outputs": [],
50+
"source": [
51+
"stock_response = requests.get('https://demo-live-data.highcharts.com/aapl-ohlcv.json')\n",
52+
"stock_data = stock_response.text"
53+
]
54+
},
55+
{
56+
"cell_type": "markdown",
57+
"id": "e0fc56b4-47aa-453f-8c08-2550383b359a",
58+
"metadata": {},
59+
"source": [
60+
"## Assemble Options"
61+
]
62+
},
63+
{
64+
"cell_type": "code",
65+
"execution_count": null,
66+
"id": "a2bd4550-d823-484f-93bc-1daad7ee1e85",
67+
"metadata": {
68+
"tags": []
69+
},
70+
"outputs": [],
71+
"source": [
72+
"as_dict = {\n",
73+
" 'range_selector': {\n",
74+
" 'selected': 2\n",
75+
" },\n",
76+
" 'title': {\n",
77+
" 'text': 'AAPL Stock Price'\n",
78+
" },\n",
79+
" 'navigator': {\n",
80+
" 'enabled': True\n",
81+
" },\n",
82+
" 'series': [\n",
83+
" {\n",
84+
" 'type': 'candlestick',\n",
85+
" 'name': 'AAPL Stock Price',\n",
86+
" 'data': stock_data\n",
87+
" }\n",
88+
" ]\n",
89+
"}"
90+
]
91+
},
92+
{
93+
"cell_type": "markdown",
94+
"id": "57eb864d-43ae-4c6a-8b80-66d8812e8899",
95+
"metadata": {},
96+
"source": [
97+
"## Assemble and Display Chart"
98+
]
99+
},
100+
{
101+
"cell_type": "code",
102+
"execution_count": null,
103+
"id": "814e9ed9-e70d-4891-8048-e75a86e55c82",
104+
"metadata": {
105+
"tags": []
106+
},
107+
"outputs": [],
108+
"source": [
109+
"chart = Chart.from_options(as_dict)\n",
110+
"chart.display()"
111+
]
112+
},
113+
{
114+
"cell_type": "code",
115+
"execution_count": null,
116+
"id": "25abb79d-ca39-4e32-91c5-e176dbffe846",
117+
"metadata": {},
118+
"outputs": [],
119+
"source": []
120+
}
121+
],
122+
"metadata": {
123+
"kernelspec": {
124+
"display_name": "Python 3 (ipykernel)",
125+
"language": "python",
126+
"name": "python3"
127+
},
128+
"language_info": {
129+
"codemirror_mode": {
130+
"name": "ipython",
131+
"version": 3
132+
},
133+
"file_extension": ".py",
134+
"mimetype": "text/x-python",
135+
"name": "python",
136+
"nbconvert_exporter": "python",
137+
"pygments_lexer": "ipython3",
138+
"version": "3.10.5"
139+
}
140+
},
141+
"nbformat": 4,
142+
"nbformat_minor": 5
143+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "a518f4fc-72a6-40ba-a109-b1ba91640e44",
6+
"metadata": {},
7+
"source": [
8+
"# Hollow Candlestick Chart\n",
9+
"Renders a Hollow Candlestick chart of the AAPL (Apple) stock price for a given period of time."
10+
]
11+
},
12+
{
13+
"cell_type": "markdown",
14+
"id": "896b9416-fd0b-4d57-8048-1ede94014c7e",
15+
"metadata": {},
16+
"source": [
17+
"## Import Dependencies"
18+
]
19+
},
20+
{
21+
"cell_type": "code",
22+
"execution_count": null,
23+
"id": "c6f4b449-9437-4eb9-98fb-99c8e3141f62",
24+
"metadata": {
25+
"tags": []
26+
},
27+
"outputs": [],
28+
"source": [
29+
"from highcharts_stock.chart import Chart\n",
30+
"from highcharts_stock.options.series.candlestick import HollowCandlestickSeries\n",
31+
"import requests"
32+
]
33+
},
34+
{
35+
"cell_type": "markdown",
36+
"id": "1ec75703-f9f8-4c54-bdac-5e027780e9f3",
37+
"metadata": {},
38+
"source": [
39+
"## Retrieve Data"
40+
]
41+
},
42+
{
43+
"cell_type": "code",
44+
"execution_count": null,
45+
"id": "cb492896-d889-4908-98ab-b33dd0ddcf87",
46+
"metadata": {
47+
"tags": []
48+
},
49+
"outputs": [],
50+
"source": [
51+
"stock_response = requests.get('https://demo-live-data.highcharts.com/aapl-ohlcv.json')\n",
52+
"stock_data = stock_response.text"
53+
]
54+
},
55+
{
56+
"cell_type": "markdown",
57+
"id": "e0fc56b4-47aa-453f-8c08-2550383b359a",
58+
"metadata": {},
59+
"source": [
60+
"## Assemble Options"
61+
]
62+
},
63+
{
64+
"cell_type": "code",
65+
"execution_count": null,
66+
"id": "a2bd4550-d823-484f-93bc-1daad7ee1e85",
67+
"metadata": {
68+
"tags": []
69+
},
70+
"outputs": [],
71+
"source": [
72+
"as_dict = {\n",
73+
" 'range_selector': {\n",
74+
" 'selected': 2\n",
75+
" },\n",
76+
" 'title': {\n",
77+
" 'text': 'AAPL Stock Price'\n",
78+
" },\n",
79+
" 'navigator': {\n",
80+
" 'enabled': True\n",
81+
" },\n",
82+
" 'series': [\n",
83+
" {\n",
84+
" 'type': 'hollowcandlestick',\n",
85+
" 'name': 'AAPL Stock Price',\n",
86+
" 'data': stock_data\n",
87+
" }\n",
88+
" ]\n",
89+
"}"
90+
]
91+
},
92+
{
93+
"cell_type": "markdown",
94+
"id": "57eb864d-43ae-4c6a-8b80-66d8812e8899",
95+
"metadata": {},
96+
"source": [
97+
"## Assemble and Display Chart"
98+
]
99+
},
100+
{
101+
"cell_type": "code",
102+
"execution_count": null,
103+
"id": "814e9ed9-e70d-4891-8048-e75a86e55c82",
104+
"metadata": {
105+
"tags": []
106+
},
107+
"outputs": [],
108+
"source": [
109+
"chart = Chart.from_options(as_dict)\n",
110+
"chart.display()"
111+
]
112+
},
113+
{
114+
"cell_type": "code",
115+
"execution_count": null,
116+
"id": "25abb79d-ca39-4e32-91c5-e176dbffe846",
117+
"metadata": {},
118+
"outputs": [],
119+
"source": []
120+
}
121+
],
122+
"metadata": {
123+
"kernelspec": {
124+
"display_name": "Python 3 (ipykernel)",
125+
"language": "python",
126+
"name": "python3"
127+
},
128+
"language_info": {
129+
"codemirror_mode": {
130+
"name": "ipython",
131+
"version": 3
132+
},
133+
"file_extension": ".py",
134+
"mimetype": "text/x-python",
135+
"name": "python",
136+
"nbconvert_exporter": "python",
137+
"pygments_lexer": "ipython3",
138+
"version": "3.10.5"
139+
}
140+
},
141+
"nbformat": 4,
142+
"nbformat_minor": 5
143+
}

0 commit comments

Comments
 (0)