Technical, portfolio, risk analysis APIs for your quantitative trading algorithms.

Libkloudtrader provides various analysis APIs useful for the various trading and quant operations you need during your algorithmic trading workflow. But we believe in an ever-evolving approach, thus we are regularly updating the analysis functions module of libkloudtrader. If you do not find your favorite analysis function missing please feel free to open an issue with us here.

Module

libkloudtrader.analysis

Accumulation/Distribution Index

Developed by Marc Chaikin, the Accumulation Distribution Line is a volume-based indicator designed to measure the cumulative flow of money into and out of a security.



Learn More

accumulation_distribution_index(high,low,close,volume)

Paramters Required/Optional Description Type high required High prices data Pandas dataframe column low required Low prices data Pandas dataframe column close required Close Prices data Pandas dataframe column volume required Volume data Pandas dataframe column

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2019-01-01' , '2019-07-07' )

analysis.accumulation_distribution_index(aapl_data[ 'high' ],aapl_data[ 'low' ],aapl_data[ 'close' ],aapl_data[ 'volume' ])

return type : Pandas Series



Thursday, August 29 , 2019 07 : 15 : 05 PM INFO: Calculating Accumulation/Distribution Index...



date

2019 -01 -02 2.418361e+07

2019 -01 -03 -5.985697e+07

2019 -01 -04 -3.053145e+07

2019 -01 -07 7.257905e+07

2019 -01 -08 3.554691e+07

...

2019 -06 -28 -2.631732e+07

2019 -07 -01 -2.348257e+07

2019 -07 -02 -5.265158e+06

2019 -07 -03 2.021933e+07

2019 -07 -05 1.477405e+07



Length: 128 , dtype: float64



Alpha

Alpha is a measure of the active return on an investment, the performance of that investment compared with a suitable market index. An alpha of 1% means the investment's return on investment over a selected period of time was 1% better than the market during that same period; a negative alpha means the investment underperformed the market.



Learn More

alpha(daily_returns, benchmark_daily_returns)

Paramters Required/Optional Description Type daily_returns required Daily returns of the asset, strategy or portfolio Pandas Series benchmark_daily_returns required Daily returns of a index or market like Dow Jone Ind. Avg., S&P 500 Index Pandas Series risk_free required Constant risk-free return throughout the period. 0.0 by default float

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-31' )

spx_data=stocks.ohlcv( 'SPX' , '2018-01-01' , '2019-01-31' )



aapl_daily=analysis.daily_returns(aapl_data[ 'close' ])

spx_daily=analysis.daily_returns(spx_data[ 'close' ])



analysis.alpha(aapl_daily, spx_daily)

return type: float



Thursday, August 29 , 2019 08 : 15 : 30 PM INFO: Calculating Alpha...



-0.9977619138555154



Annual Return (%age)

Annual return is the return an investment over a period of one year, expressed as a time-weighted annual percentage.



Learn More

annual_return(data)

Note: annual_return() only takes a series with 1 year data i.e. data with less than 257 trading days or greater 250 days because an average trading year has 250-257 days approximately. To calculate return on n number of trading days use returns()

Paramters Required/Optional Description Type data required Data Pandas series

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-07-07' , '2019-07-07' )



annual_return(aapl_data[ 'close' ])

return type : float (%age)



Thursday, August 29 , 2019 11 : 14 : 49 PM INFO: Calculating Annual return . Number of trading days in provided data: 250



10.913375268550839



Annual Sharpe Ratio

The Sharpe ratio is simply the return per unit of risk (represented by variance). The higher the Sharpe ratio, the better the combined performance of "risk" and return. Using an annual/annualized Sharpe Ratio is useful for comparison of multiple return streams. The annualized Sharpe ratio is computed by dividing the annualized mean monthly excess return by the annualized monthly standard deviation of excess return.



Learn More

annual_sharpe_ratio(data)

Note: annual_return() only takes a series with 1 year data i.e. data with less than 257 trading days or greater 250 days because an average trading year has 250-257 days approximately. To calculate return on n number of trading days use sharpe_ratio()

Paramters Required/Optional Description Type data required Data Pandas series

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.annual_sharpe_ratio(aapl_data[ 'close' ])

return type : float



Thursday, August 29 , 2019 11 : 21 : 40 PM INFO: Calculating Annual Sharpe Ratio. Number of trading days in provided data: 251



-0.454619905813581



Annual Volatility

Volatility is a statistical measure of the dispersion of returns for a given security or market index. Volatility can either be measured by using the standard deviation or variance between returns from that same security or market index. Commonly, the higher the volatility, the riskier the security. Annual volatility is volatility over an year.



Learn More

annual_volatility(data)

Note: annual_return() only takes a series with 1 year data i.e. data with less than 257 trading days or greater 250 days because an average trading year has 250-257 days approximately. To calculate return on n number of trading days use volatility()

Paramters Required/Optional Description Type data required Data Pandas series

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.annual_volatility(aapl_data[ 'close' ])

return type : float



Thursday, August 29 , 2019 11 : 29 : 48 PM INFO: Calculating Annual Volatility. Number of trading days in provided data: 251



29.913496349667295



Aroon

The Aroon indicator is used to help traders know when a market is uptrending, downtrending, or is in a range-bound, trendless market.



Learn More

aroon(high,low,period)

Paramters Required/Optional Description Type high required High prices data Pandas series low required Low prices data Pandas series period required time period int

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.aroon(aapl_data[ 'high' ],aapl_data[ 'low' ], 4 )

returns: arronup, aroondown, aroon_oscillator



return type : Pandas DataFrame



Thursday, August 29 , 2019 11 : 40 : 55 PM INFO: Calculating Aroon for period = 4



aroondown aroonup aroon_oscillator

date

2018 -01 -02 NaN NaN NaN

2018 -01 -03 NaN NaN NaN

2018 -01 -04 NaN NaN NaN

2018 -01 -05 NaN NaN NaN

2018 -01 -08 0.0 100.0 100.0

... ... ...

2018 -12 -24 100.0 0.0 -100.0

2018 -12 -26 75.0 0.0 -75.0

2018 -12 -27 50.0 0.0 -50.0

2018 -12 -28 25.0 100.0 75.0

2018 -12 -31 0.0 100.0 100.0



[ 251 rows x 3 columns]



Average Price

The Average Price is the average of the open + high + low + close of a bar. It can be used to smooth an indicator that normally takes just the closing price as input.



Learn More

average_price(open,high,low,close)

Paramters Required/Optional Description Type open required Open prices data Pandas series high required High prices data Pandas series low required Low prices data Pandas series close required Close prices data Pandas series

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.average_price(aapl_data[ 'open' ],aapl_data[ 'high' ],aapl_data[ 'low' ],aapl_data[ 'close' ])

return type : Pandas Series



Friday, August 30 , 2019 12 : 41 : 43 AM INFO: Calculating Average Price...



date

2018 -01 -02 170.9950

2018 -01 -03 172.8175

2018 -01 -04 172.7800

2018 -01 -05 174.2150

2018 -01 -08 174.5600

...

2018 -12 -24 148.2800

2018 -12 -26 152.3550

2018 -12 -27 154.7075

2018 -12 -28 156.7000

2018 -12 -31 158.0275



Length: 251 , dtype: float64



Average True Range

The ATR is a Welles Wilder style moving average of the True Range. The ATR is a measure of volatility. High ATR values indicate high volatility, and low values indicate low volatility, often seen when the price is flat.



Learn More

average_true_range(high, low, close, period)

Paramters Required/Optional Description Type high required High prices data Pandas series low required Low prices data Pandas series close required Close prices data Pandas series period required time period int

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.average_true_range(aapl_data[ 'high' ],aapl_data[ 'low' ],aapl_data[ 'close' ], 4 )

return type : Pandas Series



Friday, August 30 , 2019 12 : 50 : 28 AM INFO: Calculating Average True Range for period = 4



date

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 NaN

2018 -01 -05 NaN

2018 -01 -08 2.000000

...

2018 -12 -24 6.195630

2018 -12 -26 7.274223

2018 -12 -27 7.230667

2018 -12 -28 6.415500

2018 -12 -31 5.594125



Length: 251 , dtype: float64



Awesome Oscilator

The Awesome Oscillator is an indicator used to measure market momentum. AO calculates the difference of a 34 Period and 5 Period Simple Moving Averages. The Simple Moving Averages that are used are not calculated using closing price but rather each bar’s midpoints. AO is generally used to affirm trends or to anticipate possible reversals.



Learn More

awesome_oscillator(high,low,short_period=5,long_period=34)

Paramters Required/Optional Description Type high required High prices data Pandas series low required Low prices data Pandas series short_period required Short period. 5 by default int long_period required Long period. 34 by default int

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.awesome_oscillator(aapl_data[ 'high' ],aapl_data[ 'low' ])

return type : Pandas Series



Friday, August 30 , 2019 11 : 32 : 50 AM INFO: Calculating Awesome Oscillator for short period = 5 and long period = 34



date

2018 -01 -02 0.000000

2018 -01 -03 0.000000

2018 -01 -04 0.000000

2018 -01 -05 0.000000

2018 -01 -08 0.000000

...

2018 -12 -24 -21.124478

2018 -12 -26 -22.471331

2018 -12 -27 -22.977066

2018 -12 -28 -21.924007

2018 -12 -31 -19.633272



Length: 251 , dtype: float64



Beta

Beta is a measure of the volatility, or systematic risk, of a security or a portfolio in comparison to the entire market or a benchmark. Beta is used in the capital asset pricing model (CAPM), which calculates the expected return of an asset based on its beta and expected market returns. Beta is also known as the beta coefficient.

beta(daily_returns,benchmark_daily_returns)

Paramters Required/Optional Description Type daily_returns required Daily returns of the asset, strategy or portfolio Pandas Series benchmark_daily_returns required Daily returns of a index or market like Dow Jone Ind. Avg., S&P 500 Index Pandas Series risk_free required Constant risk-free return throughout the period. 0.0 by default float

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-31' )

spx_data=stocks.ohlcv( 'SPX' , '2018-01-01' , '2019-01-31' )



aapl_daily=analysis.daily_returns(aapl_data[ 'close' ])

spx_daily=analysis.daily_returns(spx_data[ 'close' ])



analysis.beta(aapl_daily, spx_daily)

return type : float



Friday, August 30 , 2019 11 : 55 : 14 AM INFO: Calculating Beta...



1.362515464869133



Bollinger Bands

Bollinger Bands consist of three lines. The middle band is a simple moving average (generally 20 periods) of the typical price (TP). The upper and lower bands are F standard deviations (generally 2) above and below the middle band. The bands widen and narrow when the volatility of the price is higher or lower, respectively. Bollinger Bands do not, in themselves, generate buy or sell signals; they are an indicator of overbought or oversold conditions. When the price is near the upper or lower band it indicates that a reversal may be imminent. The middle band becomes a support or resistance level. The upper and lower bands can also be interpreted as price targets. When the price bounces off of the lower band and crosses the middle band, then the upper band becomes the price target.



Learn More

bollinger_bands(data,period)

Paramters Required/Optional Description Type data required Data Pandas series period required time period. 20 by default. int std optional Standard Deviation. 2.0 by default float

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.bollinger_bands(aapl_data[ 'close' ], 20 )

returns: upperband,middleband,lowerband



return type : Pandas DataFrame



Friday, August 30 , 2019 12 : 06 : 16 PM INFO: Calculating Bollinger Bands for period = 20



upperband middleband lowerband

date

2018 -01 -02 NaN NaN NaN

2018 -01 -03 NaN NaN NaN

2018 -01 -04 NaN NaN NaN

2018 -01 -05 NaN NaN NaN

2018 -01 -08 NaN NaN NaN

... ... ...

2018 -12 -24 188.252671 169.0850 149.917329

2018 -12 -26 187.875175 168.2125 148.549825

2018 -12 -27 187.437157 167.3080 147.178843

2018 -12 -28 185.730965 166.0725 146.414035

2018 -12 -31 183.936049 164.9820 146.027951



[ 251 rows x 3 columns]



Calmar Ratio

The Calmar ratio is a comparison of the average annual compounded rate of return and the maximum drawdown risk of commodity trading advisors and hedge funds. The lower the Calmar ratio, the worse the investment performed on a risk-adjusted basis over the specified time period; the higher the Calmar ratio, the better it performed. Generally speaking, the time period used is three years, but this can be higher or lower based on the investment in question.



Learn More

calmar_ratio(daily_returns)

Paramters Required/Optional Description Type daily_returns required Starting value of an asset, strategy or portfolio Pandas series

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2016-01-01' , '2019-01-01' )

rets=analysis.daily_returns(aapl_data[ 'close' ])



analysis.calmar_ratio(rets)

Monday, September 02 , 2019 02 : 25 : 16 PM INFO: Calculating Calmar Ratio...



0.39322862528483427



CAGR (Compounded Annual Growth Rate)

The compound annual growth rate (CAGR) is the rate of return that would be required for an investment to grow from its beginning balance to its ending balance assuming the profits were reinvested at the end of each year of the investment’s lifespan.



Learn More

cagr(start_value,end_value,period_in_years)

Paramters Required/Optional Description Type start_value required Starting value of the investment Float/Int end_value required End value of the investment Float/Int period_in_years required Life of investment(in years) Int

Example

Python 🐍 import libkloudtrader.analysis as analysis



analysis.cagr( 100000 , 136009 , 2 )

return type : Float (%age)



Friday, August 30 , 2019 01 : 42 : 58 PM INFO: Calculating CAGR for years = 2



16.622896551234746



Chaikin Money Flow

Developed by Marc Chaikin, Chaikin Money Flow measures the amount of Money Flow Volume over a specific period. Money Flow Volume forms the basis for the Accumulation Distribution Line. Instead of a cumulative total of Money Flow Volume, Chaikin Money Flow simply sums Money Flow Volume for a specific look-back period, typically 20 or 21 days. The resulting indicator fluctuates above/below the zero line just like an oscillator.



Learn More

chaikin_money_flow(high, low, close, volume, period)

Paramters Required/Optional Description Type high required High Prices Data Pandas series low required Low Prices Data Pandas series close required Close Prices Data Pandas series volume required Volume Data Pandas series period required time period int

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.chaikin_money_flow(aapl_data[ 'high' ],aapl_data[ 'low' ],aapl_data[ 'close' ],aapl_data[ 'volume' ], 20 )

return type : Pandas series



Friday, August 30 , 2019 02 : 02 : 47 PM INFO: Calculating Chaikin Money Flow for period = 4



date

2018 -01 -02 0.973684

2018 -01 -03 0.027596

2018 -01 -04 0.125809

2018 -01 -05 0.255658

2018 -01 -08 -0.096722

...

2018 -12 -24 -0.681776

2018 -12 -26 -0.321448

2018 -12 -27 -0.013992

2018 -12 -28 0.319783

2018 -12 -31 0.477932



Length: 251 , dtype: float64



Chande Momentum Oscillator

The Chande momentum oscillator is a technical momentum indicator invented by Tushar Chande.“It is created by calculating the difference between the sum of all recent gains and the sum of all recent losses and then dividing the result by the sum of all price movement over the period.



Learn More

chande_momentum_oscillator(data, period)

Paramters Required/Optional Description Type data required Data Pandas series period required time period int

Python 🐍 Example import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.chande_momentum_oscillator(aapl_data[ 'close' ], 8 )

return type : Pandas series



Friday, August 30 , 2019 02 : 42 : 08 PM INFO: Calculating Chande Momentum Oscillator for period = 8



date

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 NaN

2018 -01 -05 NaN

2018 -01 -08 NaN

...

2018 -12 -24 -67.782887

2018 -12 -26 -20.171553

2018 -12 -27 -22.646215

2018 -12 -28 -22.306363

2018 -12 -31 -15.407946



Length: 251 , dtype: float64



Commodity Channel Index

The Commodity Channel Index​ (CCI) is a momentum-based technical trading tool used most often to help determine when an investment vehicle is reaching a condition of being overbought or oversold. As the price of an investment moves continually in one direction, these indicators help traders to determine when institutional conviction may be changing, and a pause or pullback in the market price may be coming. This information can permit traders to take profit or add to an existing position following a price pullback.



Learn More

commodity_channel_index(high, low, close, period)

Paramters Required/Optional Description Type high required High Prices Data Pandas series low required Low Prices Data Pandas seires close required Close Prices Data Pandas seires period required time period int

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.commodity_channel_index(aapl_data[ 'high' ],aapl_data[ 'low' ],aapl_data[ 'close' ], 8 )

return type : Pandas series



Friday, August 30 , 2019 02 : 47 : 04 PM INFO: Calculating Commodity Channel Index for period = 8



date

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 NaN

2018 -01 -05 NaN

2018 -01 -08 NaN

...

2018 -12 -24 -140.376508

2018 -12 -26 -61.358976

2018 -12 -27 -41.107963

2018 -12 -28 -1.413150

2018 -12 -31 48.940871



Length: 251 , dtype: float64



Coppock Curve

The Coppock curve is intended as a long-term forecasting tool to find trending securities and generate buy signals. It was originally published by E.S.C. Coppock in Barron’s Magazine in 1962. The indicator is trend following in nature. Given it’s mathematically calculated as a weighted moving average, it is not designed to pick bottoms. The Coppock curve was developed to pick trending stocks and thus, by initial design, generates buy signals only.



Learn More

coppock_curve(data,period)

Paramters Required/Optional Description Type data required Data Pandas series period required time period int

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.coppock_curve(aapl_data[ 'close' ], 8 )

return type : Pandas series



Friday, August 30 , 2019 02 : 54 : 26 PM INFO: Calculating Cappock Curve for period = 8



date

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 NaN

2018 -01 -05 NaN

2018 -01 -08 NaN

...

2018 -12 -24 -0.177311

2018 -12 -26 -0.164170

2018 -12 -27 -0.155265

2018 -12 -28 -0.153064

2018 -12 -31 -0.133795



Name: coppock_curve, Length: 251 , dtype: float64



Cumulative Returns

A cumulative return is the aggregate amount an investment has gained or lost over time, independent of the period of time involved.



Learn More

cumulative_returns(data)

Paramters Required/Optional Description Type daily_returns required Daily returns of the asset, strategy or portfolio Pandas Series

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.crypto as crypto





btc_data=crypto.ohlcv( 'BTC/USD' , '2019-01-01' , '2019-07-01' )

daily_returns=analysis.daily_returns(btc_data[ 'close' ])



analysis.cumulative_returns(daily_returns)

return type : Pandas series



Friday, August 30 , 2019 03 : 21 : 26 PM INFO: Calculating Cumulative Returns...



date

2019 -01 -02 -3.039620e+01

2019 -01 -03 4.758991e+01

2019 -01 -04 9.024560e+01

2019 -01 -05 3.722943e+01

2019 -01 -06 2.811514e+02

...

2019 -06 -28 -2.258266e+40

2019 -06 -29 6.788355e+40

2019 -06 -30 -5.637527e+41

2019 -07 -01 3.982342e+41

2019 -07 -02 1.345288e+42



Length: 182 , dtype: float64



Daily Returns (%age)

Get daily returns of a trading strategy or a stock.

daily_returns(data)

Paramters Required/Optional Description Type data required Data Pandas series

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.daily_returns(aapl_data[ 'close' ])

return type : Pandas series (%age)



Friday, August 30 , 2019 03 : 47 : 47 PM INFO: Calculating Daily Returns...



date

2018 -01 -02 NaN

2018 -01 -03 -0.000174

2018 -01 -04 0.004645

2018 -01 -05 0.011385

2018 -01 -08 -0.003714

...

2018 -12 -24 -0.025874

2018 -12 -26 0.070422

2018 -12 -27 -0.006490

2018 -12 -28 0.000512

2018 -12 -31 0.009665



Name: daily_returns, Length: 251 , dtype: float64



Daily Log Returns (%age)

Get daily log returns of a trading strategy or a stock.



Learn More

daily_log_returns(data)

Paramters Required/Optional Description Type data required Data Pandas series

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.daily_log_returns(aapl_data[ 'close' ])

return type : Pandas series (%age)



Friday, August 30 , 2019 04 : 06 : 49 PM INFO: Calculating Daily Log Returns...



date

2018 -01 -02 NaN

2018 -01 -03 -0.017417

2018 -01 -04 0.463420

2018 -01 -05 1.132098

2018 -01 -08 -0.372120

...

2018 -12 -24 -2.621470

2018 -12 -26 6.805257

2018 -12 -27 -0.651094

2018 -12 -28 0.051220

2018 -12 -31 0.961883



Name: daily_log_returns, Length: 251 , dtype: float64



Detrended Price Oscillator

The detrended price oscillator (DPO) is an indicator in technical analysis that attempts to eliminate the long-term trends in prices by using a displaced moving average so it does not react to the most current price action. This allows the indicator to show intermediate overbought and oversold levels effectively.



Learn More

detrended_price_oscillator(data,period)

Paramters Required/Optional Description Type data required Data Pandas series period required time period int

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.detrended_price_oscillator(aapl_data[ 'close' ], 5 )

return type : Pandas series



Friday, August 30 , 2019 07 : 08 : 35 PM INFO: Calculating Detrended Price Oscillator for period = 5



date

2018 -01 -02 16.793426

2018 -01 -03 16.808426

2018 -01 -04 16.546760

2018 -01 -05 -0.870000

2018 -01 -08 -1.144000

...

2018 -12 -24 4.620000

2018 -12 -26 2.340000

2018 -12 -27 -2.812000

2018 -12 -28 -6.592000

2018 -12 -31 2.346000



Name: close, Length: 251 , dtype: float64



Donchain Channel

A Donchian Channel is an indicator formed by upper and lower bands around the price bars. The upper band marks the highest price of an issue for n periods while the lower band marks the lowest price for n periods. The area between the upper and lower bands represents the Donchian Channel.



Learn More

donchian_channel(data,period)

Paramters Required/Optional Description Type close required Data Pandas series period required time period int

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.donchian_channel(aapl_data[ 'close' ], 5 )

returns: dc_high_band, dc_high_band_indicator, dc_low_band, dc_low_band_indicator

return type : Pandas DataFrame



Friday, August 30 , 2019 07 : 40 : 35 PM INFO: Calculating Donchian Channels for period = 5



dc_high_band dc_high_band_indicator dc_low_band dc_low_band_indicator

date

2018 -01 -02 172.26 0.0 172.26 0.0

2018 -01 -03 172.26 0.0 172.23 0.0

2018 -01 -04 173.03 0.0 172.23 0.0

2018 -01 -05 175.00 0.0 172.23 0.0

2018 -01 -08 175.00 0.0 172.23 0.0

... ... ... ...

2018 -12 -24 166.07 0.0 146.83 1.0

2018 -12 -26 160.89 0.0 146.83 0.0

2018 -12 -27 157.17 0.0 146.83 0.0

2018 -12 -28 157.17 0.0 146.83 0.0

2018 -12 -31 157.74 1.0 146.83 0.0



[ 251 rows x 4 columns]



Double EMA

The Double Exponential Moving Average (DEMA) indicator was introduced in January 1994 by Patrick G. Mulloy. It attempts to remove the inherent lag associated to Moving Averages by placing more weight on recent values. The name suggests this is achieved by applying a double exponential smoothing which is not the case. The name double comes from the fact that the value of an EMA (Exponential Moving Average) is doubled.



Learn More

double_ema(data,period)

Paramters Required/Optional Description Type data required Data Pandas series period required time preiod int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as crypto





eth_data=crypto.ohlcv( 'ETH/USD' , '2019-01-01' , '2019-08-01' )



analysis.double_ema(eth_data[ 'close' ], 5 )

return type : Pandas series



Friday, August 30 , 2019 07 : 46 : 47 PM INFO: Calculating Double Exponential Moving Average for period = 5



date

2019 -01 -02 NaN

2019 -01 -03 NaN

2019 -01 -04 NaN

2019 -01 -05 NaN

2019 -01 -06 NaN

...

2019 -07 -29 209.944465

2019 -07 -30 209.249528

2019 -07 -31 213.932942

2019 -08 -01 215.905243

2019 -08 -02 217.103462



Length: 213 , dtype: float64



Downside Risk

Downside risk is the financial risk associated with losses. That is, it is the risk of the actual return being below the expected return, or the uncertainty about the magnitude of that difference.



Learn More

downside_risk(dily_returns, required_return)

Paramters Required/Optional Description Type daily_returns required Daily Returns of an asset, strategy or portfolio Pandas series required_return optional Required Return. 0 by default Int/Float

Data

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis



#load data

aapl_data=stocks.ohlcv('AAPL','2018-01-01','2019-01-01')

daily_returns=analysis.daily_returns(aapl_data['close])



analysis.downside_risk(daily_returns)

return type : Float



Friday, August 30 , 2019 07 : 58 : 08 PM INFO: Calculating Downside Risk...



0.20749425627440662



Ease of Movement

The Ease of Movement technical indicator shows the relationship between price and volume. Often times, traders use this indicator when assessing the strength of an underlying trend.



Learn More

ease_of_movement(high, low, close, volume, period)

Paramters Required/Optional Description Type high required High Prices Data Pandas series low required Low Prices Data Pandas series close required Close Prices Data Pandas series volume required Volume Data Pandas series period required time period int

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.ease_of_movement(aapl_data[ 'high' ], aapl_data[ 'low' ], aapl_data[ 'close' ], aapl_data[ 'volume' ], 7 )

return type : Pandas series



Friday, August 30 , 2019 08 : 22 : 40 PM INFO: Calculating Ease of Movement for period = 7



date

2018 -01 -02 NaN

2018 -01 -03 2.171648e-07

2018 -01 -04 9.371253e-08

2018 -01 -05 1.093783e-07

2018 -01 -08 9.346912e-08

...

2018 -12 -24 -3.631737e-07

2018 -12 -26 -2.369739e-07

2018 -12 -27 -1.812056e-07

2018 -12 -28 -1.449995e-07

2018 -12 -31 -6.321965e-08



Length: 251 , dtype: float64



Exponential Moving Average(EMA)

An exponential moving average (EMA) is a type of moving average (MA) that places a greater weight and significance on the most recent data points. The exponential moving average is also referred to as the exponentially weighted moving average.



Learn More

ema(data,period)

Paramters Required/Optional Description Type data required Data Pandas series period required time period int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.ema(aapl_data[ 'close' ], 7 )

return type: Pandas series



Friday, August 30 , 2019 10 : 04 : 01 PM INFO: Calculating Exponential Moving Average for period = 7



date

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 NaN

2018 -01 -05 NaN

2018 -01 -08 NaN

...

2018 -12 -24 157.139004

2018 -12 -26 157.146753

2018 -12 -27 156.897565

2018 -12 -28 156.730673

2018 -12 -31 156.983005



Length: 251 , dtype: float64



Force Index

The Force Index is an indicator that uses price and volume to assess the power behind a move or identify possible turning points developed by Alexander Elder. According to Elder, there are three essential elements to a stock's price movement: direction, extent and volume. The Force Index combines all three as an oscillator that fluctuates in positive and negative territory as the balance of power shifts. The Force Index can be used to reinforce the overall trend, identify playable corrections or foreshadow reversals with divergences.



Learn More

force_index(close,volume,period)

Paramters Required/Optional Description Type close required Close Prices Data Pandas series volume required Volume Data Pandas series period required time period int

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.force_index(aapl_data[ 'close' ], aapl_data[ 'volume' ], 7 )

return type : Pandas series



Friday, August 30 , 2019 10 : 28 : 23 PM INFO: Calculating Force Index for period = 7



date

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 NaN

2018 -01 -05 NaN

2018 -01 -08 NaN

...

2018 -12 -24 -1.271463e+08

2018 -12 -26 -1.485731e+08

2018 -12 -27 -6.877902e+07

2018 -12 -28 -8.314708e+07

2018 -12 -31 4.423807e+07



Length: 251 , dtype: float64



Hull Moving Average

Hull Moving Average, developed by Alan Hull is an extremely useful indicator to overcome the lag associated with traditional moving averages.



Learn More

hull_moving_average(data,period)

Paramters Required/Optional Description Type data required Data Pandas series period required time period int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.crypto as crypto





btc_data=crypto.ohlcv( 'BTC/USD' , '2019-01-01' , '2019-08-01' )



analysis.hull_moving_average(btc_data[ 'close' ], 7 )

return type : Pandas series



Friday, August 30 , 2019 11 : 20 : 20 PM INFO: Calculating Hull Moving Average for period = 7



date

2019 -01 -02 NaN

2019 -01 -03 NaN

2019 -01 -04 NaN

2019 -01 -05 NaN

2019 -01 -06 NaN

...

2019 -07 -29 9401.301071

2019 -07 -30 9461.199921

2019 -07 -31 9792.339960

2019 -08 -01 10276.583730

2019 -08 -02 10656.194246



Length: 213 , dtype: float64



Ichimoku Cloud

The Ichimoku Cloud, also known as Ichimoku Kinko Hyo, is a versatile indicator that defines support and resistance, identifies trend direction, gauges momentum and provides trading signals.



Learn More

ichimoku_cloud(high, low, short_period, medium_period, long_period)

Paramters Required/Optional Description Type high required High Prices Data Pandas series low required Low Prices Data Pandas series short_period required Short Period int medium_period required Medium Period int long_period required Long Period int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.ichimoku_cloud(aapl_data[ 'high' ],aapl_data[ 'low' ], 4 , 7 , 12 )

returns: chimoku_cloud_a, ichimoku_cloud_b

return type : Pandas DataFrame



Friday, August 30 , 2019 11 : 37 : 24 PM INFO: Calculating Ichimoku Cloud for short period = 4 , medium period = 7 and long period = 12



ichimoku_cloud_a ichimoku_cloud_b

date

2018 -01 -02 170.7800 170.780

2018 -01 -03 171.9050 171.905

2018 -01 -04 171.9050 171.905

2018 -01 -05 172.3150 172.315

2018 -01 -08 173.1100 172.435

... ...

2018 -12 -24 157.4275 160.540

2018 -12 -26 155.9100 159.580

2018 -12 -27 154.7175 159.580

2018 -12 -28 154.7875 159.580

2018 -12 -31 153.6950 159.580



[ 251 rows x 2 columns]



Information Ratio

Information ratio (IR) is a measure of portfolio returns above the returns of a benchmark, usually an index, to the volatility of those returns.



Learn More

information_ratio(daily_returns,benchmark_daily_returns)

Paramters Required/Optional Description Type daily_returns required Daily returns of the asset, strategy or portfolio Pandas Series benchmark_daily_returns required Daily returns of a index or market like Dow Jone Ind. Avg., S&P 500 Index Pandas Series

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )

spx_data=stocks.ohlcv( 'SPX' , '2018-01-01' , '2019-01-01' )

aapl_rets=analysis.daily_returns(aapl_data[ 'close' ])

spx_rets=analysis.daily_returns(spx_data[ 'close' ])



analysis.information_ratio(aapl_rets, spx_rets)

return type : Float



Friday, August 30 , 2019 11 : 45 : 59 PM INFO: Calculating Information Raito...



0.03870562680142687



Kaufman Adaptive Moving Average

Developed by Perry Kaufman, Kaufman's Adaptive Moving Average (KAMA) is a moving average designed to account for market noise or volatility. KAMA will closely follow prices when the price swings are relatively small and the noise is low. KAMA will adjust when the price swings widen and follow prices from a greater distance. This trend-following indicator can be used to identify the overall trend, time turning points and filter price movements.



Learn More

kaufman_adaptive_moving_average(data,period)

Paramters Required/Optional Description Type data required Data Pandas series period required time period Pandas series

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.kaufman_adaptive_moving_average(aapl_data[ 'close' ], 7 )

return type : Pandas series



Friday, August 30 , 2019 11 : 53 : 22 PM INFO: Calculating Kaufman Adaptive Moving Average for period = 7



date

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 NaN

2018 -01 -05 NaN

2018 -01 -08 NaN

...

2018 -12 -24 158.743575

2018 -12 -26 158.670831

2018 -12 -27 158.561945

2018 -12 -28 158.407149

2018 -12 -31 158.395037



Length: 251 , dtype: float64



Keltner Channels

Keltner Channels are a popular technical indicator that traders use to help assess the current trend, spot potential reversals and provide trade signals. The channels use volatility and average prices to plot upper and lower lines, as well as a middle (or average) line. All three of these lines move with the price, creating a channel-like appearance.



Learn More

keltner_channels(high, low, close, period)

Paramters Required/Optional Description Type high required High prices Data Pandas series high required Low prices Data Pandas series close required Close prices Data Pandas series period required time period int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.keltner_channels(aapl_data[ 'high' ],aapl_data[ 'low' ],aapl_data[ 'close' ], 7 )

returns:keltner_channel_central, keltner_channel_highband, keltner_channel_lowband

return type : Pandas DataFrame



Saturday, August 31 , 2019 12 : 09 : 37 AM INFO: Calculating Kelnter Channels for period = 7



keltner_channel_highband keltner_channel_central keltner_channel_lowband

date

2018 -01 -02 174.313333 171.273333 168.233333

2018 -01 -03 174.908333 172.093333 169.278333

2018 -01 -04 174.688889 172.348889 170.008889

2018 -01 -05 175.215000 172.880000 170.545000

2018 -01 -08 175.434000 173.230000 171.026000

... ... ...

2018 -12 -24 165.793810 159.905238 154.016667

2018 -12 -26 164.908571 158.061429 151.214286

2018 -12 -27 163.537619 156.536190 149.534762

2018 -12 -28 162.290000 155.170000 148.050000

2018 -12 -31 160.847619 154.510476 148.173333



[ 251 rows x 3 columns]



Know sure thing/KST

Developed by Martin Pring, Know Sure Thing (KST) is a momentum oscillator based on the smoothed rate-of-change for four different timeframes. In short, KST measures price momentum for four different price cycles, combining them into a single oscillator. Like any other unbound momentum oscillator, chartists can use KST to look for divergences, signal line crossovers, and centerline crossovers. Pring frequently applied trend lines to KST. Although trend line signals do not occur often.



Learn More

know_sure_thing(data,r1,r2,r3,r4,n1,n2,n3,n4,nsig)

Paramters Required/Optional Description Type data required Data Pandas sataframe r1 required r1 period Int r2 required r2 period Int r3 required r3 period Int r4 required r4 period Int n1 required n1 period Int n2 required n2 period Int n3 required n3 period Int n4 required n4 period Int nsig required n period to signal Int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.know_sure_thing(aapl_data[ 'close' ],r1= 10 ,r2= 15 ,r3= 20 ,r4= 30 ,n1= 10 ,n2= 10 ,n3= 10 ,n4= 15 ,nsig= 9 )

return type : Pandas series



Saturday, August 31 , 2019 01 : 14 : 40 PM INFO: Calculating Know Sure Thing...



date

2018 -01 -02 -88.828997

2018 -01 -03 -88.908340

2018 -01 -04 -87.524251

2018 -01 -05 -84.227124

2018 -01 -08 -82.936483

...

2018 -12 -24 -157.579861

2018 -12 -26 -158.049781

2018 -12 -27 -158.192085

2018 -12 -28 -159.958004

2018 -12 -31 -158.230890



Name: close, Length: 251 , dtype: float64



Kurtosis

kurtosis is a statistical measure that is used to describe the distribution. Whereas skewness differentiates extreme values in one versus the other tail, kurtosis measures extreme values in either tail. Distributions with large kurtosis exhibit tail data exceeding the tails of the normal distribution (e.g., five or more standard deviations from the mean). Distributions with low kurtosis exhibit tail data that is generally less extreme than the tails of the normal distribution.



Learn More

kurtosis(data)

Paramters Required/Optional Description Type data required Data Pandas series

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.kurtosis(aapl_data[ 'close' ])

return type : Float



Saturday, August 31 , 2019 01 : 21 : 22 PM INFO: Calculating Kurtosis...



-0.920407994574862



Moving Average Convergence Divergence (MACD)

The Moving Average Convergence Divergence (MACD) is a trend-following momentum indicator that shows the relationship between two moving averages of a security’s price. The MACD is calculated by subtracting the 26-period Exponential Moving Average (EMA) from the 12-period EMA. The result of that calculation is the MACD line. A nine-day EMA of the MACD, called the "signal line", is then plotted on top of the MACD line which can function as a trigger for buy and sell signals. Traders may buy the security when the MACD crosses above its signal line and sell, or short, the security when the MACD crosses below the signal line.



Learn More

macd(data, n_sign, short_period=12, long_period=26)

Paramters Required/Optional Description Type data required Data Pandas series n_sig required n period to signal Int short_period optional Short Period. 12 by default. Int long_period optional Long Period. 26 by default. Int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.macd(aapl_data[ 'close' ], 9 )

returns: macd, macd_signal, macd_difference

return type : Pandas DataFrame



Saturday, August 31 , 2019 01 : 55 : 09 PM INFO: Calculating Moving Average Convergence Divergence for short period = 12 and long period = 26



macd macd_signal macd_difference

date

2018 -01 -02 NaN NaN NaN

2018 -01 -03 NaN NaN NaN

2018 -01 -04 NaN NaN NaN

2018 -01 -05 NaN NaN NaN

2018 -01 -08 NaN NaN NaN

... ... ...

2018 -12 -24 -10.477960 -9.353670 -1.124290

2018 -12 -26 -10.090364 -9.501009 -0.589355

2018 -12 -27 -9.753069 -9.551421 -0.201649

2018 -12 -28 -9.371279 -9.515392 0.144113

2018 -12 -31 -8.844905 -9.381295 0.536390



[ 251 rows x 3 columns]



Mass Index

Mass index is a form of technical analysis that examines the range between high and low stock prices over a period of time. Mass index, developed by Donald Dorsey in the early 1990s, suggests that a reversal of the current trend will likely take place when the range widens beyond a certain point and then contracts.



Learn More

mass_index(high, low, short_period, long_period)

Paramters Required/Optional Description Type high required High Prices Data Pandas series low required Low Prices Data Pandas series short_period required Short Period. Int long_period required Long Period. Int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.mass_index(aapl_data[ 'high' ], aapl_data[ 'low' ], 4 , 9 )

return type : Pandas series



Saturday, August 31 , 2019 02 : 08 : 11 PM INFO: Calculating mass Index for short period = 4 and long period = 9



date

2018 -01 -02 0.000000

2018 -01 -03 0.000000

2018 -01 -04 0.000000

2018 -01 -05 0.000000

2018 -01 -08 0.000000

...

2018 -12 -24 9.153769

2018 -12 -26 9.425518

2018 -12 -27 9.624117

2018 -12 -28 9.629589

2018 -12 -31 9.397642



Length: 251 , dtype: float64



Median Price

The Median Price indicator is simply the midpoint of each day's price. The Typical Price and Weighted Close are similar indicators.



Learn More median_price(high,low)

Paramters Required/Optional Description Type high required High Prices Data Pandas series low required Low Prices Data Pandas series

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.median_price(aapl_data[ 'high' ],aapl_data[ 'low' ])

return type : Pandas series



Saturday, August 31 , 2019 02 : 53 : 26 PM INFO: Calculating Median Price...



date

2018 -01 -02 170.780

2018 -01 -03 173.255

2018 -01 -04 172.775

2018 -01 -05 174.210

2018 -01 -08 174.770

...

2018 -12 -24 149.070

2018 -12 -26 151.975

2018 -12 -27 153.420

2018 -12 -28 156.535

2018 -12 -31 157.920



Length: 251 , dtype: float64



Momentum

The Momentum indicator measures the amount that a security's price has changed over a given time span.



Learn More momentum(data,period)

Paramters Required/Optional Description Type data required Data Pandas series period required time period int

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.momentum(aapl_data[ 'close' ], 7 )

return type : Pandas series



Saturday, August 31 , 2019 02 : 57 : 43 PM INFO: Calculating Momentum for period = 7



date

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 NaN

2018 -01 -05 NaN

2018 -01 -08 NaN

...

2018 -12 -24 -24.12

2018 -12 -26 -8.31

2018 -12 -27 -7.79

2018 -12 -28 -9.84

2018 -12 -31 -3.15



Length: 251 , dtype: float64



Money Flow Index

The Money Flow Index (MFI) is a technical oscillator used for identifying overbought or oversold conditions for an individual security or an ETF or index.



Learn More

money_flow_index(high, low, close, volume, period)

Paramters Required/Optional Description Type high required High Prices Data Pandas series low required Low Prices Data Pandas series close required Close Prices Data Pandas series volume required Volume Data Pandas series period required time period Int

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.money_flow_index(aapl_data[ 'high' ],aapl_data[ 'low' ],aapl_data[ 'close' ],aapl_data[ 'volume' ], 7 )

return type : Pandas series



Saturday, August 31 , 2019 03 : 11 : 01 PM INFO: Calculating Money Flow Index for period = 7



date

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 NaN

2018 -01 -05 NaN

2018 -01 -08 NaN

...

2018 -12 -24 9.675114

2018 -12 -26 24.255009

2018 -12 -27 37.302483

2018 -12 -28 38.309116

2018 -12 -31 49.127377



Length: 251 , dtype: float64



Moving Average

A moving average (MA) is a widely used indicator in technical analysis that helps smooth out price action by filtering out the “noise” from random price fluctuations. It is a trend-following, or lagging, indicator because it is based on past prices.



Learn More

ma(data, period)

Paramters Required/Optional Description Type data required Data Pandas series period required time period Int

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.ma(aapl_data[ 'close' ], 7 )

return type : Pandas series



Saturday, August 31 , 2019 03 : 21 : 15 PM INFO: Calculating Moving Average for period = 7



date

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 NaN

2018 -01 -05 NaN

2018 -01 -08 NaN

...

2018 -12 -24 158.681429

2018 -12 -26 157.494286

2018 -12 -27 156.381429

2018 -12 -28 154.975714

2018 -12 -31 154.525714



Length: 251 , dtype: float64



Moving Standard Deviation

moving_standard_deviation(data, period)

Paramters Required/Optional Description Type data required Data Pandas series period required time period Int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.moving_standard_deviation(aapl_data[ 'close' ], 5 )

return type : Pandas series



Tuesday, September 24 , 2019 11 : 52 : 47 AM INFO: Calculating Moving Standar Deviation for period = 5



datetime

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 NaN

2018 -01 -05 NaN

2018 -01 -08 1.251451

...

2018 -12 -24 7.705569

2018 -12 -26 5.622081

2018 -12 -27 4.575295

2018 -12 -28 4.474251

2018 -12 -31 4.517907



Name: msd, Length: 251 , dtype: float64



Moving Variance

moving_variance(data, period)

Paramters Required/Optional Description Type data required Data Pandas series period required time period Int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.moving_variance(aapl_data[ 'close' ], 5 )

return type : Pandas series



Tuesday, September 24 , 2019 11 : 59 : 41 AM INFO: Calculating Moving Variance for period = 5. ..



datetime

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 NaN

2018 -01 -05 NaN

2018 -01 -08 1.56613

...

2018 -12 -24 59.37580

2018 -12 -26 31.60780

2018 -12 -27 20.93332

2018 -12 -28 20.01892

2018 -12 -31 20.41148



Name: mv, Length: 251 , dtype: float64



Moving Volatility

moving_volatility(daily_returns, period)

Paramters Required/Optional Description Type daily_returns required Daily Returns of an asset, strategy or portfolio Pandas series period required time period Int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )

rets=analysis.daily_returns(aapl_data[ 'close' ])



moving_volatility(rets, 7 )

return type : Pandas series



Saturday, August 31 , 2019 03 : 49 : 53 PM INFO: Calculating Moving volatility for period = 7



moving_volatility

date

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 NaN

2018 -01 -05 NaN

2018 -01 -08 NaN

...

2018 -12 -24 0.046809

2018 -12 -26 0.100689

2018 -12 -27 0.100644

2018 -12 -28 0.098602

2018 -12 -31 0.095870



[ 251 rows x 1 columns]



Negative Volume Index

The Negative Volume Index (NVI) is a cumulative indicator that uses the change in volume to decide when the smart money is active. Paul Dysart first developed this indicator in the 1930s. Dysart's Negative Volume Index works under the assumption that the smart money is active on days when volume decreases and the not-so-smart money is active on days when volume increases.



Learn More

negative_volume_index(data,volume)

Paramters Required/Optional Description Type data required Price Data Pandas Dataframe volume required Voluem Data Pandas Dataframe

Example

Python 🐍 Example:

import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.negative_volume_index(aapl_data[ 'close' ],aapl_data[ 'volume' ])

return type : Pandas series



Saturday, August 31 , 2019 04 : 24 : 43 PM INFO: Calculating Negative Volume Index...



date

2018 -01 -02 1000.000000

2018 -01 -03 1000.000000

2018 -01 -04 1004.644952

2018 -01 -05 1004.644952

2018 -01 -08 1000.913413

...

2018 -12 -24 1290.006623

2018 -12 -26 1290.006623

2018 -12 -27 1281.634753

2018 -12 -28 1282.291370

2018 -12 -31 1294.685021



Name: nvi, Length: 251 , dtype: float64



On Balance Volume

On-balance volume (OBV) is a momentum indicator that uses volume flow to predict changes in stock price. Joseph Granville first developed the OBV metric in the 1960s. He believed that when volume increases sharply without a significant change in the stock's price, the price will eventually jump upward, and vice versa.



Learn More

on_balance_volume(data, volume)

Paramters Required/Optional Description Type data required Prices Data Pandas Dataframe volume required Volume Data Pandas Dataframe

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.on_balance_volume(aapl_data[ 'close' ], aapl_data[ 'volume' ])

return type : Pandas seires



Saturday, August 31 , 2019 04 : 46 : 53 PM INFO: Calculating On Balance Volume...



date

2018 -01 -02 25555934.0

2018 -01 -03 -3961965.0

2018 -01 -04 18472632.0

2018 -01 -05 42132650.0

2018 -01 -08 21564884.0

...

2018 -12 -24 -434317322.0

2018 -12 -26 -375734778.0

2018 -12 -27 -428851843.0

2018 -12 -28 -386560419.0

2018 -12 -31 -351556953.0



Length: 251 , dtype: float64



Omega Ratio

The Omega ratio is a risk-return performance measure of an investment asset, portfolio, or strategy. It was devised by Keating & Shadwick in 2002 and is defined as the probability weighted ratio of gains versus losses for some threshold return target.



Learn More

omega_ratio(daily_retuns, risk_free=0.0, required_return=0.0, trading_days=252)

Paramters Required/Optional Description Type daily_returns required Daily returns of an asset, strategy or portfolio Pandas Dataframe risk_free optional risk free returns. 0 by default. Float required_return optional required returns. 0 by default. Float trading_days optional Number of trading days. 252 by default. Int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )

rets=analysis.daily_returns(aapl_data[ 'close' ])



analysis.omega_ratio(rets)

return type : Float



Saturday, August 31 , 2019 05 : 17 : 40 PM INFO: Calculating Omega Ratio...



0.9714808674247116



Percentage Price Oscillator

The Percentage Price Oscillator (PPO) is a momentum oscillator that measures the difference between two moving averages as a percentage of the larger moving average.



Learn More

percentage_price_oscillator(data, short_period, long_period)

Paramters Required/Optional Description Type data required Data Pandas series short_period required Short Period/Fast moving period Int long_period required Long Period/Slow moving period Int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.percentage_price_oscillator(aapl_data[ 'close' ], 4 , 9 )

return type : Pandas series



Saturday, August 31 , 2019 11 : 17 : 32 PM INFO: Calculating Percentage Price Oscillator for short period = 4 and long period = 9



date

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 NaN

2018 -01 -05 NaN

2018 -01 -08 NaN

...

2018 -12 -24 -4.579479

2018 -12 -26 -4.370035

2018 -12 -27 -3.483628

2018 -12 -28 -1.977962

2018 -12 -31 0.196111



Length: 251 , dtype: float64





Rate of Change

The Rate-of-Change (ROC) indicator, which is also referred to as simply Momentum, is a pure momentum oscillator that measures the percent change in price from one period to the next. The ROC calculation compares the current price with the price “n” periods ago. The plot forms an oscillator that fluctuates above and below the zero line as the Rate-of-Change moves from positive to negative. As a momentum oscillator, ROC signals include centerline crossovers, divergences and overbought-oversold readings.



Learn More

rate_of_change(data,period)

Paramters Required/Optional Description Type data required Data Pandas series period required time period Int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.rate_of_change(aapl_data[ 'close' ], 7 )

returns: rate_of_change, rate_of_change_precentage, rate_of_change_ratio, rate_of_change_ratio_100_scale

return type : Pandas DataFrame



Saturday, August 31 , 2019 11 : 41 : 00 PM INFO: Calculating Rate of Change for period = 7



rate_of_change rate_of_change_precentage rate_of_change_ratio rate_of_change_ratio_100_scale

date

2018 -01 -02 NaN NaN NaN NaN

2018 -01 -03 NaN NaN NaN NaN

2018 -01 -04 NaN NaN NaN NaN

2018 -01 -05 NaN NaN NaN NaN

2018 -01 -08 NaN NaN NaN NaN

... ... ... ...

2018 -12 -24 -14.109389 -0.141094 0.858906 85.890611

2018 -12 -26 -5.021755 -0.050218 0.949782 94.978245

2018 -12 -27 -4.751738 -0.047517 0.952483 95.248262

2018 -12 -28 -5.925212 -0.059252 0.940748 94.074788

2018 -12 -31 -1.957859 -0.019579 0.980421 98.042141



[ 251 rows x 4 columns]



Relative Strength Index

The relative strength index (RSI) is a momentum indicator that measures the magnitude of recent price changes to evaluate overbought or oversold conditions in the price of a stock or other asset.



Learn More

relative_strength_index(data,period)

Paramters Required/Optional Description Type data required Data Pandas series period required time period Int

Example

Python 🐍 import libkloudtrader.stocks as stocks

import libkloudtrader.analysis as analysis





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.relative_strength_index(aapl_data[ 'close' ], 9 )

return type : Pandas series



Saturday, August 31 , 2019 11 : 51 : 12 PM INFO: Calculating Relative Strength Index for peirod = 9



date

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 NaN

2018 -01 -05 NaN

2018 -01 -08 NaN

...

2018 -12 -24 10.047678

2018 -12 -26 45.923875

2018 -12 -27 43.771230

2018 -12 -28 44.028448

2018 -12 -31 49.480936



Length: 251 , dtype: float64



Returns

Get return for any number of trading days. Daily Returns*Number of trading days.

returns(data)

Paramters Required/Optional Description Type data required Data Pandas series

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2019-01-01' , '2019-08-31' )



analysis.returns(aapl_data[ 'close' ])

return type : Float (%age)



Saturday, August 31 , 2019 11 : 59 : 00 PM INFO: Calculating Returns for 168 trading days



30.962499583283332



Sharpe Ratio

The Sharpe ratio was developed by Nobel laureate William F. Sharpe, and is used to help investors understand the return of an investment compared to its risk. The ratio is the average return earned in excess of the risk-free rate per unit of volatility or total risk. Subtracting the risk-free rate from the mean return allows an investor to better isolate the profits associated with risk-taking activities. Get sharpe_ratio for any number of days with this function.



Learn More

sharpe_ratio(daily_returns)

Paramters Required/Optional Description Type daily_returns required Daily Returns of an asser, strategy or portfolio Pandas series

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )

rets=analysis.daily_returns(aapl_data[ 'close' ])



analysis.sharpe_ratio(rets)

return type : Float



Sunday, September 01 , 2019 12 : 50 : 27 AM INFO: Calculating Sharpe Ratio...



-0.1653792413723839



Skewness

Skewness is the degree of distortion from the symmetrical bell curve, or normal distribution, in a set of data. Skewness can be negative, positive, zero or undefined.



Learn More

skewness(data)

Paramters Required/Optional Description Type Data required Data Pandas Dataframe

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.skewness(aapl_data[ 'close' ])

return type : Float



Sunday, September 01 , 2019 11 : 22 : 09 AM INFO: Calculating Skewness...



0.43073328405593453



Sortino Ratio

The Sortino ratio improves upon the Sharpe ratio by isolating downside volatility from total volatility by dividing excess return by the downside deviation.



Learn More

sortino_ratio(daily_returns)

Paramters Required/Optional Description Type daily_returns required Daily Returns of an asset, strategy or portfolio Pandas series required_return optional Required Return. 0 by default Int/Float

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )

rets=analysis.daily_returns(aapl_data[ 'close' ])



analysis.sortino_ratio(rets)

return type : Float



Sunday, September 01 , 2019 12 : 32 : 12 PM INFO: Calculating Sortino Ratio...



-0.22911969792387646



Standard Deviation

The standard deviation is a statistic that measures the dispersion of a dataset relative to its mean and is calculated as the square root of the variance. It is calculated as the square root of variance by determining the variation between each data point relative to the mean. If the data points are further from the mean, there is higher deviation within the data set; thus, the more spread out the data, the higher the standard deviation.



Learn More

standard_deviation(data)

Paramters Required/Optional Description Type data required Data Pandas series

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.standard_deviation(aapl_data[ 'close' ])

return type : Float



Sunday, September 01 , 2019 03 : 41 : 26 PM INFO: Calculating Standar Deviation...



20.593860391231797



Stochastic Oscillator

The stochastic oscillator is a momentum indicator comparing theclosing price of a security to the range of its prices over a certain period of time. The sensitivity of the oscillator to market movements is reducible by adjusting that time period or by taking a moving average of the result.



Learn More

stochastic_oscillator(high,low,close,period)

Paramters Required/Optional Description Type high required High prices data Pandas series low required Low prices data Pandas series close required Close prices data Pandas series period required time period Int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.stochastic_oscillator(aapl_data[ 'high' ],aapl_data[ 'low' ],aapl_data[ 'close' ],period= 5 )

return type : Pandas series



Sunday, September 01 , 2019 04 : 35 : 06 PM INFO: Calculating Stochastic Oscillator for period = 5



date

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 NaN

2018 -01 -05 NaN

2018 -01 -08 80.157480

...

2018 -12 -24 1.146132

2018 -12 -26 50.719080

2018 -12 -27 61.597938

2018 -12 -28 80.804694

2018 -12 -31 87.314017



Length: 251 , dtype: float64



Stochastic RSI

The StochRSI is an indicator used in technical analysis that ranges between zero and one and is created by applying the Stochastic Oscillator formula to a set of Relative Strength Index (RSI) values rather than to standard price data.



Learn More

stochastic_rsi(close, period, fast_period1=5, fast_period2=3)

Paramters Required/Optional Description Type close required Close prices data Pandas series period required time period Int fast_period1 required Fast-Period1/Short-Period1. 5 by default. Int fast_period2 required Fast-Period2/Short-Period2. 3 by default. Int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.stochastic_rsi(aapl_data[ 'high' ], 14 )

returns: fast_period1, fast_period2

return type : Pandas DataFrame



Sunday, September 01 , 2019 04 : 44 : 14 PM INFO: Calculating Stochastic RSI for period = 14 , fast_period1 = 5 , fast_period2 = 3



fast_period1 fast_period2

date

2018 -01 -02 NaN NaN

2018 -01 -03 NaN NaN

2018 -01 -04 NaN NaN

2018 -01 -05 NaN NaN

2018 -01 -08 NaN NaN

... ...

2018 -12 -24 0.000000 4.736952e-15

2018 -12 -26 100.000000 3.333333e+01

2018 -12 -27 97.030867 6.567696e+01

2018 -12 -28 100.000000 9.901029e+01

2018 -12 -31 100.000000 9.901029e+01



[ 251 rows x 2 columns]



Tail Ratio

Tail Ratio is the Ratio between the 95th and (absolute) 5th percentile of the daily returns distribution.



Learn More

tail_ratio(daily_returns)

Paramters Required/Optional Description Type daily_returns required Daily returns of an asset,strategy or protfolio Pandas Dataframe

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )

rets = analysis.daily_returns(aapl_data[ 'close' ])



analysis.tail_ratio(rets)

return type : Float



Sunday, September 01 , 2019 04 : 51 : 42 PM INFO: Calculating Tail Ratio...



0.9290594476193893



Time Series Forecast

The Time Series Forecast indicator displays the statistical trend of a security's price over a specified time period. The trend is based on linear regression analysis. Rather than plotting a straight linear regression trendline, the Time Series Forecast plots the last point of multiple linear regression trendlines. The resulting Time Series Forecast indicator is sometimes referred to as the "moving linear regression" indicator or the "regression oscillator."



Learn More

time_series_forecast(data, period)

Paramters Required/Optional Description Type data required Data Pandas series period required time period Int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.time_series_forecast(aapl_data[ 'close' ], 8 )

return type : Pandas series



Sunday, September 01 , 2019 05 : 20 : 31 PM INFO: Calculating Time Series Forecast for period = 8



date

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 NaN

2018 -01 -05 NaN

2018 -01 -08 NaN

...

2018 -12 -24 145.798929

2018 -12 -26 148.110357

2018 -12 -27 149.434643

2018 -12 -28 151.248571

2018 -12 -31 155.404286



Length: 251 , dtype: float64



TRIX

TRIX is a momentum oscillator that displays the percent rate of change of a triple exponentially smoothed moving average. It was developed in the early 1980's by Jack Hutson, an editor for Technical Analysis of Stocks and Commodities magazine. With its triple smoothing, TRIX is designed to filter insignificant price movements.



Learn More

trix(data, period)

Paramters Required/Optional Description Type data required Data Pandas series period required time period Int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.trix(aapl_data[ 'close' ], 8 )

return type : Pandas series



Sunday, September 01 , 2019 05 : 26 : 41 PM INFO: Calculating Trix for period = 8



date

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 NaN

2018 -01 -05 NaN

2018 -01 -08 NaN

...

2018 -12 -24 -0.892349

2018 -12 -26 -0.923051

2018 -12 -27 -0.911543

2018 -12 -28 -0.871167

2018 -12 -31 -0.802735



Length: 251 , dtype: float64



Triangular Moving Average

The triangular moving average (also known as the TMA) is similar to other moving averages in that it shows the average (or mean) price over a specified number of data points (usually a number of price bars). However, the triangular moving average differs in that it is double smoothed—which also means averaged twice.



Learn More

triangular_ma(data, period)

Paramters Required/Optional Description Type data required Data Pandas series period required time period Int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.triangular_ma(aapl_data[ 'close' ], 8 )

return type : Pandas series



Sunday, September 01 , 2019 05 : 45 : 52 PM INFO: Calculating Triangular Moving Average for period = 8

date

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 NaN

2018 -01 -05 NaN

2018 -01 -08 NaN

...

2018 -12 -24 161.0175

2018 -12 -26 158.2735

2018 -12 -27 155.9985

2018 -12 -28 154.4310

2018 -12 -31 154.0695



Length: 251 , dtype: float64



Triple EMA

The triple exponential moving average, or TEMA, was developed by Patrick Mulloy in 1994 to filter out volatility from conventional moving averages. While the name implies that it's a triple exponential smoothing, it's actually a composite of a single exponential moving average, a double exponential moving average, and a triple exponential moving average.



Learn More

triple_ema(data, period)

Paramters Required/Optional Description Type data required Data Pandas series period required time period Int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.triple_ema(aapl_data[ 'close' ], 8 )

return type : Pandas series



Sunday, September 01 , 2019 05 : 51 : 03 PM INFO: Calculating Triangular Moving Average for period = 8



date

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 NaN

2018 -01 -05 NaN

2018 -01 -08 NaN

...

2018 -12 -24 161.0175

2018 -12 -26 158.2735

2018 -12 -27 155.9985

2018 -12 -28 154.4310

2018 -12 -31 154.0695



Length: 251 , dtype: float64



True Strength Index

The true strength index is a technical momentum indicator that helps traders identify short-term price swings while trading in the direction of the trend. The indicator is useful for determining overbought and oversold conditions of a security by incorporating the short-term momentum of the market with the lagging benefits of moving averages.



Learn More

true_strength_index(data,high_period,low_period)

Paramters Required/Optional Description Type data required Data Pandas series high_period required High Period Int low_period required Low Period Int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.true_strength_index(true_strength_index(aapl_data[ 'close' ], 25 , 13 ))

return type : Pandas series



Sunday, September 01 , 2019 07 : 53 : 29 PM INFO: Calculating True Strength Index for high period = 25 and low period = 13



date

2018 -01 -02 -100.000000

2018 -01 -03 -100.000000

2018 -01 -04 -98.006195

2018 -01 -05 -93.555546

2018 -01 -08 -90.780855

...

2018 -12 -24 -26.501575

2018 -12 -26 -26.527827

2018 -12 -27 -26.606466

2018 -12 -28 -26.668990

2018 -12 -31 -26.583278



Name: tsi, Length: 251 , dtype: float64





Typical Price

The Typical Price is the average of the high + low + close of a bar. It is used in the calculation of several indicators. It can be used to smooth an indicator that normally takes just the closing price as input.



Learn More

typical_price(high, low, close)

Paramters Required/Optional Description Type high required High prices data Pandas series low required Low prices data Pandas series close required Close prices data Pandas series

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.typical_price(aapl_data[ 'high' ],aapl_data[ 'low' ],aapl_data[ 'close' ])

return type : Pandas series



Sunday, September 01 , 2019 08 : 11 : 40 PM INFO: Calculating Typical Price...



date

2018 -01 -02 171.273333

2018 -01 -03 172.913333

2018 -01 -04 172.860000

2018 -01 -05 174.473333

2018 -01 -08 174.630000

...

2018 -12 -24 148.323333

2018 -12 -26 153.706667

2018 -12 -27 154.330000

2018 -12 -28 156.433333

2018 -12 -31 157.860000



Length: 251 , dtype: float64



Ultimate Oscillator

The Ultimate Oscillator is a technical indicator that was developed by Larry Williams in 1976 to measure momentum across multiple timeframes. By using the weighted average of three different timeframes, the indicator has less volatility and fewer trade signals compared to other indicators that rely on a single timeframe.



Learn More

ultimate_oscillator(high, low, close, short_period, medium_period, long_period)

Paramters Required/Optional Description Type high required High prices data Pandas series low required Low prices data Pandas series close required Close prices data Pandas series short_period required Short Period Int medium_period required Medium Period Int long_period required Long Period Int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.ultimate_oscillator(aapl_data[ 'high' ],aapl_data[ 'low' ],aapl_data[ 'close' ], 4 , 8 , 15 )

return type : Pandas series



Sunday, September 01 , 2019 08 : 23 : 28 PM INFO: Calculating Ultimate Oscillator for short period = 4 , medium period = 8 and long period = 15



date

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 NaN

2018 -01 -05 NaN

2018 -01 -08 NaN

...

2018 -12 -24 20.149444

2018 -12 -26 39.725496

2018 -12 -27 51.587739

2018 -12 -28 58.854791

2018 -12 -31 64.956589



Length: 251 , dtype: float64



Variance

Variance is a measurement of the spread between numbers in a data set. The variance measures how far each number in the set is from the mean. Variance is calculated by taking the differences between each number in the set and the mean, squaring the differences (to make them positive) and dividing the sum of the squares by the number of values in the set.



Learn More

variance(data)

Paramters Required/Optional Description Type data required Data Pandas series

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.variance(aapl_data[ 'close' ])

return type : Float



Sunday, September 01 , 2019 09 : 03 : 10 PM INFO: Calculating Variance...



424.1070858135459



Vertical Horizontal Filter

Vertical Horizontal Filter (VHF) was developed by Adam White in 1991 and it is used in technical analysis to recognize periods when price is trending (up-trend or down-trend) or it is in the congestion phase (side-way trend).



Learn More

vertical_horizontal_filter(data, period)

Paramters Required/Optional Description Type data required Data Pandas series period required time period Int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.vertical_horizontal_filter(aapl_data[ 'close' ], 7 )

return type: Pandas Dataframe



Monday, September 02 , 2019 02 : 18 : 12 PM INFO: Calculating Vertical Horizontal Filter for period = 7



vhf

date

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 NaN

2018 -01 -05 NaN

2018 -01 -08 NaN

...

2018 -12 -24 0.462945

2018 -12 -26 0.500000

2018 -12 -27 0.474827

2018 -12 -28 0.466180

2018 -12 -31 0.457251



[ 251 rows x 1 columns]



Volatility

Get volatility for any number of trading days.

volatility(daily_returns)

Paramters Required/Optional Description Type daily_returns required daily returns of an asset, strategy or portfolio Pandas series

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )

rets=analysis.daily_returns(aapl_data[ 'close' ])



analysis.volatility(rets)

return type : Float



Sunday, September 01 , 2019 09 : 11 : 21 PM INFO: Calculating Volatility...



0.28690031394393173



Volume Price Trend

The volume price trend (VPT) indicator helps determine a security’s price direction and strength of price change. The indicator consists of a cumulative volume line that adds or subtracts a multiple of the percentage change in a share price’s trend and current volume, depending upon the security’s upward or downward movements.



Learn More

volume_price_trend(data,volume)

Paramters Required/Optional Description Type data required Price data Pandas series volume required Volume data Pandas series

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.volume_price_trend(aapl_data[ 'close' ],aapl_data[ 'volume' ])

return type : Pandas series



Sunday, September 01 , 2019 10 : 31 : 52 PM INFO: Calculating Volume Price Trend...



date

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 9.906692e+04

2018 -01 -05 3.735842e+05

2018 -01 -08 1.929821e+05

...

2018 -12 -24 -4.685757e+06

2018 -12 -26 3.163755e+06

2018 -12 -27 3.780757e+06

2018 -12 -28 -3.230514e+05

2018 -12 -31 3.599839e+05



Length: 251 , dtype: float64



Volume adjusted moving average

the volume-adjusted moving average indicator (sometimes called Equivolume charting) makes price and volume equal partners in computing the price average. The volume value is used as a weight factor for the price value. Therefore, the VAMA is responsive to changes in the trading volume. Important days on the market (high trading volume) have greater contribution in the moving average than days with low trading volume.



Learn More

volume_adjusted_moving_average(data, volume, period)

Paramters Required/Optional Description Type data required Price data Pandas series volume required Volume data Pandas series period required time period Int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.volume_adjusted_moving_average(aapl_data[ 'close' ],aapl_data[ 'volume' ], 7 )

return type : Pandas series



Sunday, September 01 , 2019 11 : 18 : 27 PM INFO: Calcilating Volume adjusted moving average for period = 7



date

2018 -01 -02 NaN

2018 -01 -03 NaN

2018 -01 -04 NaN

2018 -01 -05 NaN

2018 -01 -08 NaN

...

2018 -12 -24 360.700066

2018 -12 -26 376.190778

2018 -12 -27 382.668832

2018 -12 -28 388.855220

2018 -12 -31 374.003721



Length: 251 , dtype: float64



Vortex Indicator

Developed by Etienne Botes and Douglas Siepman, the Vortex Indicator consists of two oscillators that capture positive and negative trend movement. In creating this indicator, Botes and Seipman drew on the work of Welles Wilder and Viktor Schauberger, who is considered the father of implosion technology. Despite a rather involved formula, the indicator is quite straightforward to understand and easy to interpret. A bullish signal triggers when the positive trend indicator crosses above the negative trend indicator or a key level. A bearish signal triggers when the negative trend indicator crosses above the positive trend indicator or a key level. The Vortex Indicator is either above or below these levels, which means it always has a clear bullish or bearish bias.



Learn More

vortex_indicator(high,low,close,period)

Paramters Required/Optional Description Type high required High prices data Pandas series low required Low prices data Pandas series close required Close prices data Pandas series period required time period Int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.vortex_indicator(aapl_data[ 'high' ],aapl_data[ 'low' ],aapl_data[ 'close' ], 7 )

returns: vortex_inidicator_positive, vortex_indicator_negative

return type : Pandas DataFrame



Monday, September 02 , 2019 12 : 06 : 35 PM INFO: Calculating Vortex Indicator for period = 7



vortex_inidicator_positive vortex_indicator_negative

date

2018 -01 -02 NaN NaN

2018 -01 -03 NaN NaN

2018 -01 -04 NaN NaN

2018 -01 -05 NaN NaN

2018 -01 -08 NaN NaN

... ...

2018 -12 -24 0.440974 1.429490

2018 -12 -26 0.607069 1.235635

2018 -12 -27 0.729041 1.215203

2018 -12 -28 0.796178 1.171377

2018 -12 -31 0.927572 1.165297



[ 251 rows x 2 columns]



Volume Weighted Average Price (VWAP)

Volume-Weighted Average Price (VWAP) is exactly what it sounds like: the average price weighted by volume. VWAP equals the dollar value of all trading periods divided by the total trading volume for the current day. The calculation starts when trading opens and ends when trading closes. Because it is good for the current trading day only, intraday periods and data are used in the calculation.



Learn More

vwap(high,low,close,volume)

Paramters Required/Optional Description Type high required High prices data Pandas series low required Low prices data Pandas series close required Close prices data Pandas series volume required Volume data Pandas series

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



print(analysis.vwap(aapl_data[ 'high' ],aapl_data[ 'low' ],aapl_data[ 'close' ],aapl_data[ 'volume' ]))

return type : Pandas series



Monday, September 02 , 2019 01 : 34 : 08 PM INFO: Calculating Volume Weighted Average Price...

date

2018 -01 -02 170.780000

2018 -01 -03 172.106525

2018 -01 -04 172.300013

2018 -01 -05 172.746697

2018 -01 -08 173.088541

...

2018 -12 -24 188.036479

2018 -12 -26 187.785257

2018 -12 -27 187.569549

2018 -12 -28 187.415221

2018 -12 -31 187.294322



Length: 251 , dtype: float64



Weighted Close Price

The Weighted Close is the average of the high, low and close of a bar, but the close is weighted, actually counted twice. It is used in the calculation of several indicators. It can be used to smooth an indicator that normally takes just the closing price as input.



Learn More

weighted_close_price(high, low, close)

Paramters Required/Optional Description Type high required High prices data Pandas series low required Low prices data Pandas series close required Close prices data Pandas series

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.weighted_close_price(aapl_data[ 'high' ],aapl_data[ 'low' ],aapl_data[ 'close' ])



weighted_close_price(aapl_data[ 'high' ],aapl_data[ 'low' ],aapl_data[ 'close' ])

return type : Pandas series



Monday, September 02 , 2019 01 : 47 : 31 PM INFO: Calculating Weighted Close Price...



date

2018 -01 -02 171.5200

2018 -01 -03 172.7425

2018 -01 -04 172.9025

2018 -01 -05 174.6050

2018 -01 -08 174.5600

...

2018 -12 -24 147.9500

2018 -12 -26 154.5725

2018 -12 -27 154.7850

2018 -12 -28 156.3825

2018 -12 -31 157.8300



Length: 251 , dtype: float64



Williams %R

Developed by Larry Williams, Williams %R is a momentum indicator that is the inverse of the Fast Stochastic Oscillator. Also referred to as %R, Williams %R reflects the level of the close relative to the highest high for the look-back period. In contrast, the Stochastic Oscillator reflects the level of the close relative to the lowest low. %R corrects for the inversion by multiplying the raw value by -100. As a result, the Fast Stochastic Oscillator and Williams %R produce the exact same lines, only the scaling is different. Williams %R oscillates from 0 to -100. Readings from 0 to -20 are considered overbought. Readings from -80 to -100 are considered oversold.



Learn More

williams_r(high,low,close,period)

Paramters Required/Optional Description Type high required High prices data Pandas series low required Low prices data Pandas series close required Close prices data Pandas series period required time period Int

Example

Python 🐍 import libkloudtrader.analysis as analysis

import libkloudtrader.stocks as stocks





aapl_data=stocks.ohlcv( 'AAPL' , '2018-01-01' , '2019-01-01' )



analysis.williams_r(aapl_data[ 'high' ],aapl_data[ 'low' ],aapl_data[ 'close' ], 7 )

return type : Pandas series



Monday, September 02, 2019 01:53:54 PM INFO: Calculating Williams' %R for period = {}



date

2018-01-02 NaN

2018-01-03 NaN

2018-01-04 NaN

2018-01-05 NaN

2018-01-08 NaN

...

2018-12-24 -98.932859

2018-12-26 -51.378676

2018-12-27 -54.345750

2018-12-28 -53.787152

2018-12-31 -28.157216



Length: 251, dtype: float64



Weighted Moving Average (WMA)

The Weighted Moving Average calculates a weight for each value in the series. The more recent values are assigned greater weights. The Weighted Moving Average is similar to a Simple Moving average in that it is not cumulative, that is, it only includes values in the time period (unlike an Exponential Moving Average). The Weighted Moving Average is similar to an Exponential Moving Average in that more recent data has a greater contribution to the average.



Learn More

wma(data, period)

Paramters Required/Optional Description Type data required Sata Pandas Dataframe period required time period Int

Example