### Install PyTickerTick Python Wrapper Source: https://github.com/hczhu/tickertick-api/blob/master/README.md Instructions to install the PyTickerTick Python API wrapper using pip, enabling easier programmatic interaction with the TickerTick API from Python applications. ```Python pip install pytickertick ``` -------------------------------- ### Quickstart: Fetch Latest News for a Ticker Source: https://github.com/hczhu/tickertick-api/blob/master/README.md Demonstrates how to quickly retrieve a specified number of the latest news stories for a given stock ticker using a direct URL, allowing for easy modification of the ticker and story count. ```HTTP Request https://api.tickertick.com/feed?q=z:aapl&n=200 ``` -------------------------------- ### Example JSON Response for Ticker Search (aa) Source: https://github.com/hczhu/tickertick-api/blob/master/README.md This JSON example demonstrates the response format for the `/tickers` endpoint when searching for tickers matching 'aa'. It shows an array of objects, each containing a `ticker` and `company_name`. ```json { "tickers": [ { "ticker": "aapl", "company_name": "Apple Inc." }, { "ticker": "aal", "company_name": "American Airlines Group, Inc." } ] } ``` -------------------------------- ### Example JSON Response for Ticker Search (Ama) Source: https://github.com/hczhu/tickertick-api/blob/master/README.md This JSON example demonstrates the response format for the `/tickers` endpoint when searching for tickers matching 'Ama'. It shows an array of objects, each containing a `ticker` and `company_name`. ```json { "tickers": [ { "ticker": "amzn", "company_name": "Amazon.com, Inc." }, { "ticker": "amag", "company_name": "AMAG Pharmaceuticals, Inc." } ] } ``` -------------------------------- ### TickerTick API Complex Query Syntax Examples Source: https://github.com/hczhu/tickertick-api/blob/master/README.md Illustrates how to construct complex queries using logical operators (AND, OR, DIFF) and various filters like ticker symbols (tt:), sources (s:), and entities (E:). These examples demonstrate filtering news stories based on specific criteria and combining multiple conditions. ```APIDOC Example Queries: - Query: (and tt:aapl s:sec) Semantics: SEC filings from Apple Inc. (ticker: aapl) API Call URL: https://api.tickertick.com/feed?q=(and%20tt:aapl%20s:sec) - Query: (or tt:meta tt:aapl tt:amzn tt:nflx tt:goog) Semantics: News stories about FAANG stocks API Call URL: https://api.tickertick.com/feed?q=(or%20tt:meta%20tt:aapl%20tt:amzn%20tt:nflx%20tt:goog) - Query: (and (or tt:meta tt:goog) s:reddit) Semantics: News stories about Meta (meta) and Google (goog) from reddit.com API Call URL: https://api.tickertick.com/feed?q=(and%20(or%20tt:meta%20tt:goog)%20s:reddit) - Query: (diff (or tt:meta tt:goog) s:reddit) Semantics: News stories about Meta (meta) and Google (goog) not from Reddit.com API Call URL: https://api.tickertick.com/feed?q=(diff%20(or%20tt:meta%20tt:goog)%20s:reddit) - Query: (diff E:elon_musk s:nytimes) Semantics: Stories with Elon Musk in titles not from The New York Times API Call URL: https://api.tickertick.com/feed?q=(diff%20E:elon_musk%20s:nytimes) ``` -------------------------------- ### Example JSON Response for News Feed Stories Source: https://github.com/hczhu/tickertick-api/blob/master/README.md This JSON example illustrates the structure of a news feed response, showing an array of story objects with various fields like ID, title, URL, and tags. It demonstrates the typical data returned when querying the news feed API with specific parameters. ```json { "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" } ``` -------------------------------- ### API Endpoint: GET /feed - Retrieve Latest News Stories Source: https://github.com/hczhu/tickertick-api/blob/master/README.md Documents the primary API endpoint for fetching news stories, detailing its purpose, an example request URL, and available parameters for filtering and pagination of results. ```APIDOC GET https://api.tickertick.com/feed Description: 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 Parameters: q (string, required): Description: The query string. Options: Any query string in a query language (explained below). Example: (or tt:aapl tt:amzn) n (integer, optional): Description: How many news stories to fetch. Options: Any number between 1 and 1000. Example: 42 last (integer, optional): Description: A story id for pagination. Fetch news stories older than the story with this id. Options: A 64-bit integer. Each returned news story has an id. Example: 6844326865886118959 ``` -------------------------------- ### API Endpoint: GET /tickers for Stock Ticker Search Source: https://github.com/hczhu/tickertick-api/blob/master/README.md This section describes the `GET /tickers` API endpoint, used for searching stock tickers. It outlines the required parameters `p` (query string) and `n` (number of results) and specifies that the response is a JSON string containing matched stock tickers. ```APIDOC Endpoint: GET https://api.tickertick.com/tickers Parameters: p: string Description: The query string to match the company name or the stock ticker. Options: Any string. Example: Tesl n: integer Description: How many tickers to return at most. Options: Any integer. Example: 4 Response: The returned result is a JSON string consisting of all matched stock tickers. ``` -------------------------------- ### API Query Language Term Semantics Source: https://github.com/hczhu/tickertick-api/blob/master/README.md Details the various terms available in the TickerTick API's query language, including their semantics and examples for filtering news by stock ticker, domain, entity, and specific story types. ```APIDOC Term: z:stock_ticker Semantics: Request news stories about stock_ticker. Examples: z:aapl, z:tsla Term: tt:stock_ticker Semantics: Request more broad news stories about stock_ticker (more news stories than z:stock_ticker) Examples: tt:aapl, tt:tsla Term: s:domain_name Semantics: Request news stories from websites on domain domain_name (domain_name shouldn't contain '.' or '/') Examples: s:wsj, s:cnbc Term: E:any_entity Semantics: Request news stories with titles semantically matching any_entity. (replace any whitespace in any_entity by '_' ) (any_entity should be in lower case) Examples: E:shiba_inu, E:rent_the_runway, E:elon_musk, E:zoom Term: T:story_type Semantics: Request news stories of a specific type. See the list of all story types. Examples: T:curated, T:sec ``` -------------------------------- ### Example JSON Structure of an Important News Story Source: https://github.com/hczhu/tickertick-api/blob/master/docs/Retrieve-most-important-news.md This JSON object illustrates a news story identified as important by the Tickertick API. It includes the story's title, relevant tags (e.g., 'amzn', '_best_'), and a list of 'similar_stories' IDs, indicating its membership in a cluster of related news. ```JSON { "title": "Amazon plans to start delivering packages by drone in Texas later this year", "tags": [ "amzn", "_best_" ], "similar_stories": [ "7861538917579425004", "1801298483307348605", "-6273779958355143798", "1915490391207104498", "7429249118825970200" ] } ``` -------------------------------- ### Fetch SEC Filings for Apple Inc. using PyTickerTick Source: https://github.com/hczhu/tickertick-api/blob/master/README.md Illustrates how to use the PyTickerTick Python wrapper to query for specific news stories, such as SEC filings related to Apple Inc., demonstrating the use of query objects for complex filtering. ```Python 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. ``` -------------------------------- ### TickerTick API Pagination and Filtering with URL Parameters Source: https://github.com/hczhu/tickertick-api/blob/master/README.md Demonstrates how to use URL parameters like 'last' for pagination and 'n' for limiting the number of results, in conjunction with a query 'q'. This allows for fetching specific batches of stories from the API, enabling efficient data retrieval. ```APIDOC Example API Calls: - Parameters: q=tt:amzn, last=1866158884274957563, n=5 Semantics: Get 5 stories about Amazon(amzn) older than story with id 1866158884274957563 API Call URL: https://api.tickertick.com/feed?q=tt:amzn&last=1866158884274957563&n=5 ``` -------------------------------- ### API Query Language Grammar Definition Source: https://github.com/hczhu/tickertick-api/blob/master/README.md Defines the context-free grammar for the TickerTick API's query language, outlining the structural rules for constructing valid queries using terms and logical operators. ```APIDOC 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 ``` -------------------------------- ### API Query Language Operator Semantics Source: https://github.com/hczhu/tickertick-api/blob/master/README.md Explains the meaning and usage of the logical operators (`and`, `or`, `diff`) within the TickerTick API's query language, detailing how they combine or differentiate query results. ```APIDOC Operator: (and query_list) Semantics: Request news stories matching all queries in query_list Operator: (or query_list) Semantics: Request news stories matching any query in query_list Operator: (diff query1 query2) Semantics: Request news stories matching query1 but not query2 ``` -------------------------------- ### API Response Structure for News Feed Stories Source: https://github.com/hczhu/tickertick-api/blob/master/README.md This section details the JSON structure of the news feed response, which is an array of story objects. Each story object contains fields such as ID, title, URL, site, timestamp, and optional fields like tags, similar stories, and description. The `id` field can be used for pagination. ```APIDOC Response JSON Structure: stories: array of story objects (in reverse chronological order) Each story object has the following fields: id: string Description: A unique string id of the story. The `id` can be used for pagination as the value of the parameter `last`. title: string Description: The title of the news story. url: string Description: The url of the news story. site: string Description: The source website of the news story. time: number Description: 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: string Description: The url of the favicon of the source website. tags: array of strings Description: 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: array of strings Description: 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: string Description: The description of the news story. This field is optional. ``` -------------------------------- ### TickerTick API Story Types Reference Source: https://github.com/hczhu/tickertick-api/blob/master/README.md Defines various story types that can be used as query terms in the TickerTick API to filter news stories. Each type corresponds to a specific category of financial or technology news, allowing users to narrow down search results effectively. ```APIDOC Story Types: - T:curated: News stories from a curated list of top financial/technology news sources. Example Query: T:curated - T:earning: Company earnings news (e.g. presentations, transcripts). Example Query: T:earning - T:market: Stock market news. Example Query: T:market - T:sec: SEC filings. Example Query: T:sec - T:sec_fin: Quarterly/annual financial reports. Example Query: T:sec_fin - T:trade: Trading news. Example Query: T:trade - T:ugc: News stories from a curated list of user-generated content platforms, e.g. Reddit. Example Query: T:ugc - T:analysis: Stock analysis articles from a curated list of sources. Example Query: T:analysis - T:industry: Industry publications from a curated list of sources. Example Query: T:industry ``` -------------------------------- ### Tickertick API Query for Important News Stories Source: https://github.com/hczhu/tickertick-api/blob/master/docs/Retrieve-most-important-news.md This query retrieves candidate news stories for specified tickers (META, AMZN). It combines terms for direct ticker mentions with a condition for 'best' tagged stories related to financial news, analysis, or industry, while excluding general trade, market, or user-generated content. ```Query Language (diff (or (or (or TT:meta TT:amzn) (and tag:_best_ (or tt:meta tt:amzn) (or T:fin_news T:analysis T:industry)))) (or T:trade T:market T:ugc)) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.