example-data.com
Menu
Browse docs and collections

Overview

stock-holdings / #25

Component variants

Related

Request

curl example

curl -sS \
  "https://example-data.com/api/v1/stock-holdings/25" \
  -H "Accept: application/json"

JavaScript example

const res = await fetch(
  "https://example-data.com/api/v1/stock-holdings/25"
);
const stockHolding = await res.json();

TypeScript example

// Download once: mkdir -p types && curl -o types/stock-holdings.d.ts https://example-data.com/types/stock-holdings.d.ts
import type { StockHolding } from "./types/stock-holdings";

const res = await fetch(
  "https://example-data.com/api/v1/stock-holdings/25"
);
const stockHolding = (await res.json()) as StockHolding;

Python example

import requests

res = requests.get(
    "https://example-data.com/api/v1/stock-holdings/25"
)
stock_holding = res.json()

Response

{
  "id": 25,
  "userId": 17,
  "stockId": 20,
  "quantity": 630.1571,
  "costBasis": 4281.46,
  "purchasedAt": "2024-12-01T21:58:49.201Z"
}