UNPKG

@airnub/unusualwhales-api-client

Version:

A client library for interacting with the UnusualWhales API, written in TypeScript

100 lines (99 loc) 4.62 kB
import { AxiosInstance } from 'axios'; import { AnalystRatingResponse, GreekExposureResponse, IvTermStructureResponse, NetPremiumTickResponse, OhlcResponse, OptionsVolumeResponse, StockPriceLevelResponse, StockVolumePriceLevelResponse, TickerInfoResponse, VolumeOiExpiryResponse, CandleSizeType, OptionChainsResponse } from './types'; export declare class StockApi { private axiosInstance; constructor(axiosInstance: AxiosInstance); /** * Analyst Rating * Returns the latest analyst rating for the given ticker. * @param ticker (Required) */ getAnalystsRating(ticker: string): Promise<AnalystRatingResponse>; /** * Greek Exposure * The daily sum of the option greeks based on open contracts. Popular greek exposure values include gamma (GEX) and delta (DEX). * @param ticker (Required) * @param date (Optional) Default last trading date * @param timeframe (Optional) The timeframe of the data to return. Default 1Y Can be one of the following formats: - YTD - 1D, 2D, etc. - 1W, 2W, etc. - 1M, 2M, etc. - 1Y, 2Y, etc. */ getGreekExposure(ticker: string, date?: string, timeframe?: string): Promise<GreekExposureResponse>; /** * Information * Returns a information about the given ticker. * @param ticker (Required) */ getInfo(ticker: string): Promise<TickerInfoResponse>; /** * Net Premium Ticks * Returns the net premium ticks for a given ticker. Each tick is resembling the data for a single minute tick. * @param ticker (Required) * @param date (Optional) */ getNetPremiumTicks(ticker: string, date?: string): Promise<NetPremiumTickResponse>; /** * OHLC * Returns the Open High Low Close (OHLC) candle data for a given ticker. Results are limitted to 2,500 elements even if there are more available. * @param ticker (Required) * @param candle_size The duration of the candle. (Required) * @param timeframe The timeframe of the data to return. (Optional) Default 1Y Can be one of the following formats: - YTD - 1D, 2D, etc. - 1W, 2W, etc. - 1M, 2M, etc. - 1Y, 2Y, etc. */ getOHLC(ticker: string, candle_size: CandleSizeType, timeframe?: string): Promise<OhlcResponse>; /** * Option Chains * Returns all option symbols for the given ticker. * You can use the following regex to extract underlying ticker, option type, expiry & strike: * `^(?<symbol>[\w]*)(?<expiry>(\d{2})(\d{2})(\d{2}))(?<type>[PC])(?<strike>\d{8})$` * Keep in mind that the strike needs to be divided by 1,000. * @param ticker (Required) */ getOptionChains(ticker: string): Promise<OptionChainsResponse>; /** * Option Price Levels * Returns the call and put volume per price level for the given ticker. ---- Can be used to build a chart such as following: ![Option Price Level chart](https://i.imgur.com/y6BZ4sG.png) * @param ticker (Required) * @param date (Optional) */ getStockPriceLevels(ticker: string, date?: string): Promise<StockPriceLevelResponse>; /** * Volume & OI per Expiry * Returns the total volume and open interest per expiry for the given ticker. * @param ticker (Required) * @param date (Optional) */ getVolumeOiExpiry(ticker: string, date?: string): Promise<VolumeOiExpiryResponse>; /** * Options Volume * Returns the options volume & premium for all trade executions that happened on a given trading date for the given ticker. * @param ticker (Required) * @param limit (Optional) Number of items to return. Default: 1. Max: 500. */ getOptionsVolume(ticker: string, limit?: number): Promise<OptionsVolumeResponse>; /** * Off/Lit Price Levels * Returns the lit & off lit stock volume per price level for the given ticker. * Important: The volume does **NOT** represent the full market dialy volume. * It only represents the volume of executed trades on exchanges operated by Nasdaq and FINRA off lit exchanges. * @param ticker (Required) * @param date (Optional) */ getStockVolumePriceLevels(ticker: string, date?: string): Promise<StockVolumePriceLevelResponse>; /** * Implied Volatility Term Structure * The average of the latest volatilities for the at the money call and put contracts for every expiry date. * @param ticker (Required) * @param date (Optional) */ getTermStructure(ticker: string, date?: string): Promise<IvTermStructureResponse>; }