INTRODUCTION
Financial analytics is evolving rapidly as APIs become the backbone of modern market intelligence systems. Developers, traders, and fintech companies now rely heavily on automated data pipelines to retrieve, process, and analyze stock market information in real time.
One of the most powerful approaches for market analytics is combining financial APIs with Python-based data science tools. Python provides an excellent ecosystem for transforming raw market information into meaningful insights through automation, statistical analysis, and visualization.
In this project, we build a complete financial analytics workflow using the Fundachart Metrics API from the Indonesia Stock Exchange ecosystem. The notebook demonstrates how to:
Connect to a financial API using RapidAPI
Retrieve stock market metrics data
Normalize JSON responses into DataFrames
Clean and validate financial datasets
Convert data types for analysis
Generate statistical summaries
Create data visualizations
Perform correlation analysis
Build market intelligence summaries
This article follows the exact notebook structure and explains every code cell without modifying the original implementation.
CELL 1 — Import Required Libraries
import requests
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# Visualization settings
sns.set_style("whitegrid")
plt.rcParams["figure.figsize"] = (12,6)
print("Libraries imported successfully.")Explanation
This cell imports all required libraries used throughout the project.
Each library has a specific role in the analytics pipeline:
requestshandles API communication.pandasprocesses and manages structured data.matplotlibcreates charts and visualizations.seabornimproves chart styling and readability.
The notebook also configures visualization settings:
sns.set_style("whitegrid")creates cleaner chart backgrounds.plt.rcParams["figure.figsize"] = (12,6)standardizes chart sizes.
Proper visualization configuration is essential in financial analytics because data interpretation becomes much easier with readable visual outputs.
CELL 2 — API Configuration
RAPIDAPI_KEY = "YOUR_API_KEY"
headers = {
"Content-Type": "application/json",
"x-rapidapi-host": "indonesia-stock-exchange-idx.p.rapidapi.com",
"x-rapidapi-key": RAPIDAPI_KEY
}
URL_FUNDACHART = (
"https://indonesia-stock-exchange-idx.p.rapidapi.com/"
"api/emiten/fundachart/metrics?metric_name=fundachart"
)
print("API configuration completed.")Explanation
This section configures API authentication and endpoint definitions.
The API key is required for secure communication with the RapidAPI service. The headers contain:
Content type information
API host identification
Authentication credentials
The URL_FUNDACHART variable stores the endpoint used to retrieve Fundachart metrics data.
Using centralized configuration variables is considered a best practice because it improves scalability, readability, and maintainability.
CELL 3 — Fetch Fundachart Metrics Data
response = requests.get(
URL_FUNDACHART,
headers=headers
)
print("Status Code:", response.status_code)
fundachart_data = response.json()
fundachart_dataExplanation
This cell retrieves financial metrics data directly from the Fundachart API.
The workflow performs several important operations:
Send an HTTP GET request
Validate API response status
Convert JSON responses into Python objects
Display raw API data
The status code verification is important because it helps detect:
Authentication issues
Endpoint errors
API server failures
Request limitations
Displaying raw JSON responses helps developers understand API structures before processing them further.
CELL 4 — Normalize JSON Data
if "data" in fundachart_data:
df_fundachart = pd.json_normalize(
fundachart_data["data"]
)
else:
df_fundachart = pd.DataFrame(
fundachart_data
)
print("=== FUNDACHART DATA ===")
display(df_fundachart.head())
print("\nColumns:")
print(df_fundachart.columns)Explanation
Financial APIs commonly return nested JSON objects that are difficult to analyze directly.
This cell transforms raw JSON responses into structured Pandas DataFrames using:
pd.json_normalize()for flattening nested structurespd.DataFrame()as a fallback mechanism
The notebook also:
Displays the first rows of the dataset
Prints available column names
This normalization step is crucial because most analytics, visualization, and machine learning workflows require tabular data.
CELL 5 — Data Cleaning
# ============================================================
# CELL 5 - DATA CLEANING (FIXED)
# ============================================================
# Convert list/dict/object columns into string
# to avoid unhashable type errors
df_fundachart = df_fundachart.astype(str)
# Remove duplicate rows
df_fundachart.drop_duplicates(inplace=True)
# Remove fully empty rows
df_fundachart.dropna(
how="all",
inplace=True
)
print("Data cleaned successfully.")Explanation
This section performs essential data cleaning operations.
The notebook converts all columns into string format to prevent errors caused by:
Nested lists
Dictionaries
Mixed object types
Additional cleaning operations include:
Removing duplicate records
Removing completely empty rows
Data cleaning is one of the most important phases in financial engineering because real-world market data often contains inconsistencies.
Without proper cleaning, later analysis and visualizations may produce incorrect or unstable results.
CELL 6 — Numeric Data Conversion
for col in df_fundachart.columns:
df_fundachart[col] = pd.to_numeric(
df_fundachart[col],
errors="ignore"
)
print("Numeric conversion completed.")
display(df_fundachart.head())Explanation
This cell converts compatible columns into numeric data types.
The notebook uses pd.to_numeric() to automatically detect numeric values while preserving non-numeric columns.
The parameter errors="ignore" ensures that incompatible columns remain unchanged instead of causing execution failures.
Numeric conversion is essential because:
Statistical analysis requires numeric values
Visualizations depend on numeric inputs
Correlation analysis only works with numeric datasets
This step prepares the dataset for deeper market analysis.
CELL 7 — Dataset Information Analysis
print("=== DATASET INFORMATION ===")
print("\nDataset Shape:")
print(df_fundachart.shape)
print("\nColumn Names:")
print(df_fundachart.columns.tolist())
print("\nData Types:")
print(df_fundachart.dtypes)Explanation
This section provides a structural overview of the dataset.
The notebook displays:
Dataset dimensions
Available column names
Data types for every column
Understanding dataset structure is important because it helps analysts:
Detect missing features
Validate transformations
Identify numeric columns
Prepare for advanced analytics
Dataset inspection is a foundational practice in data science and financial engineering.
CELL 8 — Statistical Summary
numeric_df = df_fundachart.select_dtypes(
include=["number"]
)
if len(numeric_df.columns) > 0:
print("=== STATISTICAL SUMMARY ===")
display(
numeric_df.describe()
)
else:
print("No numeric columns found.")Explanation
This cell generates descriptive statistical summaries for numeric columns.
The analysis includes metrics such as:
Mean
Median
Standard deviation
Minimum values
Maximum values
Quartiles
Statistical summaries help analysts quickly understand:
Data distributions
Potential anomalies
Market behavior patterns
Value ranges
This step is commonly used in financial dashboards and quantitative analysis systems.
CELL 9 — Identify Numeric Columns
numeric_columns = df_fundachart.select_dtypes(
include=["number"]
).columns
print("Numeric Columns Found:")
print(numeric_columns)Explanation
This section identifies all numeric columns available in the dataset.
Numeric columns are important because they are used for:
Statistical analysis
Visualization
Correlation mapping
Machine learning
Forecasting models
By separating numeric features from categorical information, the notebook becomes more efficient and scalable for future analytics.
CELL 10 — Distribution Visualization
if len(numeric_columns) > 0:
selected_column = numeric_columns[0]
plt.figure(figsize=(14,6))
sns.histplot(
df_fundachart[selected_column],
kde=True
)
plt.title(
f"Distribution of {selected_column}"
)
plt.xlabel(selected_column)
plt.ylabel("Frequency")
plt.show()Explanation
This visualization cell creates a histogram distribution chart.
The histogram helps analysts understand:
Data distribution patterns
Frequency concentration
Outliers
Volatility behavior
The KDE (Kernel Density Estimation) line adds smoother distribution insights.
Distribution analysis is useful in financial analytics because it helps detect:
Extreme market conditions
Skewed datasets
Irregular value distributions
Potential investment anomalies
CELL 11 — Correlation Analysis
numeric_df = df_fundachart.select_dtypes(
include=["number"]
)
if len(numeric_df.columns) > 1:
correlation_matrix = numeric_df.corr()
plt.figure(figsize=(12,8))
sns.heatmap(
correlation_matrix,
annot=True,
cmap="coolwarm"
)
plt.title(
"Fundachart Metrics Correlation"
)
plt.show()Explanation
This section performs correlation analysis between numeric variables.
The correlation matrix measures relationships between financial metrics.
Positive correlations indicate variables moving together, while negative correlations indicate opposite movement patterns.
The heatmap visualization makes these relationships easier to interpret visually.
Correlation analysis is widely used in:
Portfolio management
Quantitative trading
Risk management
Financial forecasting
Market intelligence systems
Understanding relationships between metrics is critical for advanced market analysis.
Result:

CELL 12 — Final Market Intelligence Summary
print("=" * 60)
print("FUNDACHART MARKET INTELLIGENCE SUMMARY")
print("=" * 60)
print("\nDataset Shape:")
print(df_fundachart.shape)
print("\nTotal Columns:")
print(len(df_fundachart.columns))
print("\nNumeric Columns:")
print(len(numeric_columns))
print("\nAvailable Columns:")
print(df_fundachart.columns.tolist())
print("\nProject completed successfully.")Explanation
The final section generates a complete market intelligence summary.
This report provides:
Dataset dimensions
Total feature counts
Number of numeric variables
Available dataset columns
Summary reporting is important because it condenses complex analytical workflows into actionable information.
In production environments, similar reports are often integrated into:
Trading dashboards
Executive market reports
Fintech monitoring systems
Quantitative research pipelines
The notebook successfully demonstrates how financial APIs can be transformed into scalable market intelligence systems using Python.
Result:

CONCLUSION
Financial data analysis is becoming one of the most valuable skills in modern fintech development. By combining APIs with Python-based analytics tools, developers can build intelligent systems capable of processing and visualizing complex market information efficiently.
This project successfully demonstrates how to:
Connect to financial APIs
Normalize raw JSON data
Clean inconsistent datasets
Convert numeric information
Generate statistical summaries
Visualize market distributions
Analyze metric correlations
Produce market intelligence reports
The Fundachart Metrics workflow provides a strong foundation for building advanced financial intelligence platforms.
As the financial technology ecosystem continues to evolve, API-driven analytics pipelines like this will become increasingly important for traders, analysts, fintech startups, and enterprise-level financial systems.
For anyone interested in Python, financial engineering, or market intelligence, mastering workflows like this is an important step toward building scalable and intelligent fintech applications.
