我正在使用yfinanceAPI,并希望从 ETF 中检索更多数据,特别是特定 ETF 的行业权重(%),在标签中找到控股在雅虎网站上:https://finance.yahoo.com/quote/IWDA.AS/holdings?p=IWDA.AS
这在当前的 API 中可能吗?如果没有,是否有人知道我如何将其添加到 API 中?我猜它将在base.py
中,但我不确定在哪里。欢迎所有帮助!
虽然我没有与 yfinance 相关的答案,但您可以使用名为yahooquery的包来检索该数据。
from yahooquery import Ticker
t = Ticker('IWDA.AS')
# sector weightings, returns pandas DataFrame
t.fund_sector_weightings
IWDA.AS
0
realestate 0.0303
consumer_cyclical 0.1036
basic_materials 0.0411
consumer_defensive 0.0857
technology 0.1920
communication_services 0.0917
financial_services 0.1453
utilities 0.0329
industrials 0.1013
energy 0.0331
healthcare 0.1430
t.fund_holding_info
或者从整个页面中检索大部分数据:
t.fund_holding_info
{
'IWDA.AS': {
'maxAge': 1,
'stockPosition': 0.9959,
'bondPosition': 0.0,
'holdings': [{
'symbol': 'AAPL',
'holdingName': 'Apple Inc',
'holdingPercent': 0.038
}, {
'symbol': 'MSFT',
'holdingName': 'Microsoft Corp',
'holdingPercent': 0.035099998
}, {
'symbol': 'AMZN',
'holdingName': 'Amazon.com Inc',
'holdingPercent': 0.0278
}, {
'symbol': 'FB',
'holdingName': 'Facebook Inc A',
'holdingPercent': 0.012999999
}, {
'symbol': 'GOOG',
'holdingName': 'Alphabet Inc Cl C',
'holdingPercent': 0.010299999
}, {
'symbol': 'GOOGL',
'holdingName': 'Alphabet Inc A',
'holdingPercent': 0.0101
}, {
'symbol': 'JNJ',
'holdingName': 'Johnson & Johnson',
'holdingPercent': 0.0088
}, {
'symbol': 'V',
'holdingName': 'Visa Inc Cl A',
'holdingPercent': 0.007900001
}, {
'symbol': 'NESN',
'holdingName': 'Nestle SA',
'holdingPercent': 0.0078
}, {
'symbol': 'PG',
'holdingName': 'Procter & Gamble Co',
'holdingPercent': 0.0070999996
}],
'equityHoldings': {
'priceToEarnings': 20.47,
'priceToBook': 2.34,
'priceToSales': 1.62,
'priceToCashflow': 11.82
},
'bondHoldings': {},
'bondRatings': [{
'bb': 0.0
}, {
'aa': 0.0
}, {
'aaa': 0.0
}, {
'a': 0.0
}, {
'other': 0.0
}, {
'b': 0.0
}, {
'bbb': 0.0
}, {
'below_b': 0.0
}, {
'us_government': 0.0
}],
'sectorWeightings': [{
'realestate': 0.030299999
}, {
'consumer_cyclical': 0.103599995
}, {
'basic_materials': 0.041100003
}, {
'consumer_defensive': 0.0857
}, {
'technology': 0.192
}, {
'communication_services': 0.0917
}, {
'financial_services': 0.1453
}, {
'utilities': 0.032899998
}, {
'industrials': 0.1013
}, {
'energy': 0.033099998
}, {
'healthcare': 0.143
}]
}
}
您可以通过documentation找到其他数据访问器。
本站系公益性非盈利分享网址,本文来自用户投稿,不代表边看边学立场,如若转载,请注明出处
评论列表(17条)