Python talib.AVGPRICE Examples
The following are 5
code examples of talib.AVGPRICE().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
talib
, or try the search function
.
Example #1
Source File: avgprice.py From jesse with MIT License | 6 votes |
def avgprice(candles: np.ndarray, sequential=False) -> Union[float, np.ndarray]: """ AVGPRICE - Average Price :param candles: np.ndarray :param sequential: bool - default=False :return: float | np.ndarray """ if not sequential and len(candles) > 240: candles = candles[-240:] res = talib.AVGPRICE(candles[:, 1], candles[:, 3], candles[:, 4], candles[:, 2]) if sequential: return res else: return None if np.isnan(res[-1]) else res[-1]
Example #2
Source File: talib_indicators.py From QUANTAXIS with MIT License | 5 votes |
def AVGPRICE(DataFrame): res = talib.AVGPRICE(DataFrame.open.values, DataFrame.high.values, DataFrame.low.values, DataFrame.close.values) return pd.DataFrame({'AVGPRICE': res}, index=DataFrame.index)
Example #3
Source File: ta_indicator_mixin.py From strategy with Apache License 2.0 | 5 votes |
def avg_price(self, sym, frequency): if not self.kbars_ready(sym, frequency): return [] opens = self.open(sym, frequency) highs = self.high(sym, frequency) lows = self.low(sym, frequency) closes = self.close(sym, frequency) v = ta.AVGPRICE(opens, highs, lows, closes) return v
Example #4
Source File: talib_wrapper.py From tia with BSD 3-Clause "New" or "Revised" License | 5 votes |
def AVGPRICE(frame, open_col='PX_OPEN', high_col='high', low_col='low', close_col='close'): return _frame_to_series(frame, [open_col, high_col, low_col, close_col], talib.AVGPRICE)
Example #5
Source File: talib_indicators.py From qtpylib with Apache License 2.0 | 5 votes |
def AVGPRICE(data, **kwargs): _check_talib_presence() popen, phigh, plow, pclose, _ = _extract_ohlc(data) return talib.AVGPRICE(popen, phigh, plow, pclose, **kwargs)