Getting started overview
Getting started with Styvio involves a sequence of steps to establish API access and make an initial data request. This process typically includes creating a Styvio account, locating your API key, and then executing a basic API call using either cURL or one of the provided Software Development Kits (SDKs).
Styvio provides financial market data, including real-time and historical stock, options, forex, and cryptocurrency data, which can be integrated into various applications for quantitative analysis and trading. The platform offers a free tier with 50 API requests per day, suitable for initial testing and small-scale development. Paid plans offer increased request limits and additional features.
The following table summarizes the key steps to begin using Styvio:
| Step | What to do | Where |
|---|---|---|
| 1. Account Creation | Register for a Styvio account. | Styvio homepage |
| 2. API Key Retrieval | Locate your unique API key in the Styvio dashboard. | Styvio user dashboard |
| 3. Install SDK (Optional) | Install the relevant SDK (Python, Node.js, Go) if not using cURL. | Styvio documentation |
| 4. Make First Request | Execute an API call to retrieve market data. | Code editor/terminal |
| 5. Explore Documentation | Review API reference for additional endpoints and parameters. | Styvio API reference |
Create an account and get keys
To access Styvio's APIs, developers must first create an account and then obtain their unique API key. The API key serves as the primary method of authenticating requests to the Styvio platform, ensuring that only authorized applications can retrieve data.
-
Navigate to the Styvio homepage: Open your web browser and go to Styvio's official website.
-
Sign Up: Look for a "Sign Up" or "Get Started" button, typically located in the top right corner of the page. Click on it to initiate the registration process.
-
Provide Registration Details: You will be prompted to enter an email address, create a password, and potentially provide other basic information. Agree to the terms of service and privacy policy.
-
Verify Email (if required): Some registration flows include an email verification step. Check your inbox for a confirmation email from Styvio and follow the instructions to verify your account.
-
Log In to Your Dashboard: Once registered and verified, log in to your Styvio user dashboard using your newly created credentials.
-
Locate API Key: Within the dashboard, navigate to a section typically labeled "API Keys," "Developer Settings," or "My Apps." Your unique API key will be displayed here. It is a long string of alphanumeric characters. For security, treat this key as sensitive information and do not expose it in client-side code or public repositories.
Once you have your API key, it should be included in every request to the Styvio API, usually as a query parameter or an HTTP header, as specified in the Styvio API reference documentation.
Your first request
After obtaining your API key, the next step is to make a successful API request to confirm your setup. This example demonstrates how to retrieve real-time stock data for a specific symbol using both cURL and Python. Replace YOUR_API_KEY with the actual key retrieved from your Styvio dashboard.
Using cURL
cURL is a command-line tool for making HTTP requests and is useful for quick testing without needing to write code.
curl -X GET "https://api.styvio.com/v1/stock/quote?symbol=AAPL&apikey=YOUR_API_KEY"
This command sends a GET request to Styvio's /v1/stock/quote endpoint, requesting real-time data for Apple (AAPL) using your API key. A successful response will return JSON formatted data similar to the following:
{
"symbol": "AAPL",
"price": 170.12,
"volume": 75000000,
"timestamp": 1678886400
}
Using Python
For programmatic access, Styvio provides an official Python SDK. First, install the SDK:
pip install styvio-sdk
Then, you can make a request using the following Python code:
import styvio
# Initialize the Styvio client with your API key
client = styvio.Client(api_key="YOUR_API_KEY")
try:
# Fetch real-time stock quote for AAPL
quote = client.stock.get_quote(symbol="AAPL")
print(quote)
except styvio.exceptions.StyvioAPIError as e:
print(f"API Error: {e.message}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
This Python script initializes the Styvio client with your API key and then calls the get_quote method to fetch the real-time stock data for AAPL. The output will be a dictionary containing the stock quote details.
For more details on the Python SDK and other available methods, consult the Styvio Python SDK documentation.
Common next steps
Once you have successfully made your first request, consider these common next steps to further integrate Styvio into your development workflow:
-
Explore Other Endpoints: Review the Styvio API reference to discover other available data endpoints, such as historical data, options data, or forex data. Understand the parameters and response structures for each endpoint.
-
Implement Error Handling: Integrate robust error handling into your application. The API reference details common error codes and messages that Styvio may return, such as authentication failures (e.g., invalid API key) or rate limit exceeded errors. For example, HTTP status codes provide a standardized way to interpret API responses.
-
Manage Rate Limits: Be aware of the Styvio rate limits associated with your account tier. Implement mechanisms in your application to handle rate limiting gracefully, such as exponential backoff, to avoid exceeding your daily or per-second request quotas.
-
Secure Your API Key: Ensure your API key is stored securely and not hardcoded directly into your application's source code, especially in production environments. Use environment variables, secret management services, or secure configuration files. For example, AWS offers Secrets Manager for secure storage of credentials.
-
Integrate with Webhooks (if available): If Styvio offers webhook functionality, explore how to use them for real-time notifications of specific events, such as significant price movements or data updates, reducing the need for constant polling.
-
Upgrade Your Plan: If your application requires more requests or advanced features beyond the free tier, review the Styvio pricing page and upgrade your subscription.
Troubleshooting the first call
When making your first Styvio API call, you might encounter common issues. Here are some troubleshooting tips:
-
Invalid API Key: Double-check that you have copied your API key correctly from your Styvio dashboard. Ensure there are no leading or trailing spaces and that it's placed in the correct parameter (
apikey) or header as specified in the Styvio API documentation. -
Incorrect Endpoint or Parameters: Verify that the base URL for the API endpoint is correct (e.g.,
https://api.styvio.com/v1/stock/quote). Also, confirm that all required parameters, such assymbol, are included and correctly formatted. The API reference provides exact endpoint paths and parameter requirements. -
Rate Limit Exceeded: If you receive a
429 Too Many Requestserror, you have likely exceeded the request limit for your current plan. The free tier has a limit of 50 requests per day. Wait for the rate limit to reset or consider upgrading your plan. Check the Styvio documentation on rate limits for details. -
Network Issues: Ensure your internet connection is stable and that there are no firewalls or proxies blocking outgoing HTTP requests from your development environment. Testing with a simple cURL command from a different network can help diagnose this.
-
SDK Configuration: If using an SDK (e.g., Python), ensure it is correctly installed and initialized with your API key. Refer to the specific Styvio SDK documentation for setup instructions.
-
JSON Parsing Errors: If the API returns data but your application fails to parse it, verify that your parsing logic correctly handles the JSON response structure. Use online JSON validators to inspect the raw response if necessary.
-
Check Status Page: Occasionally, API services can experience downtime. Check the Styvio status page (if available, typically linked from their main documentation or support portal) to see if there are any ongoing incidents affecting the service.