openapi: 3.0.1 info: title: Statis Fund Finance description: Financial analysis tool for retrieving financial data from Yahoo Finance. It can fetch historical data, calculate moving averages, compute Relative Strength Index (RSI), get trading volume, calculate volatility, compute price changes, and generate Bollinger Bands for a given stock ticker. Parameters such as start date, end date, and interval can be adjusted for each operation. The ticker symbol is required for all operations. version: 'v1' servers: - url: https://app.statisfund.com description: Primary production server on Heroku - url: https://statisfinapp.herokuapp.com description: Secondary production server paths: /data/{ticker}: get: operationId: getData summary: Retrieve historical market data for a specific stock ticker. description: This endpoint retrieves historical price data for a given stock ticker symbol. The data includes opening, closing, high, and low prices along with trading volume. parameters: - name: ticker in: path required: true schema: type: string example: "AAPL" - name: start in: query required: false schema: type: string example: "2022-01-01" description: "The start date for data retrieval. Expected format: YYYY-MM-DD." - name: end in: query required: false schema: type: string example: "2022-12-31" description: "The end date for data retrieval. Expected format: YYYY-MM-DD." - name: interval in: query required: false schema: type: string example: "1d" description: "The data interval. m for minutes, h for hours, d for days, wk for weeks, mo for months. Defaults to 1 day if not specified. Possible intervals in enum:" enum: ["1m", "2m", "5m", "15m", "30m", "90m", "1h", "1d", "5d", "1wk", "1mo", "3mo"] responses: "200": description: OK content: application/json: schema: type: object properties: date: type: array items: type: string open: type: array items: type: number high: type: array items: type: number low: type: array items: type: number close: type: array items: type: number volume: type: array items: type: number "400": description: Bad Request content: application/json: schema: type: object properties: error: type: string "500": description: Internal Server Error content: application/json: schema: type: object properties: error: type: string /indicator/{indicator}/{ticker}: get: operationId: getDynamicIndicator summary: Retrieve dynamic indicators for a specific stock ticker. description: > Retrieve user-defined dynamic indicators for a given stock ticker symbol. Users can specify the type of indicator, the stock ticker, and additional parameters for the requested indicator, if none are defined, default parameters are used. Default paramters for indicators - unique_params = { 'plotymargin': 0.0, 'plotyhlines': [], 'plotyticks': [], 'plothlines': [], 'plotforce': False, 'seed': 0.0, 'period': 30, # Most common default period 'fast': 2, 'slow': 30, 'perc': 2.5, 'movav': bt.indicators.MovingAverageSimple, # Most common moving average 'upperband': 70.0, 'lowerband': 30.0, 'safediv': False, 'safehigh': 100.0, 'safelow': 50.0, 'lookback': 1, 'devfactor': 2.0, 'factor': 0.015, 'gamma': 0.5, 'coef': 1.0, 'weights': (), 'autoheikin': True, 'alpha': None, # Add other unique parameters used across different indicators } parameters: - name: indicator in: path required: true schema: type: string enum: - AccelerationDecelerationOscillator - Accum - AdaptiveMovingAverage - AdaptiveMovingAverageEnvelope - AdaptiveMovingAverageOscillator - AllN - AnyN - ApplyN - AroonDown - AroonOscillator - AroonUp - AroonUpDown - AroonUpDownOscillator - Average - AverageDirectionalMovementIndex - AverageDirectionalMovementIndexRating - AverageTrueRange - AwesomeOscillator - BaseApplyN - BollingerBands - BollingerBandsPct - CointN - CommodityChannelIndex - CrossDown - CrossOver - CrossUp - DV2 - DemarkPivotPoint - DetrendedPriceOscillator - DicksonMovingAverage - DicksonMovingAverageEnvelope - DicksonMovingAverageOscillator - DirectionalIndicator - DirectionalMovement - DirectionalMovementIndex - DoubleExponentialMovingAverage - DoubleExponentialMovingAverageEnvelope - DoubleExponentialMovingAverageOscillator - DownDay - DownDayBool - DownMove - Envelope - ExponentialMovingAverage - ExponentialMovingAverageEnvelope - ExponentialMovingAverageOscillator - ExponentialSmoothing - ExponentialSmoothingDynamic - FibonacciPivotPoint - FindFirstIndex - FindFirstIndexHighest - FindFirstIndexLowest - FindLastIndex - FindLastIndexHighest - FindLastIndexLowest - Fractal - HeikinAshi - Highest - HullMovingAverage - HullMovingAverageEnvelope - HullMovingAverageOscillator - HurstExponent - Ichimoku - KnowSureThing - LaguerreFilter - LaguerreRSI - LinePlotterIndicator - Lowest - MACD - MACDHisto - MeanDeviation - MinusDirectionalIndicator - Momentum - MomentumOscillator - MovingAverageBase - MovingAverageSimple - MovingAverageSimpleEnvelope - MovingAverageSimpleOscillator - NonZeroDifference - OLS_BetaN - OLS_Slope_InterceptN - OLS_TransformationN - OperationN - Oscillator - OscillatorMixIn - ParabolicSAR - PercentChange - PercentRank - PercentagePriceOscillator - PercentagePriceOscillatorShort - PeriodN - PivotPoint - PlusDirectionalIndicator - PrettyGoodOscillator - PriceOscillator - RSI_EMA - RSI_SMA - RSI_Safe - RateOfChange - RateOfChange100 - ReduceN - RelativeMomentumIndex - RelativeStrengthIndex - Signal - SmoothedMovingAverage - SmoothedMovingAverageEnvelope - SmoothedMovingAverageOscillator - StandardDeviation - Stochastic - StochasticFast - StochasticFull - SumN - TripleExponentialMovingAverage - TripleExponentialMovingAverageEnvelope - TripleExponentialMovingAverageOscillator - Trix - TrixSignal - TrueHigh - TrueLow - TrueRange - TrueStrengthIndicator - UltimateOscillator - UpDay - UpDayBool - UpMove - Vortex - WeightedAverage - WeightedMovingAverage - WeightedMovingAverageEnvelope - WeightedMovingAverageOscillator - WilliamsAD - WilliamsR - ZeroLagExponentialMovingAverage - ZeroLagExponentialMovingAverageEnvelope - ZeroLagExponentialMovingAverageOscillator - ZeroLagIndicator - ZeroLagIndicatorEnvelope - ZeroLagIndicatorOscillator - haDelta description: "The type of indicator to retrieve." example: SMA - name: ticker in: path required: true schema: type: string description: "The stock ticker symbol." example: AAPL - name: start in: query schema: type: string format: date description: "The start date for data retrieval. Expected format: YYYY-MM-DD." example: "2022-01-01" - name: end in: query schema: type: string format: date description: "The end date for data retrieval. Expected format: YYYY-MM-DD." example: "2022-12-31" - name: interval in: query schema: type: string enum: [1m, 5m, 15m, 30m, 1h, 1d, 1wk] description: "The smallest intervals for the data retrieval, 1h would retrieve in 1h periods, 1m would retrieve 1 minute resolution data." example: 1h - name: plotymargin in: query schema: type: number default: 0.0 description: "Margin on the y-axis for plotting." example: 0.0 - name: plotyhlines in: query schema: type: array items: type: number description: "Horizontal lines to be plotted on the y-axis." example: [] - name: plotyticks in: query schema: type: array items: type: number description: "Ticks to be plotted on the y-axis." example: [] - name: plothlines in: query schema: type: array items: type: number description: "Lines to be plotted horizontally." example: [] - name: plotforce in: query schema: type: boolean default: false description: "A boolean to force plotting." example: false - name: seed in: query schema: type: number description: "Seed for random number generation, if applicable." example: 0 - name: period in: query schema: type: integer default: 30 description: "The number of intervals for which the indicator or average is calculated, most commonly used." example: 30 - name: fast in: query schema: type: integer default: 2 description: "The fast period for indicators that use dual timeframes." example: 2 - name: slow in: query schema: type: integer default: 30 description: "The slow period for indicators that use dual timeframes." example: 30 - name: perc in: query schema: type: number default: 2.5 description: "The percentage parameter for certain indicators." example: 2.5 - name: upperband in: query schema: type: number default: 70.0 description: "The upper band value for band indicators." example: 70.0 - name: lowerband in: query schema: type: number default: 30.0 description: "The lower band value for band indicators." example: 30.0 - name: safediv in: query schema: type: boolean default: false description: "A boolean to prevent division by zero in calculations." example: false - name: safehigh in: query schema: type: number default: 100.0 description: "A high value used in safe division to avoid division by zero." example: 100.0 - name: safelow in: query schema: type: number default: 50.0 description: "A low value used in safe division to avoid division by zero." example: 50.0 - name: lookback in: query schema: type: integer default: 1 description: "The lookback period for certain indicators." example: 1 - name: devfactor in: query schema: type: number default: 2.0 description: "The deviation factor for certain indicators." example: 2.0 - name: factor in: query schema: type: number default: 0.015 description: "A factor used in calculations for certain indicators." example: 0.015 - name: gamma in: query schema: type: number default: 0.5 description: "The gamma value for certain indicators." example: 0.5 - name: coef in: query schema: type: number default: 1.0 description: "The coefficient for certain indicators." example: 1.0 - name: weights in: query schema: type: array items: type: number description: "The weights for weighted indicators." example: [] - name: autoheikin in: query schema: type: boolean default: true description: "A boolean to determine if Heikin Ashi smoothing is applied." example: true - name: alpha in: query schema: type: number description: "The alpha value for certain indicators." example: 0.5 # Add other popular parameters here... responses: '200': description: OK content: application/json: schema: type: object properties: data: type: object additionalProperties: type: object additionalProperties: type: number '404': description: Not Found content: application/json: schema: type: object properties: error: type: string '400': description: Bad Request content: application/json: schema: type: object properties: error: type: string '500': description: Internal Server Error content: application/json: schema: type: object properties: error: type: string /moving_average/{ticker}: get: operationId: getMovingAverage summary: Calculate the moving average of a specific stock ticker over a specified number of days. description: This endpoint calculates the moving average for a given stock ticker symbol over a specified number of days. The moving average is a commonly used indicator in technical analysis that helps smooth out price action by filtering out the “noise” from random price fluctuations. parameters: - name: ticker in: path required: true schema: type: string example: "AAPL" - name: days in: query required: false schema: type: integer example: 50 - name: start in: query required: false schema: type: string example: "2022-01-01" description: "The start date for data retrieval. Expected format: YYYY-MM-DD." - name: end in: query required: false schema: type: string example: "2022-12-31" description: "The end date for data retrieval. Expected format: YYYY-MM-DD." - name: interval in: query required: false schema: type: string example: "1d" description: "The data interval. m for minutes, h for hours, d for days, wk for weeks, mo for months. Defaults to 1 day if not specified. Possible intervals in enum:" enum: ["1m", "2m", "5m", "15m", "30m", "90m", "1h", "1d", "5d", "1wk", "1mo", "3mo"] responses: "200": description: OK content: application/json: schema: type: object properties: date: type: array items: type: string moving_average: type: array items: type: number "400": description: Bad Request content: application/json: schema: type: object properties: error: type: string "500": description: Internal Server Error content: application/json: schema: type: object properties: error: type: string /rsi/{ticker}: get: operationId: getRSI summary: Calculate the Relative Strength Index (RSI) of a specific stock ticker over a specified period. description: This endpoint calculates the Relative Strength Index (RSI) for a given stock ticker symbol over a specified period. The RSI is a momentum oscillator that measures the speed and change of price movements. parameters: - name: ticker in: path required: true schema: type: string example: "AAPL" - name: period in: query required: false schema: type: integer example: 14 description: "The number of intervals for which the indicator or average is calculated. Depends on the 'interval' parameter. A request for the MA data for a interval of 1d and period of 14 will return the 14d moving average." - name: start in: query required: false schema: type: string example: "2022-01-01" description: "The start date for data retrieval. Expected format: YYYY-MM-DD." - name: end in: query required: false schema: type: string example: "2022-12-31" description: "The end date for data retrieval. Expected format: YYYY-MM-DD." - name: interval in: query required: false schema: type: string example: "1d" description: "The data interval. m for minutes, h for hours, d for days, wk for weeks, mo for months. Defaults to 1 day if not specified. Possible intervals in enum:" enum: ["1m", "2m", "5m", "15m", "30m", "90m", "1h", "1d", "5d", "1wk", "1mo", "3mo"] responses: "200": description: OK content: application/json: schema: type: object properties: date: type: array items: type: string rsi: type: array items: type: number "400": description: Bad Request content: application/json: schema: type: object properties: error: type: string "500": description: Internal Server Error content: application/json: schema: type: object properties: error: type: string /volume/{ticker}: get: operationId: getVolume summary: Retrieve the trading volume of a specific stock ticker over a specified period. description: This endpoint retrieves the trading volume for a given stock ticker symbol over a specified period. Trading volume is a measure of how much of a given financial asset has traded in a period of time. parameters: - name: ticker in: path required: true schema: type: string example: "AAPL" - name: start in: query required: false schema: type: string example: "2022-01-01" description: "The start date for data retrieval. Expected format: YYYY-MM-DD." - name: end in: query required: false schema: type: string example: "2022-12-31" description: "The end date for data retrieval. Expected format: YYYY-MM-DD." - name: interval in: query required: false schema: type: string example: "1d" description: "The data interval. m for minutes, h for hours, d for days, wk for weeks, mo for months. Defaults to 1 day if not specified. Possible intervals in enum:" enum: ["1m", "2m", "5m", "15m", "30m", "90m", "1h", "1d", "5d", "1wk", "1mo", "3mo"] responses: "200": description: OK content: application/json: schema: type: object properties: date: type: array items: type: string volume: type: array items: type: number "400": description: Bad Request content: application/json: schema: type: object properties: error: type: string "500": description: Internal Server Error content: application/json: schema: type: object properties: error: type: string /volatility/{ticker}: get: operationId: getVolatility summary: Calculate the volatility of a specific stock ticker over a specified period. description: This endpoint calculates the volatility for a given stock ticker symbol over a specified period. Volatility is a statistical measure of the dispersion of returns for a given security or market index. parameters: - name: ticker in: path required: true schema: type: string example: "AAPL" - name: start in: query required: false schema: type: string example: "2022-01-01" description: "The start date for data retrieval. Expected format: YYYY-MM-DD." - name: end in: query required: false schema: type: string example: "2022-12-31" description: "The end date for data retrieval. Expected format: YYYY-MM-DD." - name: interval in: query required: false schema: type: string example: "1d" description: "The data interval. m for minutes, h for hours, d for days, wk for weeks, mo for months. Defaults to 1 day if not specified. Possible intervals in enum:" enum: ["1m", "2m", "5m", "15m", "30m", "90m", "1h", "1d", "5d", "1wk", "1mo", "3mo"] responses: "200": description: OK content: application/json: schema: type: object properties: date: type: array items: type: string volatility: type: array items: type: number "400": description: Bad Request content: application/json: schema: type: object properties: error: type: string "500": description: Internal Server Error content: application/json: schema: type: object properties: error: type: string /price_change/{ticker}: get: operationId: getPriceChange summary: Calculate the price change of a specific stock ticker over a specified period. description: This endpoint calculates the price change for a given stock ticker symbol over a specified period. Price change is the difference in price of a stock over time. parameters: - name: ticker in: path required: true schema: type: string example: "AAPL" - name: period in: query required: false schema: type: integer example: 30 - name: start in: query required: false schema: type: string example: "2022-01-01" description: "The start date for data retrieval. Expected format: YYYY-MM-DD." - name: end in: query required: false schema: type: string example: "2022-12-31" description: "The end date for data retrieval. Expected format: YYYY-MM-DD." - name: interval in: query required: false schema: type: string example: "1d" description: "The data interval. m for minutes, h for hours, d for days, wk for weeks, mo for months. Defaults to 1 day if not specified. Possible intervals in enum:" enum: ["1m", "2m", "5m", "15m", "30m", "90m", "1h", "1d", "5d", "1wk", "1mo", "3mo"] responses: "200": description: OK content: application/json: schema: type: object properties: date: type: array items: type: string price_change: type: array items: type: number "400": description: Bad Request content: application/json: schema: type: object properties: error: type: string "500": description: Internal Server Error content: application/json: schema: type: object properties: error: type: string /bollinger_bands/{ticker}: get: operationId: getBollingerBands summary: Calculate the Bollinger Bands of a specific stock ticker over a specified period. description: This endpoint calculates the Bollinger Bands for a given stock ticker symbol over a specified period. Bollinger Bands are a type of statistical chart characterizing the prices and volatility over time of a financial instrument or commodity. parameters: - name: ticker in: path required: true schema: type: string example: "AAPL" - name: window in: query required: false schema: type: integer example: 20 description: "The number of intervals for which the indicator or average is calculated. Depends on the 'interval' parameter." - name: start in: query required: false schema: type: string example: "2022-01-01" description: "The start date for data retrieval. Expected format: YYYY-MM-DD." - name: end in: query required: false schema: type: string example: "2022-12-31" description: "The end date for data retrieval. Expected format: YYYY-MM-DD." - name: interval in: query required: false schema: type: string example: "1d" description: "The data interval. m for minutes, h for hours, d for days, wk for weeks, mo for months. Defaults to 1 day if not specified. Possible intervals in enum:" enum: ["1m", "2m", "5m", "15m", "30m", "90m", "1h", "1d", "5d", "1wk", "1mo", "3mo"] responses: "200": description: OK content: application/json: schema: type: object properties: date: type: array items: type: string lower_band: type: array items: type: number middle_band: type: array items: type: number upper_band: type: array items: type: number "400": description: Bad Request content: application/json: schema: type: object properties: error: type: string "500": description: Internal Server Error content: application/json: schema: type: object properties: error: type: string