Skip to main content

The MarketDX financial impact graph, in Python — news→market impact (why, who, direction, ripple) across stocks, commodities, FX, crypto, and private companies.

Project description

marketdx

The financial impact graph, in Python.
News → who it touches and why — the causal channel, the story's lean, and the ripple — across stocks, commodities, FX, crypto, and private companies.
A research, screening & feature layer — direction is the news's content lean, not a price forecast.

▶ Live playground · Docs & pricing · Sample dataset


pip install marketdx          # add [pandas] for .to_df():  pip install "marketdx[pandas]"
from marketdx import MarketDX

mdx = MarketDX(api_key="avn_live_…")                     # get a key at marketdx.lab.ai
for s in mdx.news(megatrend="ai-power", impact="indirect"):
    print(s.title, [(e.name, e.impact.net_direction) for e in s.entities])

That's the whole graph: every news event, every affected entity, labeled with direction, relevance, the causal aspect (the why), and whether it's the epicenter or a ripple — across five asset classes, including private companies ticker feeds can't see.

No key yet? Explore everything with zero signup in the playground, then grab a free key at marketdx.lab.ai.

Why the SDK (not just requests)

  • Typed graphsignal.entities[0].impact.aspects[0].direction with autocomplete, not raw dicts.
  • Auto-paginationfor s in mdx.news(...) walks every page for you. Nothing to manage.
  • Names, not idsmegatrend="ai-power" or "AI Power & Cooling" or 10040000 all work.
  • .to_df() — the whole result as a pandas DataFrame, one row per (event × entity × aspect).
  • Typed errorsAuthError, QuotaError, RateLimitError, BadRequestError, NotFoundError.

The graph, a few ways

# 1. Ripple: a themed event that also touches NON-thematic entities (our differentiator)
for s in mdx.news(megatrend="semiconductors", impact="indirect", max_items=50):
    ...

# 2. Beyond tickers: private companies in a trend (OpenAI, Anthropic, Ampere, ChangXin…)
for c in mdx.megatrends("semiconductors").off_coverage():
    print(c.name, c.type, "→", c.megatrend["node_name"])

# 3. Per-stock impact timeline + its news-derived rivals
tl    = mdx.stock("NVDA.US").news(aspect="competition")
peers = mdx.stock("NVDA.US").competitors()

# 4. News-driven screen — where the news leans positive on a theme (the model's read, for research)
positive_lean = mdx.stocks(megatrend="ai-power", direction="pos", country="US", order_by="news_count")

# 5. Semantic search — match news by MEANING, not keywords
hits = mdx.news_search("chip export controls to China")

Straight to pandas

.to_df() returns the same columns as the sample dataset (impact-signals.csv) — so anything you prototyped on the free CSV runs unchanged on the live graph:

df = mdx.news(megatrend="ai-power", impact="indirect").to_df()
# published_at · title · brief_text · entity_name · entity_ticker · entity_type · direction ·
# aspect · reason · relevance · impact · impact_score · node_name · entity_country · publisher · url

df.groupby(["entity_type", "direction"]).size()      # who the news lands on, +/− by asset class (the model's read)
df[df.aspect == "tariff"].entity_name.value_counts()  # who the tariff channel touches

Filtering — read this before you filter

Feed filters are EVENT-level, not row-level. news(direction=…, aspect=…, news_type=…, country=…) selects articles that contain at least one matching impact and returns the whole article with all its entities and aspects. So direction="pos" can return an article that also moves something neg, and aspect="supply" can return one whose other entities are hit via monetary. For exact per-row filtering, post-filter the entities:

for s in mdx.news(news_type="commodity_supply", direction="pos"):
    for e in s.entities:
        for a in (e.impact.aspects if e.impact else []):
            if e.type == "commodity" and a.direction == "pos" and a.aspect == "supply":
                ...   # exact row you asked for

Two different "direct" axes (don't conflate):

  • Signal.impact_type (direct|indirect) = the article's relation to the queried node — epicenter (direct) vs ripple (indirect). Set by news(megatrend=…, impact="indirect").
  • Entity.direct (True|False) = whether that entity is factually mentioned in the article (True) vs impact-only / not named (False).

Query by asset class or ticker (the feed does not filter by entity_type/ticker):

mdx.news(news_type="commodity_supply")                 # asset-class on the feed → then post-filter e.type
mdx.news_search("oil supply shock", entity_type="commodity")  # search DOES support entity_type
mdx.news_by_tickers("NVDA.US")                          # a covered STOCK's news (direct + indirect)
mdx.megatrends("ai-power").off_coverage()              # private / off-coverage roster

Only entities with a scored impact (many are mentioned-only):

scored = [e for s in mdx.news(megatrend="ai-power") for e in s.entities if e.impact and e.impact.aspects]

stock(t).news() is a stock-centric timeline — a StockNews (the stock's own impact /trend/ relevance), not an entity graph (no entities[]). For the full graph of an article, use news().

Metering & errors

Every call carries X-Credits-Charged / X-RateLimit-*; check your balance any time (free, unmetered):

mdx.account()   # {'plan': …, 'credits': {'balance', 'daily_quota', 'resets_at', 'unlimited'}, 'rate_limit': …}
from marketdx.errors import QuotaError, RateLimitError

try:
    signals = mdx.news(megatrend="ai-power").to_list()
except RateLimitError as e:
    time.sleep(e.retry_after or 1)
except QuotaError:
    ...   # daily quota spent — resets 00:00 UTC

Enum values (aspect, direction, entity_type, …) are type hints for your editor — the API is the source of truth, so new values work without upgrading the SDK. The live list: mdx.enums().

Reference

news · news_search · news_types · megatrends (.stocks / .off_coverage) · gics (.stocks) · stocks (search + screener) · stock (.news / .competitors / .peers) · enums · account. Full API docs: marketdx.lab.ai.

License

MIT. Built by MarketDXdemocratizing financial data.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

marketdx-0.2.0.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

marketdx-0.2.0-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file marketdx-0.2.0.tar.gz.

File metadata

  • Download URL: marketdx-0.2.0.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for marketdx-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7b70e9a1a567dbf1ab54ae34a407b525d6985edec676eebe97c6d5038697f5c3
MD5 b04c670c8b26b3746694f33eb49bd940
BLAKE2b-256 dc746c0a54e90945564a13664f1b18e26685fc99c3182288a4d4d3aa9263e0c7

See more details on using hashes here.

File details

Details for the file marketdx-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: marketdx-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for marketdx-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec60a9fd7b4d7a3e664f3a80479bff83df14aaae5f993ccd4dcad15b58455c06
MD5 d6edc31497e2b0bac2d035d71a059e3e
BLAKE2b-256 55dcac834b691211b1366c5359fc15ee0c686aee19edae2a471ff5b031f8c597

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page