/newsRetrieves a broad selection of current news articles across all categories and regions. This endpoint provides a general news feed ideal for staying informed about global events and trending topics.
Examples:
https://api.axionquant.com/newshttps://api.axionquant.com/news?limit=50Response Fields
Same structure as Company News response.
title string
Article headline
link string
Encoded URL to the full article
summary string
Article summary or excerpt
published string
Publication date (RFC 1123 format)
General News
Request
1from axion import Axion
2client = Axion(api_key='axn_123')
3
4news = client.news.general()
5print(news)Response
[
{
"title": "Trump Live Updates: DOJ Says It Has Found 1 Million More Epstein Files - The New York Times",
"link": "https://api.axionquant.com/news/article/aHR0cHM6Ly9uZXdzLmdvb2dsZS5jb20vcnNzL2FydGljbGVzL0NCTWlZMEZWWDNseFRFOTFiMVIzWVhseE1YbE1TSGd3YW1sSFpFcFdiRmhTWjJWTWNYTmtlRmxQWkdGeGN6SlBXSFp3UzFwTExYTlViRGxYWlRKTFRUVjBiVmgwYlUxVWJtUjVla3BYVEhrd1dqaEdXV1l3YUVSSFVrcGxRVTU0YkdvMFFUVlNVUT9vYz01",
"summary": "Trump Live Updates: DOJ Says It Has Found 1 Million More Epstein Files The New York Times\nNews Wrap: DOJ says over a million more Epstein documents discovered PBS\n'It's perpetuated this news cycle': Frustration mounts in Trump's orbit about messaging on latest Epstein documents CNN\nTakeaways from the 3rd Epstein files release: The president, the plane and the prince NBC News\nDOJ says more than 1 million potential Epstein files newly uncovered CNBC",
"published": "Wed, 24 Dec 2025 21:31:18 GMT"
},
{
"title": "Powerful winter storm arrives in Southern California for Christmas holiday. Here's what to know. - CBS News",
"link": "https://api.axionquant.com/news/article/aHR0cHM6Ly9uZXdzLmdvb2dsZS5jb20vcnNzL2FydGljbGVzL0NCTWl0QUZCVlY5NWNVeE9RbUowTTNGdE5XUnNXVFV4U2pKa09VWmZja2h2YWtoTmVHaDJSWFZUZVVwRGVIRkRRV2RVYlc5M1NYZEhMVGxEVUZoa1IxbDZOek5ZUWtscU1WTllWRU5YWVRKcGRtdFlXR1ZaUmtkZmNuVldXRTF6VjJGQlVVcFlSbDgyUjNKMlJtMUVVbUpGTFhoalRqbGhTemhTYldrM1VuUnpVRFEyT0ZGd0xVeFVZMlJKY0hvd2QwSkdVM0JHVWs5cmNUbGlXaTEwUm5abFREQnRURkJtU1V0Nk5tNU9PRGwxV2xoeGRVaGhTVVU_b2M9NQ",
"summary": "Powerful winter storm arrives in Southern California for Christmas holiday. Here's what to know. CBS News\nStorm brings heavy rain, wind; Flash Flood Warning extended for parts of LA and Ventura counties ABC7 Los Angeles\nFlooding Causes Road Closures and Vehicle Rescues Across Hesperia and Surrounding Areas VVNG\nIntense Storm in Southern California Brings Heavy Rain and Forces Evacuations The New York Times\nCalifornia weather: Flash flood warning in effect across SoCal as powerful storm arrives FOX 11 Los Angeles",
"published": "Wed, 24 Dec 2025 14:52:00 GMT"
}
]/news/category/:categoryRetrieves news articles filtered by specific category. This allows for targeted news consumption based on topics such as technology, politics, business, or entertainment.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| category | string | Required | News category (e.g., "business", "technology", "politics", "entertainment") |
Examples:
https://api.axionquant.com/news/category/technologyhttps://api.axionquant.com/news/category/healthcareAvailable Categories
worldGlobal news & events
nationDomestic national news
businessCorporate & financial news
technologyTech industry & innovation
entertainmentMedia & entertainment
scienceResearch & discoveries
sportsSports news & events
healthHealthcare & medical news
Response Fields
Same structure as Company News response.
title string
Article headline
link string
Encoded URL to the full article
summary string
Article summary or excerpt
published string
Publication date (RFC 1123 format)
News by Category
Request
1from axion import Axion
2client = Axion(api_key='axn_123')
3
4news = client.news.category('technology')
5print(news)Response
Response format identical to country news example.
Axion C SDK
The Axion C SDK provides a lightweight, high-performance C library for interacting with the Axion Financial API. This SDK offers direct access to financial data including ESG scores, stock prices, cryptocurrency data, economic indicators, and more. Designed for embedded systems, high-frequency applications, and integration with C/C++ projects.
Installation & Dependencies
The SDK requires libcurl for HTTP requests andcJSON for JSON parsing. Both can be installed via system package managers or included as submodules.
System Dependencies
Ubuntu/Debian
sudo apt-get install libcurl4-openssl-dev libcjson-dev
macOS (Homebrew)
brew install curl cjson
Building from Source
Clone and compile
git clone https://github.com/axionquant/c-sdk.gitcd c-sdk && mkdir build && cd buildcmake .. && makesudo make install # optional
Compiler Flags
Linker flags
# Static linking
-laxion -lcurl -lcjson
# Or pkg-config (if installed)
pkg-config --cflags --libs axionQuick Start
A minimal example that initializes the client, fetches stock data and ESG scores for Apple, and cleans up. Always check for errors and free responses.
Steps
- Include the main header
- Initialize client with your API key
- Make API calls
- Process JSON responses using cJSON
- Free responses and client
Quick Start (C)
#include "axion.h"
#include <stdio.h>
int main() {
AxionClient* client = axion_init("your_api_key_here");
if (!client) return 1;
// Get stock quote for Apple
AxionResponse* quote = axion_stocks_ticker(client, "AAPL");
if (quote && quote->json && !quote->error) {
cJSON* price = cJSON_GetObjectItem(quote->json, "price");
if (cJSON_IsNumber(price))
printf("AAPL Price: %.2f\n", price->valuedouble);
}
axion_response(quote);
// Get ESG data
AxionResponse* esg = axion_esg_data(client, "AAPL");
if (esg && esg->json && !esg->error) {
cJSON* score = cJSON_GetObjectItem(esg->json, "score");
if (cJSON_IsNumber(score))
printf("ESG Score: %.2f\n", score->valuedouble);
}
axion_response(esg);
axion_client(client);
return 0;
}Client Initialization
The SDK follows a traditional C pattern: explicit initialization, manual cleanup, and response structures that must be freed. All API calls return an AxionResponse*.
Core Functions
| Function | Description | Returns |
|---|---|---|
| axion_init(api_key) | Create client, init curl | AxionClient* |
| axion_client(client) | Cleanup client, global curl | void |
| axion_response(resp) | Free response + JSON | void |
Response Structure
AxionResponse
int http_status; - HTTP status code
char *data; - raw JSON string
cJSON *json; - parsed JSON (NULL if invalid)
char *error; - error message (NULL if none)
Error-aware response handling
AxionResponse* resp = axion_esg_data(client, "AAPL");
if (!resp) {
// fatal allocation error
return;
}
if (resp->error) {
fprintf(stderr, "API error: %s\n", resp->error);
} else if (resp->http_status >= 400) {
fprintf(stderr, "HTTP %d error\n", resp->http_status);
} else if (!resp->json) {
fprintf(stderr, "JSON parse failed\n");
} else {
// success, use resp->json
cJSON* score = cJSON_GetObjectItem(resp->json, "score");
// process...
}
axion_response(resp);API Categories
The SDK provides comprehensive coverage of financial data through categorized API functions. Each category follows consistent naming patterns for easy discovery.
Stocks
Tickers, quotes, prices, gainers/losers, listings
axion_stocks_tickers()axion_stocks_ticker()axion_stocks_prices()axion_stocks_gainers()axion_stocks_losers()axion_stocks_quote()axion_stocks_list_*()Crypto
Cryptocurrency data
axion_crypto_tickers()axion_crypto_ticker()axion_crypto_prices()axion_crypto_gainers()axion_crypto_losers()axion_crypto_quote()axion_crypto_list_*()Forex
Currency pairs
axion_forex_tickers()axion_forex_ticker()axion_forex_prices()axion_forex_gainers()axion_forex_losers()axion_forex_quote()axion_forex_list_*()Futures
Futures contracts
axion_futures_tickers()axion_futures_ticker()axion_futures_prices()axion_futures_gainers()axion_futures_losers()axion_futures_quote()axion_futures_list_*()Indices
Market indices
axion_indices_tickers()axion_indices_ticker()axion_indices_prices()axion_indices_gainers()axion_indices_losers()axion_indices_quote()axion_indices_components()axion_indices_exposure()axion_indices_list_*()Profiles
Company information
axion_profiles_profile()axion_profiles_info()axion_profiles_summary()axion_profiles_statistics()axion_profiles_recommendation()axion_profiles_calendar()Financials
Income, balance sheet, cash flow, metrics
axion_financials_revenue()axion_financials_net_income()axion_financials_metrics()axion_financials_snapshot()axion_financials_eps()axion_financials_pe()axion_financials_market_cap()axion_financials_roe()axion_financials_enterprise_value()axion_financials_ebitda()axion_financials_debt_to_equity()axion_financials_balance_sheet()axion_financials_income_statement()axion_financials_cash_flow_statement()Earnings
Earnings history, trends, reports, transcripts
axion_earnings_history()axion_earnings_trend()axion_earnings_index()axion_earnings_report()axion_earnings_transcript()axion_earnings_transcript_sentiment()Filings
SEC filings, forms, search, documents
axion_filings_recent()axion_filings_history()axion_filings_list_forms()axion_filings_search()axion_filings_document_text()axion_filings_document_sentiment()Insiders
Insider trading, ownership, funds
axion_insiders_funds()axion_insiders_individuals()axion_insiders_institutions()axion_insiders_ownership()axion_insiders_activity()axion_insiders_transactions()Sentiment
Social, news, analyst sentiment
axion_sentiment_all()axion_sentiment_social()axion_sentiment_news()axion_sentiment_analyst()Economic
Indicators, calendar, datasets, search
axion_econ_search()axion_econ_find()axion_econ_dataset()axion_econ_calendar()ETF
ETF data, holdings, exposure, weights
axion_etfs_tickers()axion_etfs_ticker()axion_etfs_prices()axion_etfs_fund()axion_etfs_holdings()axion_etfs_holdings_all()axion_etfs_exposure()axion_etfs_weights()axion_etfs_quote()ETF API
Comprehensive ETF data including fund information, holdings, exposure, weights, gainers, and losers.
Available Functions
| Function | Description | Parameters |
|---|---|---|
| axion_etfs_tickers() | Filtered ETF list | country, exchange |
| axion_etfs_ticker() | Current ETF quote | ticker |
| axion_etfs_prices() | Historical prices | ticker, from, to, frame |
| axion_etfs_fund() | Fund overview and details | ticker |
| axion_etfs_holdings() | Top holdings | ticker |
| axion_etfs_holdings_all() | All holdings | ticker |
| axion_etfs_exposure() | Sector and asset exposure | ticker |
| axion_etfs_weights() | Weight allocations | ticker |
| axion_etfs_quote() | Real-time ETF quote | ticker |
| axion_etfs_gainers() | Top gaining ETFs | days, limit |
| axion_etfs_losers() | Top losing ETFs | days, limit |
| axion_etfs_list_market() | Available markets | None |
| axion_etfs_list_country() | Available countries | None |
| axion_etfs_list_currency() | Available currencies | None |
| axion_etfs_list_sector() | Available sectors | None |
| axion_etfs_list_industry() | Available industries | None |
| axion_etfs_list_type() | Available types | None |
ETF Examples
// Get SPY ETF holdings
AxionResponse* holdings = axion_etfs_holdings(client, "SPY");
if (holdings && holdings->json) {
printf("SPY holdings retrieved\n");
}
axion_response(holdings);
// Get all SPY ETF holdings
AxionResponse* allHoldings = axion_etfs_holdings_all(client, "SPY");
if (allHoldings && allHoldings->json) {
printf("SPY all holdings retrieved\n");
}
axion_response(allHoldings);
// Get top gaining ETFs
AxionResponse* gainers = axion_etfs_gainers(client, 7, 10);
if (gainers && gainers->json) {
printf("Top ETF gainers retrieved\n");
}
axion_response(gainers);
// Get ETF exposure
AxionResponse* exposure = axion_etfs_exposure(client, "QQQ");
if (exposure && exposure->json) {
printf("QQQ exposure data retrieved\n");
}
axion_response(exposure);Market Data APIs
All market data endpoints follow consistent patterns: tickers lists, individual ticker quotes, historical prices, gainers/losers, and metadata listings.
Stocks API
| Function | Description | Parameters |
|---|---|---|
| axion_stocks_tickers() | Filtered ticker list | country, exchange |
| axion_stocks_ticker() | Current quote for a ticker | ticker |
| axion_stocks_prices() | Historical prices | ticker, from, to, frame |
| axion_stocks_gainers() | Top gainers | days, limit, market |
| axion_stocks_losers() | Top losers | days, limit, market |
| axion_stocks_quote() | Real-time stock quote | ticker |
| axion_stocks_list_market() | Available markets | None |
| axion_stocks_list_country() | Available countries | None |
| axion_stocks_list_currency() | Available currencies | None |
| axion_stocks_list_sector() | Available sectors | None |
| axion_stocks_list_industry() | Available industries | None |
| axion_stocks_list_type() | Available types | None |
Cryptocurrency API
| Function | Description | Parameters |
|---|---|---|
| axion_crypto_tickers() | List of crypto tickers | type (optional) |
| axion_crypto_ticker() | Current quote (e.g., "BTC-USD") | ticker |
| axion_crypto_prices() | Historical prices | ticker, from, to, frame |
| axion_crypto_gainers() | Top gaining cryptocurrencies | days, limit |
| axion_crypto_losers() | Top losing cryptocurrencies | days, limit |
| axion_crypto_quote() | Real-time crypto quote | ticker |
| axion_crypto_list_category() | Available categories | None |
| axion_crypto_list_rating() | Available ratings | None |
| axion_crypto_list_type() | Available types | None |
Forex API
| Function | Description | Parameters |
|---|---|---|
| axion_forex_tickers() | Filtered forex tickers | country, exchange |
| axion_forex_ticker() | Current forex quote | ticker |
| axion_forex_prices() | Historical forex prices | ticker, from, to, frame |
| axion_forex_gainers() | Top gaining currencies | days, limit |
| axion_forex_losers() | Top losing currencies | days, limit |
| axion_forex_quote() | Real-time forex quote | ticker |
| axion_forex_list_exchange() | Available exchanges | None |
| axion_forex_list_rating() | Available ratings | None |
| axion_forex_list_country() | Available countries | None |
Futures API
| Function | Description | Parameters |
|---|---|---|
| axion_indices_tickers() | Filtered index list | exchange |
| axion_indices_ticker() | Current index value | ticker |
| axion_indices_prices() | Historical index data | ticker, from, to, frame |
| axion_indices_gainers() | Top gaining indices | days, limit |
| axion_indices_losers() | Top losing indices | days, limit |
| axion_indices_quote() | Real-time index quote | ticker |
| axion_indices_list_exchange() | Available exchanges | None |
| axion_indices_list_type() | Available types | None |
Indices API
| Function | Parameters | Description |
|---|---|---|
| axion_indices_tickers() | exchange | Filtered indices list |
| axion_indices_ticker() | ticker | Current index quote |
| axion_indices_prices() | ticker, from, to, frame | Historical index prices |
| axion_indices_gainers() | days, limit | Top gaining indices |
| axion_indices_losers() | days, limit | Top losing indices |
| axion_indices_quote() | ticker | Real-time index quote |
| axion_indices_components() | ticker | Index constituent list |
| axion_indices_exposure() | ticker | Index sector exposure |
| axion_indices_list_exchange() | None | Available exchanges |
| axion_indices_list_timezone() | None | Available timezones |
| axion_indices_list_country() | None | Available countries |
Market Data Examples
// Get NASDAQ stocks
AxionResponse* tickers = axion_stocks_tickers(client, "US", "NASDAQ");
// Get Bitcoin quote
AxionResponse* btc = axion_crypto_ticker(client, "BTC-USD");
// Get historical prices for EUR/USD
AxionResponse* eur = axion_forex_prices(client, "EUR-USD",
"2024-01-01", "2024-03-31", "daily");
// Get S&P 500 futures
AxionResponse* sp = axion_futures_ticker(client, "ES");
// Get top stock gainers
AxionResponse* gainers = axion_stocks_gainers(client, 7, 10, "US");
// Get S&P 500 components
AxionResponse* sp500 = axion_indices_components(client, "SPX");Profiles API
Comprehensive company data and metadata.
| Function | Parameters | Description |
|---|---|---|
| axion_profiles_profile() | ticker | Basic company profile |
| axion_profiles_info() | ticker | Detailed company information |
| axion_profiles_summary() | ticker | Financial summary |
| axion_profiles_statistics() | ticker | Key statistics and ratios |
| axion_profiles_recommendation() | ticker | Analyst recommendations |
| axion_profiles_calendar() | ticker | Upcoming events calendar |
Profiles Example
AxionResponse* info = axion_profiles_info(client, "AAPL");
if (info && info->json) {
cJSON* name = cJSON_GetObjectItem(info->json, "name");
cJSON* sector = cJSON_GetObjectItem(info->json, "sector");
printf("Company: %s\nSector: %s\n",
name->valuestring, sector->valuestring);
}
axion_response(info);
AxionResponse* recs = axion_profiles_recommendation(client, "AAPL");
// Process recommendations...
axion_response(recs);Financials API
Detailed financial statements and metrics. Most functions accept an optional periods parameter to specify number of historical periods. Statement functions accept year and quarter parameters.
Available Functions
| Function | Description | Parameters |
|---|---|---|
| axion_financials_revenue(ticker, periods) | Revenue data | ticker, periods |
| axion_financials_net_income(ticker, periods) | Net income | ticker, periods |
| axion_financials_total_assets(ticker, periods) | Total assets | ticker, periods |
| axion_financials_total_liabilities(ticker, periods) | Total liabilities | ticker, periods |
| axion_financials_stockholders_equity(ticker, periods) | Stockholders equity | ticker, periods |
| axion_financials_current_assets(ticker, periods) | Current assets | ticker, periods |
| axion_financials_current_liabilities(ticker, periods) | Current liabilities | ticker, periods |
| axion_financials_operating_cash_flow(ticker, periods) | Operating cash flow | ticker, periods |
| axion_financials_capital_expenditures(ticker, periods) | CapEx | ticker, periods |
| axion_financials_free_cash_flow(ticker, periods) | Free cash flow | ticker, periods |
| axion_financials_shares_outstanding_basic(ticker, periods) | Basic shares outstanding | ticker, periods |
| axion_financials_shares_outstanding_diluted(ticker, periods) | Diluted shares outstanding | ticker, periods |
| axion_financials_metrics(ticker) | Calculated financial metrics | ticker |
| axion_financials_snapshot(ticker) | Financial snapshot overview | ticker |
| axion_financials_eps(ticker, from, to) | Earnings per share | ticker, from, to |
| axion_financials_pe(ticker, from, to, frame) | P/E ratio | ticker, from, to, frame |
| axion_financials_market_cap(ticker, from, to, frame) | Market capitalization | ticker, from, to, frame |
| axion_financials_roe(ticker, from, to) | Return on equity | ticker, from, to |
| axion_financials_enterprise_value(ticker, from, to, frame) | Enterprise value | ticker, from, to, frame |
| axion_financials_ebitda(ticker, from, to) | EBITDA | ticker, from, to |
| axion_financials_debt_to_equity(ticker, from, to) | Debt-to-equity ratio | ticker, from, to |
| axion_financials_balance_sheet(client, ticker, year, quarter) | Complete balance sheet statement | client, ticker, year, quarter |
| axion_financials_income_statement(client, ticker, year, quarter) | Complete income statement | client, ticker, year, quarter |
| axion_financials_cash_flow_statement(client, ticker, year, quarter) | Complete cash flow statement | client, ticker, year, quarter |
Financials Example
// Get last 4 quarters of revenue
AxionResponse* revenue = axion_financials_revenue(client, "AAPL", 4);
// Get current metrics
AxionResponse* metrics = axion_financials_metrics(client, "AAPL");
if (metrics && metrics->json) {
cJSON* pe = cJSON_GetObjectItem(metrics->json, "pe_ratio");
cJSON* pb = cJSON_GetObjectItem(metrics->json, "pb_ratio");
printf("P/E: %.2f, P/B: %.2f\n",
pe->valuedouble, pb->valuedouble);
}
// Get balance sheet for Q1 2024
AxionResponse* bs = axion_financials_balance_sheet(client, "AAPL", "2024", "Q1");
if (bs && bs->json) {
printf("Balance sheet retrieved\n");
}
axion_response(bs);
axion_response(revenue);
axion_response(metrics);Earnings API
Comprehensive earnings data including history, trends, detailed reports, and call transcripts.
| Function | Description | Parameters |
|---|---|---|
| axion_futures_tickers() | Filtered futures list | type, exchange |
| axion_futures_ticker() | Current futures quote | ticker |
| axion_futures_prices() | Historical futures prices | ticker, from, to, frame |
| axion_futures_quote() | Real-time futures quote | ticker |
| axion_futures_list_exchange() | Available exchanges | None |
| axion_futures_list_type() | Available types | None |
Earnings Example
// Get earnings history
AxionResponse* history = axion_earnings_history(client, "AAPL");
// Get Q1 2024 earnings report
AxionResponse* report = axion_earnings_report(client, "AAPL", "2024", "Q1");
if (report && report->json) {
cJSON* eps = cJSON_GetObjectItem(report->json, "eps_actual");
cJSON* revenue = cJSON_GetObjectItem(report->json, "revenue_actual");
printf("EPS: %.2f, Revenue: %.2f\n",
eps->valuedouble, revenue->valuedouble);
}
// Get earnings call transcript
AxionResponse* transcript = axion_earnings_transcript(client, "AAPL", "2024", "Q1");
if (transcript && transcript->json) {
printf("Transcript retrieved\n");
}
axion_response(transcript);
axion_response(history);
axion_response(report);Filings API
SEC filings data with powerful search capabilities and document access.
| Function | Parameters | Description |
|---|---|---|
| axion_filings_recent() | ticker, form, limit | List of filings for a ticker |
| axion_filings_history() | ticker, form_type, start_date, end_date | Filtered forms for a ticker by date range |
| axion_filings_list_forms() | None | Description of all form types |
| axion_filings_search() | ticker, form, year, quarter | Search across all filings |
| axion_filings_document_text() | document_id | Full document text content |
| axion_filings_document_sentiment() | document_id | Document sentiment analysis |
Filings Example
// Get latest 10-K filings for Apple
AxionResponse* filings = axion_filings_recent(client, "AAPL", "10-K", 5);
// Search for all 10-Q filings in Q1 2024
AxionResponse* search = axion_filings_search(client, NULL, "10-Q", "2024", "Q1");
if (search && search->json) {
cJSON* filings_array = search->json;
int count = cJSON_GetArraySize(filings_array);
printf("Found %d filings\n", count);
}
// Get document text
AxionResponse* doc = axion_filings_document_text(client, "doc_12345");
if (doc && doc->json) {
printf("Document text retrieved\n");
}
axion_response(doc);
axion_response(filings);
axion_response(search);Insiders API
Insider trading data including transactions, ownership, funds, and activity.
Available Functions
| Function | Description | Parameters |
|---|---|---|
| axion_insiders_funds() | Fund ownership data | ticker |
| axion_insiders_individuals() | Insider holders (individuals) | ticker |
| axion_insiders_institutions() | Institutional ownership | ticker |
| axion_insiders_ownership() | Major holders breakdown | ticker |
| axion_insiders_activity() | Net share purchase activity | ticker |
| axion_insiders_transactions() | Insider transactions | ticker |
Insiders Example
// Get recent insider transactions
AxionResponse* transactions = axion_insiders_transactions(client, "AAPL");
if (transactions && transactions->json) {
cJSON* first = cJSON_GetArrayItem(transactions->json, 0);
if (first) {
cJSON* name = cJSON_GetObjectItem(first, "insider_name");
cJSON* shares = cJSON_GetObjectItem(first, "shares");
printf("%s traded %d shares\n",
name->valuestring, shares->valueint);
}
}
axion_response(transactions);Sentiment API
Multi-source sentiment analysis for stocks.
Available Functions
| Function | Description | Parameters |
|---|---|---|
| axion_sentiment_all() | Combined sentiment analysis | ticker |
| axion_sentiment_social() | Social media sentiment | ticker |
| axion_sentiment_news() | News-based sentiment | ticker |
| axion_sentiment_analyst() | Analyst sentiment | ticker |
Sentiment Example
AxionResponse* sentiment = axion_sentiment_all(client, "TSLA");
if (sentiment && sentiment->json) {
cJSON* overall = cJSON_GetObjectItem(sentiment->json, "overall_score");
cJSON* social = cJSON_GetObjectItem(sentiment->json, "social_score");
cJSON* news = cJSON_GetObjectItem(sentiment->json, "news_score");
printf("Overall: %.2f, Social: %.2f, News: %.2f\n",
overall->valuedouble, social->valuedouble, news->valuedouble);
}
axion_response(sentiment);News API
Financial news from multiple sources.
Available Functions
| Function | Description | Parameters |
|---|---|---|
| axion_news_general() | General market news feed | None |
| axion_news_company() | News for a specific company | ticker |
| axion_news_country() | News by country | country |
| axion_news_category() | News by category | category |
News Example
// Get latest news for Apple
AxionResponse* news = axion_news_company(client, "AAPL");
if (news && news->json) {
cJSON* first = cJSON_GetArrayItem(news->json, 0);
if (first) {
cJSON* title = cJSON_GetObjectItem(first, "title");
cJSON* source = cJSON_GetObjectItem(first, "source");
printf("%s - %s\n", source->valuestring, title->valuestring);
}
}
axion_response(news);Economic API
Macroeconomic indicators, datasets, AI-powered search, and economic calendar.
Available Functions
| Function | Description | Parameters |
|---|---|---|
| axion_econ_search() | Search for economic series | query |
| axion_econ_find() | AI-powered FRED series search | query |
| axion_econ_dataset() | Get series observations | series_id |
| axion_econ_calendar() | Economic calendar with filters | from, to, country, min_importance, currency, category |
Economic Example
// Get economic calendar for US with min importance 3
AxionResponse* calendar = axion_econ_calendar(client,
"2024-03-01", "2024-03-31", "US", 3, NULL, NULL);
// Get GDP data
AxionResponse* gdp = axion_econ_dataset(client, "GDP");
// AI-powered economic search
AxionResponse* found = axion_econ_find(client, "US GDP growth rate 2024");
if (found && found->json) {
printf("Economic data found\n");
}
axion_response(found);
axion_response(calendar);
axion_response(gdp);ESG API
Environmental, Social, Governance data
axion_esg_data(client, ticker)Returns ESG scores and metrics for a company
Credit API
Credit ratings and entity search
axion_credit_search(client, query)axion_credit_ratings(client, entity_id)Supply Chain API
Customers, peers, suppliers
axion_supply_chain_customers(client, ticker)axion_supply_chain_peers(client, ticker)axion_supply_chain_suppliers(client, ticker)Web Traffic API
Website traffic metrics
axion_webtraffic_traffic(client, ticker)Error Handling
Every API call returns an AxionResponse* that must be checked for errors.
| Check | Description |
|---|---|
| !response | Fatal error (allocation failure) |
| response->error | API error message |
| response->http_status >= 400 | HTTP error |
| !response->json | JSON parse failure |
Robust error handling
AxionResponse* resp = axion_esg_data(client, "INVALID");
if (!resp) {
fprintf(stderr, "Fatal: allocation failed\n");
return;
}
if (resp->error) {
fprintf(stderr, "API error: %s\n", resp->error);
} else if (resp->http_status >= 400) {
fprintf(stderr, "HTTP %d error\n", resp->http_status);
} else if (!resp->json) {
fprintf(stderr, "Invalid JSON response\n");
} else {
// Success - process resp->json
cJSON* score = cJSON_GetObjectItem(resp->json, "score");
// ...
}
axion_response(resp);Memory Management
The SDK uses manual memory management. Every AxionResponse* must be freed withaxion_response(). The client must be freed last.
Always free responses
Use axion_response() for every response.
Free client last
All responses freed before axion_client().
NULL safe
Free functions accept NULL.
Thread safety
One client per thread, or use mutex.
Cleanup with goto pattern
AxionClient* client = NULL;
AxionResponse* r1 = NULL;
AxionResponse* r2 = NULL;
client = axion_init("your-api-key");
if (!client) goto cleanup;
r1 = axion_stocks_ticker(client, "AAPL");
if (!r1 || r1->error) goto cleanup;
r2 = axion_esg_data(client, "AAPL");
if (!r2 || r2->error) goto cleanup;
// Process responses...
cleanup:
axion_response(r1);
axion_response(r2);
axion_client(client);Performance Tips
Optimize for high-frequency or embedded environments.
Reuse client
One client instance per thread reduces curl init overhead.
Batch calls
Group API calls to reuse connections.
Free early
Free responses immediately after processing.
Date formats
Always use YYYY-MM-DD format for dates.
Batch processing pattern
// Fire all requests first
const char* tickers[] = {"AAPL", "MSFT", "GOOGL"};
AxionResponse* resps[3];
for (int i = 0; i < 3; i++) {
resps[i] = axion_stocks_ticker(client, tickers[i]);
}
// Then process and free
for (int i = 0; i < 3; i++) {
if (resps[i] && resps[i]->json && !resps[i]->error) {
cJSON* price = cJSON_GetObjectItem(resps[i]->json, "price");
printf("%s: %.2f\n", tickers[i], price->valuedouble);
}
axion_response(resps[i]);
}Complete Example
A comprehensive program that fetches stock data, ESG scores, and financial metrics for multiple companies.
#include "axion.h"
#include <stdio.h>
#include <string.h>
typedef struct {
char ticker[16];
double price;
double esg_score;
double pe_ratio;
double market_cap;
} CompanyAnalysis;
int main() {
AxionClient* client = axion_init("your-api-key-here");
if (!client) {
fprintf(stderr, "Failed to initialize client\n");
return 1;
}
const char* tickers[] = {"AAPL", "MSFT", "GOOGL", "TSLA", "AMZN"};
CompanyAnalysis results[5] = {0};
for (int i = 0; i < 5; i++) {
strcpy(results[i].ticker, tickers[i]);
// Get stock quote
AxionResponse* quote = axion_stocks_ticker(client, tickers[i]);
if (quote && quote->json && !quote->error) {
cJSON* price = cJSON_GetObjectItem(quote->json, "price");
if (cJSON_IsNumber(price)) {
results[i].price = price->valuedouble;
}
}
axion_response(quote);
// Get ESG data
AxionResponse* esg = axion_esg_data(client, tickers[i]);
if (esg && esg->json && !esg->error) {
cJSON* score = cJSON_GetObjectItem(esg->json, "score");
if (cJSON_IsNumber(score)) {
results[i].esg_score = score->valuedouble;
}
}
axion_response(esg);
// Get financial metrics
AxionResponse* metrics = axion_financials_metrics(client, tickers[i]);
if (metrics && metrics->json && !metrics->error) {
cJSON* pe = cJSON_GetObjectItem(metrics->json, "pe_ratio");
cJSON* mcap = cJSON_GetObjectItem(metrics->json, "market_cap");
if (cJSON_IsNumber(pe)) results[i].pe_ratio = pe->valuedouble;
if (cJSON_IsNumber(mcap)) results[i].market_cap = mcap->valuedouble;
}
axion_response(metrics);
}
// Print results
printf("\n=== Company Analysis ===\n\n");
for (int i = 0; i < 5; i++) {
printf("%s:\n", results[i].ticker);
printf(" Price: $%.2f\n", results[i].price);
printf(" ESG Score: %.1f\n", results[i].esg_score);
printf(" P/E Ratio: %.2f\n", results[i].pe_ratio);
printf(" Market Cap: $%.2fB\n\n", results[i].market_cap / 1e9);
}
axion_client(client);
return 0;
}