Alpha Vantage 使用 python 从损益表库中提取数据

Alpha Vantage pulling data from income statement library using python

对新手问题表示歉意,但我完全不知道如何从 Alpha Vantage 的基础数据库中获取任何数据。我这个月才开始学习编程 >.<

例如,如果我想从最近的季度报告中得到'totalRevenue'。 https://www.alphavantage.co/query?function=INCOME_STATEMENT&symbol=IBM&apikey=demo

我能够在线找到有关如何从时间序列获取请求的答案。我做了以下

import pandas as pd
from alpha_vantage.timeseries import TimeSeries
import time
import random
import math
import datetime as dt

ts = TimeSeries (key='apikey', output_format = "pandas")

stock_ticker = "MSFT"

data_daily, meta_data = ts.get_daily_adjusted(symbol=stock_ticker, outputsize ='compact')

last_adjusted_price = data_daily['5. adjusted close'][0]

print(last_adjusted_price)

有谁知道这个图书馆会叫什么?如果有人可以提供如何从最后一个季度主菜中获取 'totalRevenue' 的示例,那将是一个救星。这是第 3 天试图弄清楚如何获得这个大声笑我似乎无法在任何地方找到文档而且我不明白它在这里说的是什么 www.alphavantage.co/documentation/

我在这个网站上找到了这个问题的答案https://algotrading101.com/learn/alpha-vantage-guide/

此代码允许我访问信息

base_url = 'https://www.alphavantage.co/query?'
params = {'function': 'OVERVIEW',
         'symbol': 'IBM',
         'apikey': keys}

response = requests.get(base_url, params=params)
print(response.json())

它输出这样的结果

{'Symbol': 'IBM', 'AssetType': 'Common Stock', 'Name': 'International Business Machines Corporation', 'Description': "International blah blah"}

我需要写什么才能输出名字?

data_overview_Name = # What do i type here for code? 

# So that I could print out
print(data_overview_Name)
International Business Machines Corporation

好的,我一发布这个问题,就通过暴力尝试组合找到了答案哈哈

base_url = 'https://www.alphavantage.co/query?'
params = {'function': 'OVERVIEW',
         'symbol': 'IBM',
         'apikey': keys}

response = requests.get(base_url, params=params)

print(response.json())
test = response.json()['Name']
print(test)

希望这对将来像我这样的新手的其他人有所帮助哈哈