Permalink
Browse files

add markdown documentation and an html generator to convert the docs …

…into the website
  • Loading branch information...
1 parent d15da63 commit 0a83f8af1bce24795b24ab58800a85f0130f8d91 @briancappello briancappello committed Feb 25, 2013
View
488 README.md

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -0,0 +1,103 @@
+# Abstract API Quick Start
+
+If you're already familiar with using the function API, you should feel right
+at home using the abstract API. Every function takes the same input, passed
+as a dictionary of Numpy arrays:
+
+```python
+import numpy as np
+# note that all ndarrays must be the same length!
+inputs = {
+ 'open': np.random.random(100),
+ 'high': np.random.random(100),
+ 'low': np.random.random(100),
+ 'close': np.random.random(100),
+ 'volume': np.random.random(100)
+}
+```
+
+Functions can either be imported directly or instantiated by name:
+
+```python
+from talib import abstract
+sma = abstract.SMA
+sma = abstract.Function('sma')
+```
+
+From there, calling functions is basically the same as the function API:
+
+```python
+from talib.abstract import *
+output = SMA(input_arrays, timeperiod=25) # calculate on close prices by default
+output = SMA(input_arrays, timeperiod=25, price='open') # calculate on opens
+upper, middle, lower = BBANDS(input_arrays, 20, 2, 2)
+slowk, slowd = STOCH(input_arrays, 5, 3, 0, 3, 0) # uses high, low, close by default
+slowk, slowd = STOCH(input_arrays, 5, 3, 0, 3, 0, prices=['high', 'low', 'open'])
+```
+
+## Advanced Usage
+
+For more advanced use cases of TA-Lib, the Abstract API also offers much more
+flexibility. You can even subclass ``abstract.Function`` and override
+``set_input_arrays`` to customize the type of input data Function accepts
+(e.g. a pandas DataFrame).
+
+Details about every function can be accessed via the info property:
+
+```python
+print Function('stoch').info
+{
+ 'name': 'STOCH',
+ 'display_name': 'Stochastic',
+ 'group': 'Momentum Indicators',
+ 'input_names': OrderedDict([
+ ('prices', ['high', 'low', 'close']),
+ ]),
+ 'parameters': OrderedDict([
+ ('fastk_period', 5),
+ ('slowk_period', 3),
+ ('slowk_matype', 0),
+ ('slowd_period', 3),
+ ('slowd_matype', 0),
+ ]),
+ 'output_names': ['slowk', 'slowd'],
+}
+
+```
+Or in human-readable format:
+```python
+help(STOCH)
+str(STOCH)
+```
+
+Other useful properties of ``Function``:
+
+```python
+Function('x').function_flags
+Function('x').input_names
+Function('x').input_arrays
+Function('x').parameters
+Function('x').lookback
+Function('x').output_names
+Function('x').output_flags
+Function('x').outputs
+```
+
+Aside from calling the function directly, Functions maintain state and will
+remember their parameters/input_arrays after they've been set. You can set
+parameters and recalculate with new input data using run():
+```python
+SMA.parameters = {'timeperiod': 15}
+result1 = SMA.run(input_arrays1)
+result2 = SMA.run(input_arrays2)
+
+# Or set input_arrays and change the parameters:
+SMA.input_arrays = input_arrays1
+ma10 = SMA(timeperiod=10)
+ma20 = SMA(20)
+```
+
+For more details, take a look at the
+[code](https://github.com/mrjbq7/ta-lib/blob/master/talib/abstract.pyx#L46).
+
+[Documentation Index](doc_index.html)
View
@@ -0,0 +1,16 @@
+# Documentation
+
+* [Installation and Troubleshooting](install.html)
+* [Using the Function API](func.html)
+* [Using the Abstract API](abstract.html)
+* [All Functions](funcs.html)
+ * [Overlap Studies](func_groups/overlap_studies.html)
+ * [Momentum Indicators](func_groups/momentum_indicators.html)
+ * [Volume Indicators](func_groups/volume_indicators.html)
+ * [Volatility Indicators](func_groups/volatility_indicators.html)
+ * [Price Transform](func_groups/price_transform.html)
+ * [Cycle Indicators](func_groups/cycle_indicators.html)
+ * [Pattern Recognition](func_groups/pattern_recognition.html)
+ * [Statistic Functions](func_groups/statistic_functions.html)
+ * [Math Transform](func_groups/math_transform.html)
+ * [Math Operators](func_groups/math_operators.html)
View
@@ -0,0 +1,54 @@
+# Function API Examples
+
+Similar to TA-Lib, the function interface provides a lightweight wrapper of
+the exposed TA-Lib indicators.
+
+Each function returns an output array and have default values for their
+parameters, unless specified as keyword arguments. Typically, these functions
+will have an initial "lookback" period (a required number of observations
+before an output is generated) set to ``NaN``.
+
+All of the following examples use the function API:
+
+```python
+import numpy
+import talib
+
+close = numpy.random.random(100)
+```
+
+Calculate a simple moving average of the close prices:
+
+```python
+output = talib.SMA(close)
+```
+
+Calculating bollinger bands, with triple exponential moving average:
+
+```python
+from talib import MA_Type
+
+upper, middle, lower = talib.BBANDS(close, matype=MA_Type.T3)
+```
+
+Calculating momentum of the close prices, with a time period of 5:
+
+```python
+output = talib.MOM(close, timeperiod=5)
+```
+
+Documentation for all functions:
+
+* [Overlap Studies](func_groups/overlap_studies.html)
+* [Momentum Indicators](func_groups/momentum_indicators.html)
+* [Volume Indicators](func_groups/volume_indicators.html)
+* [Volatility Indicators](func_groups/volatility_indicators.html)
+* [Pattern Recognition](func_groups/pattern_recognition.html)
+* [Cycle Indicators](func_groups/cycle_indicators.html)
+* [Statistic Functions](func_groups/statistic_functions.html)
+* [Price Transform](func_groups/price_transform.html)
+* [Math Transform](func_groups/math_transform.html)
+* [Math Operators](func_groups/math_operators.html)
+
+[Documentation Index](doc_index.html)
+[FLOAT_RIGHTNext: Using the Abstract API](abstract.html)
@@ -0,0 +1,34 @@
+# Cycle Indicator Functions
+### HT_DCPERIOD - Hilbert Transform - Dominant Cycle Period
+```
+real = HT_DCPERIOD(close)
+```
+
+Learn more about the Hilbert Transform - Dominant Cycle Period at [tadoc.org](http://www.tadoc.org/indicator/HT_DCPERIOD.htm).
+### HT_DCPHASE - Hilbert Transform - Dominant Cycle Phase
+```
+real = HT_DCPHASE(close)
+```
+
+Learn more about the Hilbert Transform - Dominant Cycle Phase at [tadoc.org](http://www.tadoc.org/indicator/HT_DCPHASE.htm).
+### HT_PHASOR - Hilbert Transform - Phasor Components
+```
+inphase, quadrature = HT_PHASOR(close)
+```
+
+Learn more about the Hilbert Transform - Phasor Components at [tadoc.org](http://www.tadoc.org/indicator/HT_PHASOR.htm).
+### HT_SINE - Hilbert Transform - SineWave
+```
+sine, leadsine = HT_SINE(close)
+```
+
+Learn more about the Hilbert Transform - SineWave at [tadoc.org](http://www.tadoc.org/indicator/HT_SINE.htm).
+### HT_TRENDMODE - Hilbert Transform - Trend vs Cycle Mode
+```
+integer = HT_TRENDMODE(close)
+```
+
+Learn more about the Hilbert Transform - Trend vs Cycle Mode at [tadoc.org](http://www.tadoc.org/indicator/HT_TRENDMODE.htm).
+
+[Documentation Index](../doc_index.html)
+[FLOAT_RIGHTAll Function Groups](../funcs.html)
@@ -0,0 +1,59 @@
+# Math Operator Functions
+### ADD - Vector Arithmetic Add
+```
+real = ADD(high, low)
+```
+
+### DIV - Vector Arithmetic Div
+```
+real = DIV(high, low)
+```
+
+### MAX - Highest value over a specified period
+```
+real = MAX(close, timeperiod=30)
+```
+
+### MAXINDEX - Index of highest value over a specified period
+```
+integer = MAXINDEX(close, timeperiod=30)
+```
+
+### MIN - Lowest value over a specified period
+```
+real = MIN(close, timeperiod=30)
+```
+
+### MININDEX - Index of lowest value over a specified period
+```
+integer = MININDEX(close, timeperiod=30)
+```
+
+### MINMAX - Lowest and highest values over a specified period
+```
+min, max = MINMAX(close, timeperiod=30)
+```
+
+### MINMAXINDEX - Indexes of lowest and highest values over a specified period
+```
+minidx, maxidx = MINMAXINDEX(close, timeperiod=30)
+```
+
+### MULT - Vector Arithmetic Mult
+```
+real = MULT(high, low)
+```
+
+### SUB - Vector Arithmetic Substraction
+```
+real = SUB(high, low)
+```
+
+### SUM - Summation
+```
+real = SUM(close, timeperiod=30)
+```
+
+
+[Documentation Index](../doc_index.html)
+[FLOAT_RIGHTAll Function Groups](../funcs.html)
@@ -0,0 +1,79 @@
+# Math Transform Functions
+### ACOS - Vector Trigonometric ACos
+```
+real = ACOS(close)
+```
+
+### ASIN - Vector Trigonometric ASin
+```
+real = ASIN(close)
+```
+
+### ATAN - Vector Trigonometric ATan
+```
+real = ATAN(close)
+```
+
+### CEIL - Vector Ceil
+```
+real = CEIL(close)
+```
+
+### COS - Vector Trigonometric Cos
+```
+real = COS(close)
+```
+
+### COSH - Vector Trigonometric Cosh
+```
+real = COSH(close)
+```
+
+### EXP - Vector Arithmetic Exp
+```
+real = EXP(close)
+```
+
+### FLOOR - Vector Floor
+```
+real = FLOOR(close)
+```
+
+### LN - Vector Log Natural
+```
+real = LN(close)
+```
+
+### LOG10 - Vector Log10
+```
+real = LOG10(close)
+```
+
+### SIN - Vector Trigonometric Sin
+```
+real = SIN(close)
+```
+
+### SINH - Vector Trigonometric Sinh
+```
+real = SINH(close)
+```
+
+### SQRT - Vector Square Root
+```
+real = SQRT(close)
+```
+
+### TAN - Vector Trigonometric Tan
+```
+real = TAN(close)
+```
+
+### TANH - Vector Trigonometric Tanh
+```
+real = TANH(close)
+```
+
+
+[Documentation Index](../doc_index.html)
+[FLOAT_RIGHTAll Function Groups](../funcs.html)
Oops, something went wrong.

0 comments on commit 0a83f8a

Please sign in to comment.