...

Usage Patterns

Common patterns for configuring and using the TickCatcher SDKs.

This guide covers the essential patterns you will use daily: configuration, error handling, and response processing.

Configure the client once and reuse it across your application.

import { Configuration, CandlesApi } from "tickcatcher";
 
const config = new Configuration({
    apiKey: process.env.TICKCATCHER_API_KEY,
});
 
export const candlesApi = new CandlesApi(config);

The API uses standard HTTP status codes. The SDKs wrap these in specific Exception types.

try {
    const data = await api.basicCandles({ symbol: "INVALID", timeframe: "1h" });
} catch (error) {
    if (error.response?.status === 404) {
        console.error("Symbol not found");
    } else {
        console.error("API Error:", error.message);
    }
}

If you receive a 429 error, you have exceeded your plan's rate limit. Most SDKs do not automatically retry, so you should implement a backoff strategy.