Overview
Migrating from Sectors Financial API v1 to v2 is straightforward for most endpoints. The v2 API offers improved performance, better data structures, enhanced filtering capabilities, and natural language query support.General Migration Pattern
For most endpoints, migration is as simple as updating the URL path from/v1/ to /v2/:
While most endpoints follow this pattern, some endpoints have been redesigned with enhanced functionality. See the sections below for specific migration paths.
Endpoint-Specific Migrations
The following endpoints have improved functionality in v2 and require specific migration instructions:1. Companies by Index
v1 Limitation: Could only query from a single index at a time.- Query multiple indices simultaneously
- Use natural language queries for easier filtering
- More flexible filtering with SQL-like syntax
2. Top Companies Ranked
v1 Limitation: Limited to specific classifications:dividend_yield, total_dividend, revenue, earnings, market_cap, pb, pe, ps.
- Sort by any available metric, not just predefined classifications
- Combine sorting with advanced filtering
- Specify year or quarter for time-series data
- More flexible and powerful queries
3. Top Companies by Growth
v1 Limitation: Limited growth metrics and filtering options.- More granular growth metrics
- Natural language queries for complex filters
- Combine multiple filters easily
- Negative sign (
-) for descending order
Key Improvements in v2
Natural Language Queries
Use the
q parameter to query data using plain English, making complex filters easier to write.SQL-like Filtering
Use the
where parameter with SQL-like syntax for precise, powerful filtering.Flexible Sorting
Sort by any available metric using
order_by, with support for time-series data.Better Performance
Optimized query engine delivers faster responses and handles complex queries efficiently.
Migration Checklist
Refactor Special Endpoints
Update the three special endpoints (Companies by Index, Top Companies Ranked, Top Companies by Growth) using the examples above.
Test Thoroughly
Test all endpoints in a development environment to ensure responses match expectations.
