Get Available Months
curl --request GET \
--url https://api.example.com/api/monthsimport requests
url = "https://api.example.com/api/months"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/months', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/months",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/months"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/months")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/months")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"success": false,
"error": "Database connection failed"
}
Trading Data
Get Available Months
Retrieves a list of all months that have trading data available
GET
/
api
/
months
Get Available Months
curl --request GET \
--url https://api.example.com/api/monthsimport requests
url = "https://api.example.com/api/months"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/months', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/months",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/months"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/months")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/months")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"success": false,
"error": "Database connection failed"
}
Endpoint
GET /api/months
Authentication
Requires OAuth 2.0 authentication via session cookies.Parameters
NoneResponse
boolean
required
Indicates if the request was successful
array
required
string
required
Database source (always “postgresql”)
Example
curl -X GET https://your-domain.com/api/months \
-H "Cookie: session=your_session_cookie"
const response = await fetch('/api/months');
const data = await response.json();
if (data.success) {
console.log('Available months:', data.months);
}
import requests
response = requests.get('http://localhost:5000/api/months')
data = response.json()
if data['success']:
for month in data['months']:
print(f"{month['month']}: ${month['total_return_with_dividends']}")
Response Example
{
"success": true,
"months": [
{
"month": "2024-08",
"total_return_with_dividends": 1250.75
},
{
"month": "2024-07",
"total_return_with_dividends": -320.50
},
{
"month": "2024-06",
"total_return_with_dividends": 890.25
}
],
"data_source": "postgresql"
}
Error Responses
{
"success": false,
"error": "Database connection failed"
}
{
"success": false,
"error": "Authentication required",
"redirect_to_login": true
}
Was this page helpful?
⌘I