/** * Market API Validation Schemas */ import { z } from "zod"; /** * Candlestick interval validation */ export declare const IntervalSchema: z.ZodEnum<{ "1m": "1m"; "5m": "5m"; "15m": "15m"; "1h": "1h"; "4h": "4h"; "1d": "1d"; "30m": "30m"; "1w": "1w"; "1M": "1M"; }>; /** * Timestamp validation (milliseconds since epoch) * * Validates that the timestamp is: * - A positive integer * - At least Jan 1, 2000 (catches seconds vs milliseconds errors) * - Within JavaScript's safe integer range * - Not unreasonably far in the future (max 1 year ahead) * * **Why these bounds matter:** * - Prevents typos (e.g., using seconds instead of milliseconds: 1609459200 vs 1609459200000) * - Catches date calculation errors (e.g., Date.now() * 1000 instead of Date.now()) * - Ensures timestamps won't cause precision issues in JavaScript * * @example * ```typescript * // Valid timestamps (milliseconds) * validate(TimestampSchema, 1609459200000); // Jan 1, 2021 ✅ * validate(TimestampSchema, Date.now()); // Current time ✅ * validate(TimestampSchema, Date.now() + 86400000); // Tomorrow ✅ * * // Invalid timestamps * validate(TimestampSchema, 1609459200); // Seconds instead of ms (Jan 19, 1970) ❌ * validate(TimestampSchema, Date.now() * 1000); // Way too large ❌ * validate(TimestampSchema, 9999999999999999); // Far future (year 2286) ❌ * validate(TimestampSchema, 100000); // Too old (Jan 1, 1970) ❌ * ``` */ export declare const TimestampSchema: z.ZodNumber; /** * Get Candlesticks validation schema (by trading pair ID) * * Validates parameters for fetching candlestick (OHLCV) data using a trading pair UUID. * Ensures that the time range is valid by checking that startTime < endTime. * * @example * ```typescript * // Valid request * validate(GetCandlesticksSchema, { * tradingPairId: "123e4567-e89b-12d3-a456-426614174000", * interval: "1h", * startTime: 1609459200000, // Jan 1, 2021 * endTime: 1640995200000 // Jan 1, 2022 * }); * * // Invalid: backwards time range * validate(GetCandlesticksSchema, { * tradingPairId: "123e4567-e89b-12d3-a456-426614174000", * interval: "1h", * startTime: 1640995200000, // Jan 1, 2022 * endTime: 1609459200000 // Jan 1, 2021 * }); * // ValidationError: startTime must be less than endTime * ``` */ export declare const GetCandlesticksSchema: z.ZodObject<{ tradingPairId: z.ZodUUID; interval: z.ZodEnum<{ "1m": "1m"; "5m": "5m"; "15m": "15m"; "1h": "1h"; "4h": "4h"; "1d": "1d"; "30m": "30m"; "1w": "1w"; "1M": "1M"; }>; startTime: z.ZodNumber; endTime: z.ZodNumber; }, z.core.$strip>; /** * Trading pair symbol validation * * Validates trading pair symbols like "BTC/USDT", "ETH/USD", etc. * Symbol format: BASE/QUOTE where: * - BASE and QUOTE are 1-10 alphanumeric characters * - Separated by a forward slash * * @example * ```typescript * // Valid symbols * validate(TradingPairSymbolSchema, "BTC/USDT"); ✅ * validate(TradingPairSymbolSchema, "ETH/USD"); ✅ * validate(TradingPairSymbolSchema, "MTK/USDCo"); ✅ * * // Invalid symbols * validate(TradingPairSymbolSchema, "BTC"); ❌ Missing quote token * validate(TradingPairSymbolSchema, "BTC-USDT"); ❌ Wrong separator * validate(TradingPairSymbolSchema, "/USDT"); ❌ Missing base token * ``` */ export declare const TradingPairSymbolSchema: z.ZodString; /** * Candlestick limit validation * * Validates the limit parameter for candlestick queries: * - Must be a positive integer * - Maximum of 500 bars per request * - Server defaults to 350 if not specified */ export declare const CandlestickLimitSchema: z.ZodOptional; /** * Get Candlesticks By Trading Pair ID validation schema * * Validates parameters for fetching candlestick (OHLCV) data using a trading pair UUID. * All time parameters are optional and can be used independently: * - Use `endTime` + `limit` for backward pagination (TradingView primary pattern) * - Use `startTime` + `limit` for forward pagination * - Use just `limit` for most recent bars * - Use `startTime` + `endTime` + `limit` for a specific range (capped at limit) * * @example * ```typescript * // Get 350 most recent bars * validate(GetCandlesticksByPairIdSchema, { * tradingPairId: "123e4567-e89b-12d3-a456-426614174000", * interval: "1h", * limit: 350 * }); * * // Backward pagination (TradingView pattern) * validate(GetCandlesticksByPairIdSchema, { * tradingPairId: "123e4567-e89b-12d3-a456-426614174000", * interval: "1h", * endTime: 1640995200000, * limit: 350 * }); * * // Specific range * validate(GetCandlesticksByPairIdSchema, { * tradingPairId: "123e4567-e89b-12d3-a456-426614174000", * interval: "1h", * startTime: 1609459200000, * endTime: 1640995200000, * limit: 350 * }); * ``` */ export declare const GetCandlesticksByPairIdSchema: z.ZodObject<{ tradingPairId: z.ZodUUID; interval: z.ZodEnum<{ "1m": "1m"; "5m": "5m"; "15m": "15m"; "1h": "1h"; "4h": "4h"; "1d": "1d"; "30m": "30m"; "1w": "1w"; "1M": "1M"; }>; startTime: z.ZodOptional; endTime: z.ZodOptional; limit: z.ZodOptional; }, z.core.$strip>; /** * @deprecated Use GetCandlesticksByPairIdSchema instead. Symbol-based lookups are no longer supported. */ export declare const GetCandlesticksBySymbolSchema: z.ZodObject<{ tradingPairId: z.ZodUUID; interval: z.ZodEnum<{ "1m": "1m"; "5m": "5m"; "15m": "15m"; "1h": "1h"; "4h": "4h"; "1d": "1d"; "30m": "30m"; "1w": "1w"; "1M": "1M"; }>; startTime: z.ZodOptional; endTime: z.ZodOptional; limit: z.ZodOptional; }, z.core.$strip>; /** * Get Trading Pair validation schema */ export declare const GetTradingPairSchema: z.ZodObject<{ tradingPairId: z.ZodUUID; }, z.core.$strip>; /** * Search Trading Pairs validation schema */ export declare const SearchTradingPairsSchema: z.ZodObject<{ query: z.ZodOptional; page_size: z.ZodOptional; page: z.ZodOptional; }, z.core.$strip>; /** * Get Market Metadata validation schema */ export declare const GetMarketMetadataSchema: z.ZodObject<{ tradingPairId: z.ZodUUID; }, z.core.$strip>;