Skip to content
Ruben edited this page Feb 20, 2018 · 14 revisions

Stock documentation

Installation

The quickest way is to use pip, which will install all the dependencies (basically pandas and ta-lib wrappers):

pip install technify

If you intend to use Quandl often, getting a API key is advised to skip the 50 calls/day limit.
Technify will try to read that key from the user's .bashrc:

export QUANDL_TOKEN="your_API_key"

Loading data

Technify accepts any json structure and does it best to convert it to a Pandas dataset:

data = [{'date': datetime.datetime(2018, 2, 19, 0, 0), 'o': 90.0, 'h': 90.800003, 'l': 89.480003, 
         'c': 90.360001, 'adjc': 90.360001, 'v': 230265, 'ticker': 'HO.PA'}]

thales = Stock(data)

which prints

>> Stock - available cols:['adjc', 'c', 'date', 'h', 'l', 'o', 'ticker', 'v']

It is also possible to retrieve the data directly from Quandl given its ticker:

from technify import Stock

bitusd = Stock.fromQuandl("BCHARTS/KRAKENUSD")

Once the data is loaded, a console message shows the available columns:

>> BCHARTS/KRAKENUSD - available cols:['Open', 'High', 'Low', 'Close', 'Volume (BTC)', 'Volume (Currency)', 'Weighted Price']

All the data is stored inside a inner Pandas dataframe which can be access just by doing:

print (bitusd.data)

Adding technical indicators

Technify relies in the ta-lib library so the algorithms provided are the ones described in their repository documentation

Overlap

The overlap methods are intended to be plotted on top of the ohlcv data.

from technify import Overlap

The default output column name can be overriden by means of the saveas list parameter:

msft = Stock.fromQuandl("EOD/MSFT").append(ov.ema, "Open", timeperiod=40)   # stores the result as 'ema'
msft = Stock.fromQuandl("EOD/MSFT").append(ov.bbands, saveas=["low", "medium", "high"])  # custom Bollinger bands

The following list describes the function name of the Overlap module:

Function Name Description Default output colums
bbands Bollinger Bands bbands_lb, bbands_mb, bbands_ub
dema Double Exponential Moving Average dema
ema Exponential Moving Average ema
trendline Hilbert Transform - Instantaneous Trendline trendline
kama Kaufman Adaptive Moving Average kama
ma Moving average ma
mama MESA Adaptive Moving Average mama, fama
mavp Moving average with variable period mavp
midpoint MidPoint over period midpoint
midprice Midpoint Price over period midprice
sar Parabolic SAR sar
sarext Parabolic SAR - Extended sarext
sma Simple Moving Average sma
t3 Triple Exponential Moving Average (T3) t3
tema Triple Exponential Moving Average tema
trima Triangular Moving Average trima
wma Weighted Moving Average wma
Clone this wiki locally