TD Ameritrade APIs SearchInstruments

1. td-ameritrade-python-api

source code:

from td.client import TDClient
from config import client_id, redirect_uri, credentials_path

import json

# Create a new session, credentials path is required.
td_client = TDClient(
    client_id=client_id,
    redirect_uri=redirect_uri,
    credentials_path=credentials_path
)

td_client.login()

data = td_client.search_instruments(symbol="PBF", projection="fundamental")
print(json.dumps(data, indent=4))

result:

{
    "PBF": {
        "fundamental": {
            "symbol": "PBF",
            "high52": 18.78,         // 52周最高价
            "low52": 4.06,           // 52周最低价
            "dividendAmount": 0.0,   // 股息金额
            "dividendYield": 0.0,    // 股息收益率
            "dividendDate": " ",     // 股息发放日期
            "peRatio": 0.0,          // 市盈率 (Price/Earnings) 市盈率=股价/每股收益=市值/利润
            "pegRatio": 0.0,         // 市赢增长比率 PEG=PE/利润增速 PEG是彼得林奇发明的指标, PEG小于1就是买入机会
            "pbRatio": 1.06203,      // 市净率 (Price/Book Value) 市净率=股价/每股净资产=市值/净资产
            "prRatio": 0.09233,      // 市销率 (Price/Sales) 市销率=市值/主营业务收入
            "pcfRatio": 0.0,         // 市现率 (Price/Cash Flow) 市销率=股价/每股现金流=市值/经营现金流
            "grossMarginTTM": 11.98414,     // 毛利率(最近12个月)
            "grossMarginMRQ": 11.55714,     // 毛利率(最近1个季度
            "netProfitMarginTTM": 0.0,      // 净利润率(最近12个月)
            "netProfitMarginMRQ": 1.01335,  // 净利润率(最近1个季度)
            "operatingMarginTTM": 0.0,      // 营业利润率(最近12个月)
            "operatingMarginMRQ": 2.13833,  // 营业利润率(最近1个季度)
            "returnOnEquity": 0.0,          // 股本回报率
            "returnOnAssets": 0.0,          // 资产回报率 
            "returnOnInvestment": 0.0,      // 投资回报率
            "quickRatio": 0.70123,          // 速动比率 指速动资产对流动负债的比率 衡量企业流动资产中可以立即变现用于偿还流动负债的能力
            "currentRatio": 1.40403,        // 流动比率 流动比率=流动资产合计/流动负债合计*100% 显示的是公司偿还短期债务的能力
            "interestCoverage": 1.96667,    // 利息覆盖率 ICR=借款偿还期内各年的息税前利润(EBIT)÷该年应付利息(PI) 衡量公司产生的税前利润能否支付当期利息的指标
            "totalDebtToCapital": 67.67329,
            "ltDebtToEquity": 281.6691,
            "totalDebtToEquity": 282.6064,
            "epsTTM": 0.0,                  // 每股收益(最近12个月) 
            "epsChangePercentTTM": 0.0,
            "epsChangeYear": 0.0,
            "epsChange": 0.0,
            "revChangeYear": 0.0,
            "revChangeTTM": 0.0,
            "revChangeIn": 40.06457,
            "sharesOutstanding": 120247995.0,
            "marketCapFloat": 95.07567,
            "marketCap": 1767.646,
            "bookValuePerShare": 0.0,
            "shortIntToFloat": 0.0,
            "shortIntDayToCover": 0.0,
            "divGrowthRate3Year": 0.0,
            "dividendPayAmount": 0.3,
            "dividendPayDate": "2020-03-17 00:00:00.000",
            "beta": 2.79089,
            "vol1DayAvg": 2809770.0,
            "vol10DayAvg": 2809766.0,
            "vol3MonthAvg": 98996040.0
        },
        "cusip": "69318G106",
        "symbol": "PBF",
        "description": "PBF Energy Inc. Class A Common Stock",
        "exchange": "NYSE",
        "assetType": "EQUITY"
    }
}

2. yfinanace

source code:

import yfinance as yf
import talib
import json

pbf = yf.Ticker("PBF")
print(json.dumps(pbf.info, indent=4))

result:

{
    "zip": "07054",
    "sector": "Energy",
    "fullTimeEmployees": 3729,
    "longBusinessSummary": "PBF Energy Inc., together with its subsidiaries, engages in refining and supplying petroleum products. The company operates in two segments, Refining and Logistics. It produces gasoline, ultra-low-sulfur diesel, heating oil, diesel fuel, jet fuel, lubricants, petrochemicals, and asphalt, as well as unbranded transportation fuels, petrochemical feedstocks, blending components, and other petroleum products. The company sells its products in Northeast, Midwest, Gulf Coast, and West Coast of the United States, as well as in other regions of the United States, Canada, and Mexico. It also offers various rail, truck, and marine terminaling services, as well as pipeline transportation and storage services. The company owns and operates six oil refineries and related assets. PBF Energy Inc. was founded in 2008 and is based in Parsippany, New Jersey.",
    "city": "Parsippany",
    "phone": "973 455 7500",
    "state": "NJ",
    "country": "United States",
    "companyOfficers": [],
    "website": "http://www.pbfenergy.com",
    "maxAge": 1,
    "address1": "One Sylvan Way",
    "industry": "Oil & Gas Refining & Marketing",
    "address2": "Second Floor",
    "ebitdaMargins": -0.05864,
    "profitMargins": -0.03703,
    "grossMargins": -0.03252,
    "operatingCashflow": 61900000,
    "revenueGrowth": 1.742,
    "operatingMargins": -0.071279995,
    "ebitda": -1122599936,
    "targetLowPrice": 5,
    "recommendationKey": "underperform",
    "grossProfits": -714500000,
    "freeCashflow": -433912512,
    "targetMedianPrice": 14,
    "currentPrice": 15.27,
    "earningsGrowth": -0.878,
    "currentRatio": 1.404,
    "returnOnAssets": -0.07851,
    "numberOfAnalystOpinions": 14,
    "targetMeanPrice": 13.43,
    "debtToEquity": 239.014,
    "returnOnEquity": -0.24767,
    "targetHighPrice": 20,
    "totalCash": 1479699968,
    "totalDebt": 5370399744,
    "totalRevenue": 19145299968,
    "totalCashPerShare": 12.305,
    "financialCurrency": "USD",
    "revenuePerShare": 159.579,
    "quickRatio": 0.663,
    "recommendationMean": 3.6,
    "exchange": "NYQ",
    "shortName": "PBF Energy Inc.",
    "longName": "PBF Energy Inc.",
    "exchangeTimezoneName": "America/New_York",
    "exchangeTimezoneShortName": "EDT",
    "isEsgPopulated": false,
    "gmtOffSetMilliseconds": "-14400000",
    "quoteType": "EQUITY",
    "symbol": "PBF",
    "messageBoardId": "finmb_142892259",
    "market": "us_market",
    "annualHoldingsTurnover": null,
    "enterpriseToRevenue": 0.33,
    "beta3Year": null,
    "enterpriseToEbitda": -5.62,
    "52WeekChange": 2.2698073,
    "morningStarRiskRating": null,
    "forwardEps": 0,
    "revenueQuarterlyGrowth": null,
    "sharesOutstanding": 120248000,
    "fundInceptionDate": null,
    "annualReportExpenseRatio": null,
    "totalAssets": null,
    "bookValue": 13.841,
    "sharesShort": 15407624,
    "sharesPercentSharesOut": 0.12810001,
    "fundFamily": null,
    "lastFiscalYearEnd": 1609372800,
    "heldPercentInstitutions": 0.71282,
    "netIncomeToCommon": -709000000,
    "trailingEps": -5.952,
    "lastDividendValue": 0.3,
    "SandP52WeekChange": 0.40565026,
    "priceToBook": 1.1032441,
    "heldPercentInsiders": 0.20934,
    "nextFiscalYearEnd": 1672444800,
    "yield": null,
    "mostRecentQuarter": 1625011200,
    "shortRatio": 2.69,
    "sharesShortPreviousMonthDate": 1631664000,
    "floatShares": 95414379,
    "beta": 2.783068,
    "enterpriseValue": 6309386752,
    "priceHint": 2,
    "threeYearAverageReturn": null,
    "lastSplitDate": null,
    "lastSplitFactor": null,
    "legalType": null,
    "lastDividendDate": 1582502400,
    "morningStarOverallRating": null,
    "earningsQuarterlyGrowth": -0.877,
    "priceToSalesTrailing12Months": 0.09590798,
    "dateShortInterest": 1634256000,
    "pegRatio": 0.1,
    "ytdReturn": null,
    "forwardPE": null,
    "lastCapGain": null,
    "shortPercentOfFloat": 0.19610001,
    "sharesShortPriorMonth": 12687007,
    "impliedSharesOutstanding": 120248000,
    "category": null,
    "fiveYearAverageReturn": null,
    "previousClose": 14.7,
    "regularMarketOpen": 15.1,
    "twoHundredDayAverage": 13.097589,
    "trailingAnnualDividendYield": 0.020408165,
    "payoutRatio": 0,
    "volume24Hr": null,
    "regularMarketDayHigh": 16.46,
    "navPrice": null,
    "averageDailyVolume10Day": 2755825,
    "regularMarketPreviousClose": 14.7,
    "fiftyDayAverage": 13.258889,
    "trailingAnnualDividendRate": 0.3,
    "open": 15.1,
    "toCurrency": null,
    "averageVolume10days": 2755825,
    "expireDate": null,
    "algorithm": null,
    "dividendRate": null,
    "exDividendDate": 1582502400,
    "circulatingSupply": null,
    "startDate": null,
    "regularMarketDayLow": 14.92,
    "currency": "USD",
    "regularMarketVolume": 3659137,
    "lastMarket": null,
    "maxSupply": null,
    "openInterest": null,
    "marketCap": 1836187008,
    "volumeAllCurrencies": null,
    "strikePrice": null,
    "averageVolume": 4627324,
    "dayLow": 14.92,
    "ask": 15.34,
    "askSize": 800,
    "volume": 3659137,
    "fiftyTwoWeekHigh": 18.78,
    "fromCurrency": null,
    "fiveYearAvgDividendYield": null,
    "fiftyTwoWeekLow": 4.33,
    "bid": 14.85,
    "tradeable": false,
    "dividendYield": null,
    "bidSize": 800,
    "dayHigh": 16.46,
    "regularMarketPrice": 15.27,
    "preMarketPrice": 15.1,
    "logo_url": "https://logo.clearbit.com/pbfenergy.com"
}

3. futu-api

source code:

result:

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值