Welcome to API Explorer
A powerful Postman-style interface to test and explore all QuantLib Pro API endpoints.
""", unsafe_allow_html=True)
# Quick start guide
col1, col2, col3 = st.columns(3)
with col1:
st.markdown("""
### 1️⃣ Find Endpoint
**Browse** the endpoint collections on the left panel, organized by category.
**Or Search** using the search bar above to quickly find APIs by name or function.
""")
with col2:
st.markdown("""
### 2️⃣ Configure & Test
**Edit Parameters** - Modify path params, query params, and request body.
**Send Request** - Click the SEND button to execute and see real response data.
""")
with col3:
st.markdown("""
### 3️⃣ Generate Code
**View Code** - Get production-ready Python, curl, or JavaScript code.
**Run in Sandbox** - Execute Python code directly and see output in real-time.
""")
st.markdown("---")
# Quick stats
total_endpoints = sum(len(cat["endpoints"]) for cat in ENDPOINTS.values())
categories = len(ENDPOINTS)
stat_col1, stat_col2, stat_col3, stat_col4 = st.columns(4)
with stat_col1:
st.metric("Total Endpoints", total_endpoints)
with stat_col2:
st.metric("Categories", categories)
with stat_col3:
api_status = "✅ Online" if check_api_status() else "❌ Offline"
st.metric("API Status", api_status)
with stat_col4:
history_count = len(st.session_state.request_history)
st.metric("Requests Made", history_count)
st.markdown("---")
# Popular endpoints
st.markdown("### 🔥 Popular Endpoints")
popular = [
("Health", "Health Check"),
("Portfolio", "Optimize Portfolio"),
("Risk Analysis", "Value at Risk"),
("Options", "Black-Scholes Price"),
("Real-Time Data", "Get Quote"),
]
cols = st.columns(5)
for idx, (cat, ep_name) in enumerate(popular):
with cols[idx]:
# Find the endpoint
for endpoint in ENDPOINTS[cat]["endpoints"]:
if endpoint["name"] == ep_name:
if st.button(f"{endpoint['method']}\n{ep_name}", key=f"popular_{idx}", use_container_width=True):
st.session_state.selected_endpoint = {**endpoint, "category": cat}
st.rerun()
break
st.markdown("---")
st.markdown("""
**Features:**
- Browse API endpoints by category
- Build and send requests
- View responses as JSON, tables, or charts
- Generate code in Python, curl, or JavaScript
- Run Python code directly in the browser
""")
# Quick start buttons
st.markdown("#### Quick Start")
qcols = st.columns(4)
quick_endpoints = [
("Health Check", "Health", "Health Check"),
("Get Quote", "Real-Time Data", "Get Quote"),
("Optimize Portfolio", "Portfolio", "Optimize Portfolio"),
("Calculate VaR", "Risk Analysis", "Value at Risk"),
]
for i, (label, cat, name) in enumerate(quick_endpoints):
with qcols[i]:
if st.button(label, use_container_width=True):
for ep in ENDPOINTS[cat]["endpoints"]:
if ep["name"] == name:
st.session_state.selected_endpoint = {**ep, "category": cat}
st.rerun()
else:
# Endpoint selected
endpoint = st.session_state.selected_endpoint
method = endpoint["method"]
# URL Bar
method_class = f"method-{method.lower()}"
st.markdown(f"""