Every provider reports a different P/E and hides the formula, I open-sourced one where all 200+ metrics show their math
▲ 22 r/datasets+1 crossposts

Every provider reports a different P/E and hides the formula, I open-sourced one where all 200+ metrics show their math

Run a factor backtest on fundamental signals and your historical P/E series often won't match what you'd actually have seen at the time. The usual cause: trailing-twelve-month vs fiscal-year-end earnings, diluted vs basic shares, different treatment of extraordinary items. Most providers don't document which they use. For example, Microsoft's PE ratio on the 6th of May, 2023 is reported to be 28.93 (Stockopedia), 32.05 (Morningstar), 32.66 (Macrotrends), 33.09 (Finance Charts), 33.66 (Y Charts), 33.67 (Wall Street Journal), 33.80 (Yahoo Finance) and 34.4 (Companies Market Cap). Whereas I report it at 32.07 (diluted), 31.96 (non-diluted), 30.07 (TTM diluted) and 29.93 (TTM non-diluted).

So that's why I open-sourced the math. The P/E, for example, is as simple as stock_price / earnings_per_share where Earnings per Share is (net_income - preferred_dividends) / average_outstanding_shares. There is a layer on top to also be able to work with trailing, TTM and growth rates for any metric which is also documented. This makes it so you can reproduce any provider's P/E if you know which definition they used (albeit that is often the issue..)

Same idea when it comes to any other metrics let it be fundamentals, technicals, risk, performance etc. (about 200). Here's CAPM, VaR and Max Drawdown for NVDA, AMD and INTC at five-year intervals since 2000:

# Install first: pip install financetoolkit -U

from financetoolkit import Toolkit

semis = Toolkit(["NVDA", "AMD", "INTC"], api_key="FMP_KEY", start_date="2000-01-01")
capm = semis.performance.get_capital_asset_pricing_model(period="yearly")
var  = semis.risk.get_value_at_risk(period="yearly")
mdd  = semis.risk.get_maximum_drawdown(period="yearly")

CAPM (expected annual return):

Year NVDA AMD INTC
2010 16.9% 20.2% 13.7%
2015 -1.3% -1.3% -0.8%
2020 21.6% 19.0% 18.9%
2025 27.0% 29.2% 22.9%

VaR (95% historic, worst expected daily loss):

Year NVDA AMD INTC
2010 -4.8% -5.0% -2.7%
2015 -2.7% -5.2% -2.3%
2020 -5.7% -5.4% -4.2%
2025 -4.5% -5.4% -5.3%

Max Drawdown (peak-to-trough within year):

Year NVDA AMD INTC
2010 -53.0% -44.8% -27.1%
2015 -17.7% -51.1% -29.9%
2020 -37.6% -34.3% -35.6%
2025 -36.9% -39.6% -33.8%

The whole point is to make things more transparent and with creating models, that is especially relevant that the metric you're training on is actually how you envision the metric to be.

While the library uses Financial Modeling Prep and Yahoo Finance as a default source, I've added in logic so you can swap in your own data provider or even a local CSV to not be provider-dependent. This way it should really become auditable for your backtests. The library is MIT-licensed, so you can use it in your own projects without restriction.

u/Traditional_Yogurt — 11 days ago
▲ 9 r/MCPservers+1 crossposts

I built an MCP Server for the Finance Toolkit so Claude can pull 200+ real financial metrics instead of hallucinating about them

I'm the author of the Finance Toolkit, an open-source Python package covering 200+ financial metrics, models and economic indicators. I started this project in 2019 because Stockopedia, Morningstar, Macrotrends and the Wall Street Journal all reported a different P/E for the same company on the same day, turns out everyone calculates it slightly differently and hardly any of them tell you how. Repository can be found here.

I've now built an MCP Server on top of it. It groups the 200+ methods into about 21 categorical tools, so Claude, Copilot, Cursor, Windsurf or Gemini can pull real financial data and run the actual calculation instead of recalling a number from training data. Setup is one command:

uvx --from "financetoolkit[mcp]" financetoolkit-mcp-setup

Full docs can be found here including a MCPB file for Claude Desktop.

As an example, I asked it: "Compare the major semiconductor companies on cumulative return, P/E, EV/EBITDA, EPS growth and revenue per share, what does it show over the last 10 years?" It picked the right tools on its own (valuation ratios, EPS growth, historical returns) and came back with this:

Ticker Cumulative Return (2015-2025) P/E (2025) EV/EBITDA (2025) EPS Growth (2025) Revenue/Share (2025)
NVDA +42,215% 63.5x 55.5x +146.2% $5.26
AMD +20,344% 80.8x 52.2x +164.3% $21.17
AVGO +3,935% 72.6x 50.5x +286.2% $13.16
AMAT +2,347% 29.7x 23.8x +0.6% $35.11
TSM +1,981% 28.4x 18.0x +57.2% $23.75
ASML +1,762% 36.9x 28.0x +45.0% $98.67
QCOM +297% 34.1x 14.2x -44.1% $40.08
TXN +585% 31.9x 21.3x +4.8% $19.37
INTC +352% - 19.1x -98.75% $10.88

Assembling this took five separate tool calls under the hood (price-to-earnings, EV/EBITDA, EPS growth, revenue per share, historical returns), and I didn't have to chain any of it manually, the model figured out which tools to call and merged the results itself. Here the biggest challenge was captuing all 200+ tools into the correct buckets as it would otherwise overwhelm the tool selection process. For example, the Finance Toolkit also includes macro-economic indicators which rely on a country parameter instead of a ticker. Furthermore, I also didn't want excessive API calls which is why the MCP automatically stores the results and underlying financial statements of each tool in a SQL database and reuses them if the same tool or a tool requiring the same financial statements is called again.

Same pull in plain Python if you want to skip the AI layer entirely:

from financetoolkit import Toolkit

chips = Toolkit(
    tickers=["NVDA", "AMD", "ASML", "TSM", "AVGO", "INTC", "QCOM", "TXN", "AMAT"],
    api_key="YOUR_FMP_API_KEY",
    start_date="2015-01-01"
)

cumulative_return = chips.get_historical_data()
pe = chips.ratios.get_price_to_earnings_ratio()["2025"]
ev_ebitda = chips.ratios.get_ev_to_ebitda_ratio()["2025"]
eps_growth = chips.ratios.get_earnings_per_share(growth=True)["2025"]
revenue_per_share = chips.ratios.get_revenue_per_share()["2025"]

I'll happily answer any questions related to the Finance Toolkit and/or the MCP server. Because this is a passion project I do want to mention that this is not vibe coded visible due to the fact that most of the programming happend before that was a possibility.

u/Traditional_Yogurt — 20 days ago

Looking to come back, how has the Engineer evolved since Heart of Thorns?

Having seen the Guild Wars 3 announcement, I am intrigued to return to Guild Wars 2 even if it's just for a couple hours a week at a maximum. I used to play Engineer exclusively, clocked in I believe over 3000 hours total on that one profession. That was about 10 years ago, under the name Wolfineer, perhaps some of you might remember that name (as I had a YouTube channel and website back then). Actually found my (now very dated) Engineer Handbook again on the Wiki: https://wiki.guildwars2.com/wiki/User:Chieftain\_Alex/The\_Engineer\_Handbook

I can still remember most of the builds I ran and can still name every skill of the Engineer up to Heart of Thorns. Tended to adore running a 3 or 4 kit Celestial build with Rifle or Hammer which worked very well in WvW content. I believe there is a good chance that it can still work pretty well, at least from what I've read so far.

But so much time has passed and so many new specializations have come out, when I played mounts didn't even exist. I am curious whether someone can give me a brief overview of what major changes have occurred over all that time. Is Engineer still the high APM profession as I remember or has this changed radically? The good old times of Speedy Kits seem to be gone and the Engineer seems to be less reliant on kits nowadays, is that correct?

reddit.com
u/Traditional_Yogurt — 29 days ago