API Documentation

This API provides two public endpoints you can call from browsers or servers to get stock information and a simple evaluation signal. Responses are JSON and served with CORS enabled for convenience.

Base URL

If deployed at https://api.lokiclarke.com the API exposes friendly endpoints at /stocks/{symbol} and /evaluate/{symbol} (no /.netlify/functions prefix required). Examples below use the production base URL; replace with your local dev server when testing.

Endpoints

GET /stocks/{symbol} (alias: /stock/{symbol})

Returns a quick quote for a stock ticker. The singular form /stock is supported as an alias. You can also call the Netlify function path directly: /.netlify/functions/stock/{symbol}, or pass the symbol as a query parameter ?symbol=TSLA.

Example (curl):

curl "https://api.lokiclarke.com/stocks/TSLA"
curl "https://api.lokiclarke.com/stock/TSLA"

Response (200):

{
  "symbol": "TSLA",
  "name": "Tesla, Inc.",
  "price": 123.45,
  "exchange": "NSDQ"
}

Possible errors:

GET /evaluate/{symbol} or ?ticker={symbol}

Compares a game API / CSV price with a real price and returns a simple signal.

Example (curl):

curl "https://api.lokiclarke.com/evaluate/TSLA?threshold=2.5"

Response (200):

{
  "ticker": "TSLA",
  "gamePrice": 120.5,
  "realPrice": 123.45,
  "diff": 2.95,
  "diffPercent": 2.449, 
  "signal": "buy"
}

Possible errors:

Authentication & Rate Limits

Currently these endpoints are public and do not require authentication. They may call upstream services (third-party APIs) which have their own rate limits; treat heavy automated polling as unsupported. If you need API keys or higher rate limits, contact the site owner.

CORS

Responses include Access-Control-Allow-Origin: * so you can call them directly from browser-based apps for testing or small projects.

Error format

Errors return JSON with an error message and sometimes additional fields. Example:

{
  "error": "Ticker not found",
  "ticker": "FOO"
}

Support & Feedback

Support & Feedback

If you find issues or want additional endpoints (batch quotes, historical data, alerts), open an issue in the repository or email the site owner at support@lokiclarke.com.

For suggestions, support requests, or to report bugs, contact support@lokiclarke.com. Expect a reply within 48 hours.

Notes for developers: the implementation files are functions/stock.js and functions/evaluate.js. They read data.csv and call external APIs; exact upstream behaviour may change responses.