LoginSignup
0
3

More than 3 years have passed since last update.

ラズパイでPythonから米国株価をWebAPIで取得

Posted at

以前、Postmanを使って米国株価を取得してみましたが、アプリ作成に転用するため今度はラズパイからPythonを使っての取得を試みました。

PostmanでRapid APIを使って米国株価を取得する
https://qiita.com/ShinPun/items/cc9a124e3bc64b4d3893

Pythonコード

apikeyの取得方法は上の記事をご参照ください。

import requests

url = "https://www.alphavantage.co/query"

querystring = {"interval":"5min","function":"TIME_SERIES_INTRADAY","symbol":"MSFT","datatype":"json","output_size":"compact","apikey":"XXXXXXYYYYYYYZZZZZZZ"}

response = requests.request("GET", url,params=querystring)

print(response.text)

取得結果

Python3.7.3の実行時の画面。
5分毎の株価が取得できました。

image.png

0
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
3