Refresh Portfolio Prices
curl --request POST \
--url https://api.example.com/api/portfolio/refresh-pricesimport requests
url = "https://api.example.com/api/portfolio/refresh-prices"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api/portfolio/refresh-prices', 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/portfolio/refresh-prices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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/portfolio/refresh-prices"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/portfolio/refresh-prices")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/portfolio/refresh-prices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"success": true,
"updated_count": 123,
"errors": [
{}
]
}Portfolio
Refresh Portfolio Prices
Fetch current market prices for all portfolio holdings
POST
/
api
/
portfolio
/
refresh-prices
Refresh Portfolio Prices
curl --request POST \
--url https://api.example.com/api/portfolio/refresh-pricesimport requests
url = "https://api.example.com/api/portfolio/refresh-prices"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api/portfolio/refresh-prices', 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/portfolio/refresh-prices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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/portfolio/refresh-prices"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/portfolio/refresh-prices")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/portfolio/refresh-prices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"success": true,
"updated_count": 123,
"errors": [
{}
]
}Endpoint
POST /api/portfolio/refresh-prices
Description
Fetches the latest market prices from Finnhub API for all holdings in the user’s portfolio.Authentication
Requires OAuth 2.0 authentication via session cookies.Rate Limiting
The free Finnhub API tier allows 60 requests per minute. The application intelligently manages API requests to stay within these limits.Response
boolean
required
Indicates if the refresh was successful
number
Number of holdings successfully updated
array
List of any errors encountered during refresh
Example
curl -X POST https://your-domain.com/api/portfolio/refresh-prices \
-H "Cookie: session=your_session_cookie"
const response = await fetch('/api/portfolio/refresh-prices', {
method: 'POST'
});
const data = await response.json();
if (data.success) {
console.log(`Updated ${data.updated_count} holdings`);
}
import requests
response = requests.post('http://localhost:5000/api/portfolio/refresh-prices')
data = response.json()
if data['success']:
print(f"Updated {data['updated_count']} holdings")
Response Example
Success
{
"success": true,
"updated_count": 5,
"message": "Successfully updated prices for 5 holdings"
}
Partial Success
{
"success": true,
"updated_count": 4,
"errors": [
{
"symbol": "INVALID",
"error": "Symbol not found"
}
]
}
Error
{
"success": false,
"error": "Finnhub API key not configured"
}
Notes
- Prices are automatically refreshed when viewing the portfolio page if last update was >15 minutes ago
- Use this endpoint to manually force a refresh at any time
- Mutual fund prices may be delayed 15-30 minutes
Was this page helpful?