Giter Club home page Giter Club logo

tickertick-api's Introduction

Introduction

Welcome to the TickerTick API.

The TickerTick API provides the latest stock news stories through a powerful query language. The API covers all companies listed in US stock markets (around 10,000 tickers) and hundreds of top startups. The source websites of the news stories include around ten thousand websites.

Take a look at the following apps built on top of TickerTick API.

Terms of Use

  • The API is free of commercial/non-commercial use.
  • All endpoints have a rate limit of 10 requests per minute from the same IP address. The service enforces this. More precisely, an IP will be blocked for one minute if more than 10 requests are sent within any 1 minute time window.
  • You are welcome to file an issue if you see any problem, like irrelevant stories.

⚠️ An IP address has a rate limit of 10 requests per minute. DM me on Twitter if you need a higher request rate.

Quickstart

Use this URL to get the 200 latest news stories for ticker aapl (Apple Inc.).

https://api.tickertick.com/feed?q=z:aapl&n=200

You can replace aapl (the ticker) and 200 (the number of news stories to fetch).

Quickstart with PyTickerTick

PyTickerTick: an API wrapper for the TickerTick API in Python

pip install pytickertick
import tickertick as tt
import tickertick.query as query

feed = tt.get_feed(
    query = query.And(
        query.BroadTicker('aapl'),
        query.StoryType(query.StoryTypes.SEC)
    )
) # SEC filings from Apple Inc.

Historical data

If you are looking for historical data, e.g., all stock news stories from the past two years, check out the releases pages.

Endpoints

This endpoint returns a feed of the latest news stories relevant to the query in reverse chronological order.

Example request URL

News stories about Apple Inc. (its ticker is aapl) - https://api.tickertick.com/feed?q=tt:aapl

Rendered stock news feed for Apple Inc.

Parameters

Parameter Description Options Example value
q The query string Any query string in a query language
(explained below)
(or tt:aapl tt:amzn)
n How many news stories to fetch Any number between 1 and 1000 42
last A story id for pagination.
Fetch news stories older than the story with this id.
A 64-bit integer. Each returned news story has an id. 6844326865886118959

The query language

The query language is a context-free language following the grammar below

query --> term | (and query_list) | (or query_list) | (diff query query)

query_list --> query query_list | term

term --> tt:any_stock_ticker | TT:any_stock_ticker | s:any_website_domain_name | E:any_entity | T:story_type 

Operator semantics

Operator Semantics
(and query_list) Request news stories matching all queries in query_list
(or query_list) Request news stories matching any query in query_list
(diff query1 query2) Request news stories matching query1 but not query2

Term semantics

Term Semantics Examples
z:stock_ticker Request news stories about stock_ticker. z:aapl
z:tsla
tt:stock_ticker Request more broad news stories about stock_ticker (more news stories than z:stock_ticker) tt:aapl
tt:tsla
s:domain_name Request news stories from websites on domain domain_name
(domain_name shouldn't contain '.' or '/')
s:wsj
s:cnbc
E:any_entity Request news stories with titles semantically matching any_entity.
(replace any whitespace in any_entity by _ )
(any_entity should be in lower case)
E:shiba_inu
E:rent_the_runway
E:elon_musk
E:zoom
T:story_type Request news stories of a specific type. See the list of all story types. T:curated
T:sec

Story Types

Term Story type Example query
T:curated News stories from a curated list of top financial/technology news sources T:curated
T:earning Company earnings news (e.g. presentations, transcripts) T:earning
T:market Stock market news T:market
T:sec SEC filings T:sec
T:sec_fin Quarterly/annual financial reports T:sec_fin
T:trade Trading news T:trade
T:ugc News stories from a curated list of user-generated content platforms, e.g. Reddit. T:ugc
T:analysis Stock analysis articles from a curated list of sources T:analysis
T:industry Industry publications from a curated list of sources T:industry

Example queries

Example query Semantics API call URL Rendered stories
(and tt:aapl s:sec) SEC filings from Apple Inc. (ticker: aapl) https://api.tickertick.com/feed?q=(and tt:aapl s:sec) (and tt:aapl s:sec)
(or tt:meta tt:aapl tt:amzn tt:nflx tt:goog) News stories about FAANG stocks https://api.tickertick.com/feed?q=(or tt:meta tt:aapl tt:amzn tt:nflx tt:goog) (or tt:meta tt:aapl tt:amzn tt:nflx tt:goog)
(and (or tt:meta tt:goog) s:reddit) News stories about Meta (meta) and Google (goog) from reddit.com https://api.tickertick.com/feed?q=(and (or tt:meta tt:goog) s:reddit) (and (or tt:meta tt:goog) s:reddit)
(diff (or tt:meta tt:goog) s:reddit) News stories about Meta (meta) and Google (goog) not from Reddit.com https://api.tickertick.com/feed?q=(diff (or tt:meta tt:goog) s:reddit) (diff (or tt:meta tt:goog) s:reddit)
(diff E:elon_musk s:nytimes) Stories with Elon Musk in titles not from The New York Times https://api.tickertick.com/feed?q=(diff E:elon_musk s:nytimes) (diff E:elon_musk s:nytimes)

Example API calls

URL parameters Semanrics API call URL Rendered stories
q=tt:amzn
last=1866158884274957563
n=5
Get 5 stories about Amazon(amzn) older than story with id 1866158884274957563 https://api.tickertick.com/feed?q=tt:amzn&last=1866158884274957563&n=5 q=tt:amzn&last=1866158884274957563&n=5

Response

The response is a JSON blob consisting of an array of stories in reverse chronological order. Each story has the following fields

Story field Description
id A unique string id of the story. The id can be used for pagination as the value of the parameter last.
title The title of the news story.
url The url of the news story.
site The source website of the news story.
time The timestamp of the news story. It's the number of milliseconds since the "Unix epoch", 1970-01-01T00:00:00Z (UTC). The same semantics as Date.now() in Javascript.
favicon_url The url of the favicon of the source website.
tags An array of strings. Each string is the ticker for which the story is. This field is presented only when any tt: term is in the query.
similar_stories An array of strings. Each string is a story ID referencing another story in the response. The referenced stories are considered stories similar to this one. This field is optional.
description The description of the news story. This field is optional.

An example response from request URL https://api.tickertick.com/feed?q=(and T:curated tt:aapl)&n=30

{
  "stories": [
    {
      "id": "426800427666858718",
      "title": "Apple Reality Pro VR Headset: New Leak Reveals Unprecedented Detail",
      "url": "https://www.forbes.com/sites/davidphelan/2023/06/03/apple-reality-pro-vr-headset-new-leak-reveals-unprecedented-detail/",
      "site": "forbes.com",
      "time": 1685790913000,
      "favicon_url": "https://static.tickertick.com/website_icons/forbes.com.ico",
      "tags": [
        "aapl"
      ],
      "similar_stories": [
        "-3592774926732722485",
        "5969505199123739307",
        "-4590978801798836365"
      ],
      "description": "It’s a new mixed-reality headset and it’s a very big deal. It’s a new mixed-reality headset and it’s a very big deal.",
      "tickers": [
        "aapl"
      ]
    },
    ...
    {
      "id": "7335329458973640129",
      "title": "Apple’s Rumored VR Headset Has Sent Its Rivals Scrambling",
      "url": "https://www.wired.com/story/apple-vr-headset-sent-rivals-scrambling/",
      "site": "wired.com",
      "time": 1685790000000,
      "favicon_url": "https://static.tickertick.com/website_icons/wired.com.ico",
      "tags": [
        "aapl"
      ],
      "description": "If Apple announces a highly anticipated VR headset at its upcoming Worldwide Developers Conference, it may validate work by other companies in the industry.",
      "tickers": [
        "aapl"
      ]
    },
    {
      "id": "-560799274878500337",
      "title": "PayPal: Don't Fear Apple Pay And Stripe | $AAPL $AXP $MA $V $PYPL",
      "url": "https://seekingalpha.com/article/4609213-paypal-dont-fear-apple-pay-stripe",
      "site": "seekingalpha.com",
      "time": 1685787446000,
      "favicon_url": "https://static.tickertick.com/website_icons/seekingalpha.com.ico",
      "tags": [
        "aapl"
      ],
      "tickers": [
        "aapl"
      ]
    }
  ],
  "last_id": "-560799274878500337"
}

Parameters

Parameter Description Options Example value
p The query string to match the company name or the stock ticker. Any string. Tesl
n How many tickers to return at most. Any integer. 4

Response

The returned result is a JSON string consisting of all matched stock tickers.

Example

Search for any tickers matching Ama - https://api.tickertick.com/tickers?p=Ama&n=2

{
  "tickers": [
    {
      "ticker": "amzn",
      "company_name": "Amazon.com, Inc."
    },
    {
      "ticker": "amag",
      "company_name": "AMAG Pharmaceuticals, Inc."
    }
  ]
}

Search for any tickers matching aa - https://api.tickertick.com/tickers?p=aa&n=2

{
  "tickers": [
    {
      "ticker": "aapl",
      "company_name": "Apple Inc."
    },
    {
      "ticker": "aal",
      "company_name": "American Airlines Group, Inc."
    }
  ]
}

Contact

HC Zhu - mail AT tickertick.com - @hzhu_

Acknowledgments

SpaCy

The backend of TickerTick API uses an English Transformer pipeline, en_core_web_trf, from spaCy to extra named entities from text and accomplish other NLP tasks.

MediaWiki API

The backend of TickerTick API uses MediaWiki API to get entities related to a ticker, e.g. Elon Musk for TSLA, and WhatsApp for FB.

Favicon Grabber

The backend of TickerTick API uses Favicon Grabber to fetch website favicons.

API use cases

TickerTick.com

TickerTick.com provides the broadest stock news.

Big Tech News Twitter bot

Big Tech News uses TickerTick API to fetch news about big tech.

Trading Saga

Trading Saga is a quick and immersive trading game and uses TickerTick API to fetch stock news.

tickertick-api's People

Contributors

hczhu avatar pennacap avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tickertick-api's Issues

UTC Timestamp in Query

Would be great to query by timestamp. For example, those cases in README could have a (and () before_utc: 1636624740000) and (and () after_utc: 1636624740000)

Feature Request: API Parameter for Fetching News Newer Than a Given Timestamp or ID

Currently, the TickerTick API does not support fetching news stories that are newer than a specific timestamp or story ID. This feature would be extremely beneficial for applications that require real-time updates or continuous polling for new stories.

Use Cases
Real-time news tracking and notifications.
Efficient data synchronization and updates without redundant polling.

Limit number of stories per symbol

Is there an option to set the n limit of stories per symbol in the query string? For example, fetching stories with TSLA and WM will return an overwhelming amount of stories about TSLA only.

Commercial use/ Request limits

I really like your API and was wondering if the API is free of use.

I couldn't find any information about commercial / non-commercial usage or request limitations.

Could you maybe add paragraph about this to the documentation?

False positives

News data delay of about 5 hours?

Thank you @hczhu for your work! Can you please comment on this "issue"
While comparing to another stock news API I've found a delay of about 5 hours in timestamps.
Is it supposed to be like that or am I missing something (different timezone maybe)?

Issue with `hours_ago` and `last_id`

Hello @hczhu, thanks for your work on this API and for making it publicly available.
I have been playing with it and found an issue.
Please refer to the example provided below:

  • Url https://api.tickertick.com/feed?q=(and tt:aapl T:market)&n=2 returns the expected value:

{'stories': [{'id': '8060448778134876128', 'title': 'Walden Wealth Partners LLC Acquires Shares of 36,698 Apple Inc. (NASDAQ:AAPL)', 'url': 'https://www.tickerreport.com/banking-finance/12161795/walden-wealth-partners-llc-acquires-shares-of-36698-apple-inc-nasdaqaapl.html', 'site': 'tickerreport.com', 'time': 1718725961000, 'favicon_url': 'https://static.tickertick.com/website_icons/tickerreport.com.ico', 'tags': ['aapl'], 'description': 'Walden Wealth Partners LLC bought a new position in shares of Apple Inc. (NASDAQ:AAPL – Free Report) in the 4th quarter, according to its most recent filing with the Securities and Exchange Commission (SEC). The firm bought 36,698 shares of the iPhone maker’s stock, valued at approximately $7,065,000. Apple comprises approximately 4.4% of Walden Wealth […]', 'tickers': ['aapl']}, {'id': '-2915903165289240372', 'title': 'Ables Iannone Moore & Associates Inc. Purchases Shares of 111,343 Apple Inc. (NASDAQ:AAPL)', 'url': 'https://www.etfdailynews.com/2024/06/18/ables-iannone-moore-associates-inc-purchases-shares-of-111343-apple-inc-nasdaqaapl/', 'site': 'etfdailynews.com', 'time': 1718717561000, 'favicon_url': 'https://static.tickertick.com/website_icons/etfdailynews.com.ico', 'tags': ['aapl'], 'description': 'Ables Iannone Moore & Associates Inc. acquired a new position in Apple Inc. (NASDAQ:AAPL – Free Report) in the fourth quarter, according to its most recent Form 13F filing with the Securities & Exchange Commission. The institutional investor acquired 111,343 shares of the iPhone maker’s stock, valued at approximately $21,437,000. Apple makes up approximately 16.4% […]', 'tickers': ['aapl']}], 'last_id': '-2915903165289240372'}

Now Adding Hours ago

  • Url https://api.tickertick.com/feed?q=(and tt:aapl T:market)&hours_ago=8760&n=2 returns an empty list

{'stories': []}

Edit: This query seems to be working only for hours_ago < 5280

Changing the query to only selecting aapl

  • Url: https://api.tickertick.com/feed?q=tt:aapl&hours_ago=8760&n=2 also returns the expected value

{'stories': [{'id': '-4012295211890964378', 'title': 'Apple Inc.: Form 4 - Statement of changes in beneficial ownership of securities', 'url': 'https://www.sec.gov/Archives/edgar/data/320193/000032019323000070/0000320193-23-000070-index.htm', 'site': 'sec.gov', 'time': 1684449141000, 'favicon_url': 'https://static.tickertick.com/website_icons/sec.gov.ico', 'tags': ['aapl'], 'tickers': ['aapl']}, {'id': '7750426920303047447', 'title': 'Apple Inc.: Form 4 - Statement of changes in beneficial ownership of securities', 'url': 'https://www.sec.gov/Archives/edgar/data/320193/000032019323000068/0000320193-23-000068-index.htm', 'site': 'sec.gov', 'time': 1683930634000, 'favicon_url': 'https://static.tickertick.com/website_icons/sec.gov.ico', 'tags': ['aapl'], 'similar_stories': ['-4012295211890964378'], 'tickers': ['aapl']}], 'last_id': '7750426920303047447'}

Issue with last_id

This functionality does not seem to work with hours_ago

Any support here will be appreciated.
Thank You

time values seems to be in accurate

I have checked with several articles that the epoch time returned with an API call does not match with its article published time (which is produced with the article when I visit the url). Any reason for that ?

Curated list with ticker / tags information

Hello,

I'm curious if it's possible to selectively retrieve curated news articles that include ticker information.

For instance, I can gather news specifically about FAANG companies by using the link https://api.tickertick.com/feed?q=(or tt:meta tt:aapl tt:amzn tt:nflx tt:goog), which requires specifying the tickers.

However, what if I want to access the latest curated/market news articles without providing specific tickers but still receive the ticker information to identify which stock the article is related to?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.