stocktwits
The StockTwits MCP server is a social communications platform for market and investing enthusiasts, enabling integration of social features into financial applications.
The StockTwits MCP server offers a robust platform for integrating social communication features into financial applications, targeting market and investing enthusiasts. It allows developers to leverage the StockTwits community by embedding curated conversation streams around securities and financial topics. The server supports JSON format for API responses and emphasizes OAuth 2.0 for secure authentication. Developers can access public data by default, with options for broader permissions. The server enforces rate limits and provides detailed error and response codes to facilitate effective error handling. Adherence to display guidelines ensures consistent integration of StockTwits features, including cashtag linking and character counting for messages. StockTwits supports discussions for a wide range of financial instruments using $TICKER cashtags, with a symbology file available for reference.
Features
- Authentication: Utilizes OAuth 2.0 for secure access to user accounts, with options for broader permissions.
- Rate Limits: Enforces limits on API calls based on authorization method and authentication requirements.
- Error and Response Codes: Provides JSON responses with HTTP status codes and error messages for effective error handling.
- Display Guidelines: Ensures consistent integration of StockTwits features with specific guidelines for logos and graphics.
- Cashtag Linking and Character Counting: Supports autolinking and extraction of cashtags, adhering to character limits.
MCP Tools
- watchlists/index: Returns a list of private watchlists for the authenticating user.
- watchlists/show: Provides the list of ticker symbols in a specified watchlist, identified by the list's ID.
- blocks/create: Blocks a user, preventing the authenticating user from receiving messages from them.
- blocks/destroy: Unblocks a user, allowing message reception from them.
- messages/like: Likes a message on StockTwits on behalf of the authenticating user.
- messages/show: Displays details of a specified message.
- messages/unlike: Unlikes a message on behalf of the authenticating user.
- messages/create: Allows creation of a StockTwits message, with options to upload accompanying charts.
- streams/mentions: Retrieves the most recent 30 messages containing mentions of the authenticating user's handle.
- streams/user: Fetches the most recent 30 messages for a specified user.
- streams/direct: Returns the most recent 30 direct messages sent to the authenticating user.
- streams/home: Provides the most recent 30 messages posted to the authenticating user's home stream.
- streams/symbol: Retrieves the most recent 30 messages for a specified symbol.
- streams/investor_relations: Returns messages posted by verified Investor Relations customers.
- streams/friends: Fetches messages from the authenticating user's people stream.
- streams/watchlist: Provides messages for the specified watchlist of the authenticating user.
Usage with Different Platforms
python
python
import requests
def get_user_stream(user_id, access_token):
url = f'https://api.stocktwits.com/api/2/streams/user/{user_id}.json'
headers = {'Authorization': f'Bearer {access_token}'}
response = requests.get(url, headers=headers)
return response.json()
javascript
javascript
const fetch = require('node-fetch');
async function getUserStream(userId, accessToken) {
const url = `https://api.stocktwits.com/api/2/streams/user/${userId}.json`;
const response = await fetch(url, {
headers: {
'Authorization': `Bearer ${accessToken}`
}
});
return response.json();
}