Skip to content

Instantly share code, notes, and snippets.

@FinanceData
Created March 25, 2018 03:37
Show Gist options
  • Save FinanceData/0b98dd4264fc070065e2d0bb8662cf97 to your computer and use it in GitHub Desktop.
Save FinanceData/0b98dd4264fc070065e2d0bb8662cf97 to your computer and use it in GitHub Desktop.
차트 이미지
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"from IPython.display import display, HTML"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"url = 'http://imgfinance.naver.net/chart/sise/siseMainKOSPI.png?sid=1521947773997'\n",
"tmpl = '<img src=\"{url}\" >'.format(url=url)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<img src=\"http://imgfinance.naver.net/chart/sise/siseMainKOSPI.png?sid=1521947773997\" >"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"display(HTML(tmpl))"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"import requests\n",
"\n",
"r = requests.get(url)\n",
"\n",
"with open('kospi.png', 'wb') as f:\n",
" f.write(r.content)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"-rw-r--r-- 1 plusjune staff 13408 3 25 12:21 kospi.png\r\n"
]
}
],
"source": [
"ll *.png"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment