UNPKG

@vicary/alpaca-sdk

Version:

A TypeScript SDK for the https://alpaca.markets REST API and WebSocket streams.

35 lines 1.16 kB
import * as marketData from "../api/marketData.js"; import * as trade from "../api/trade.js"; import { TokenBucketOptions } from "./createTokenBucket.js"; export declare const baseURLs: { readonly live: "https://api.alpaca.markets"; readonly paper: "https://paper-api.alpaca.markets"; readonly marketData: "https://data.alpaca.markets"; }; export type BaseURLKey = keyof typeof baseURLs; export type RequestOptions<T> = { path: string; method?: string; baseURL?: (typeof baseURLs)[BaseURLKey]; data?: object; params?: object; }; export type Client = { [K in keyof typeof trade]: ReturnType<(typeof trade)[K]>; } & { [K in keyof typeof marketData]: ReturnType<(typeof marketData)[K]>; }; export type ClientContext = { options: CreateClientOptions; request: <T>(options: RequestOptions<T>) => Promise<T>; }; export type CreateClientOptions = { key?: string; secret?: string; accessToken?: string; baseURL?: string; paper?: boolean; tokenBucket?: TokenBucketOptions; }; export declare const createClient: (options: CreateClientOptions) => Client; //# sourceMappingURL=createClient.d.ts.map