Python YFINANCE:检索更多ETF数据

Python YFINANCE:检索更多ETF数据,python,api,yahoo-finance,yahoo-api,yfinance,Python,Api,Yahoo Finance,Yahoo Api,Yfinance,我正在使用API,希望从ETF中检索更多数据,具体是特定ETF的行业权重(%),可在雅虎网站上的Holdings选项卡中找到: 在当前的API中这可能吗? 如果没有,有人知道我如何将其添加到API中吗?我猜它应该在base.py中,但我不确定在哪里。欢迎大家帮忙 虽然我没有关于yfinance的答案,但您可以使用一个名为的包来检索该数据。免责声明:我是该软件包的作者 from yahooquery import Ticker t = Ticker('IWDA.AS') # sector we

我正在使用API,希望从ETF中检索更多数据,具体是特定ETF的行业权重(%),可在雅虎网站上的Holdings选项卡中找到:

在当前的API中这可能吗?
如果没有,有人知道我如何将其添加到API中吗?我猜它应该在
base.py
中,但我不确定在哪里。欢迎大家帮忙

虽然我没有关于yfinance的答案,但您可以使用一个名为的包来检索该数据。免责声明:我是该软件包的作者

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 Class 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 Class 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
        }]
    }
}
您可以通过找到其他数据访问器