Configuration Settings
The library includes a module named config
which allows to alter some of the
default settings.
Configuring Data Inputs
btalib.config.set_input_indices(**kwargs)
The library expects the following names (the dict
keys) and indices, if the
names are not found in a single input dataframe
{ 'open': 0, 'high': 1, 'low': 2, 'close': 3, 'volume': 4, 'openinterest': 5, }
With the method btalib.config.set_input_indices(**kwargs)
, this configuration can be
changed and even name remapping is possible.
Changing at which columna index close
and low
are to be found
import btalib btalib.btalib.config.set_input_indices(close=8, low=1)
Remapping the names of open
and high
to column names present in the input
DataFrame
import btalib btalib.btalib.config.set_input_indices(open='harry', high='megan')
See the section Indicator Input for a complete description on how inputs are sought in the input.
btalib.config.get_input_indices()
Retrieve the dictionary being used for column name and indices matching
btalib.config.set_use_ohlc_indices_first(onoff=True)
This method deactivates using the keys of the dictionary above for name matching. Whatever is present in the values (numeric indices or alternative names will be used)
See the section Indicator Input for a complete description on how inputs are sought in the input.
Configuring Return Values
btalib.config.set_return_dataframe()
If this method is invoked, the result of invoking an indicator will be directly
returned as a pandas.DataFrame
instead as the internal representation object.
See the section "Data Input" for some examples.
Configuring ta-lib
compatibility
Hint
ta-lib
compatibility can be set for each indicator individually where
needed by passing the named argument: _talib=True
during instantiation
See the section: Compatiblity with ta-lib
btalib.config.set_talib_compat(onoff=True)
If the function is invoked with True
(or no arguments), the library will
automatically configure indicators where needed be to output ta-lib
compatible results.
btalib.config.get_talib_compat()
Return the current status of the global compatibility flag.