🌐
PyPI
pypi.org › project › stockstats
stockstats · PyPI
February 16, 2026 - DataFrame with inline stock statistics support.
      » pip install stockstats
    
Published   Feb 16, 2026
Version   0.6.8
🌐
GitHub
github.com › jealous › stockstats › blob › master › stockstats.py
stockstats/stockstats.py at master · jealous/stockstats
Supply a wrapper ``StockDataFrame`` based on the ``pandas.DataFrame`` with inline stock statistics/indicators support. - jealous/stockstats
Author   jealous
🌐
Pydigger
pydigger.com › pypi › stockstats
stockstats
# Stock Statistics/Indicators Calculation Helper [![build & test](https://github.com/jealous/stockstats/actions/workflows/build-test.yml/badge.svg)](https://github.com/jealous/stockstats/actions/workflows/build-test.yml) [![codecov](https://codecov.io/gh/jealous/stockstats/branch/master/graph/badge.svg?token=IFMD1pVJ7T)](https://codecov.io/gh/jealous/stockstats) [![pypi](https://img.shields.io/pypi/v/stockstats.svg)](https://pypi.python.org/pypi/stockstats) VERSION: 0.6.4 ## Introduction Supply a wrapper ``StockDataFrame`` for ``pandas.DataFrame`` with inline stock statistics/indicators support.
People also ask

What is stockstats?
DataFrame with inline stock statistics support. Visit Snyk Advisor to see a · full health score report · for stockstats, including popularity, security, maintenance · & community analysis.
🌐
snyk.io
snyk.io › advisor › python packages › stockstats
stockstats - Python Package Health Analysis | Snyk
Is stockstats popular?
The python package stockstats receives a total · of 3,585 weekly downloads. As · such, stockstats popularity was classified as · a · recognized. Visit the · popularity section · on Snyk Advisor to see the full health analysis.
🌐
snyk.io
snyk.io › advisor › python packages › stockstats
stockstats - Python Package Health Analysis | Snyk
Is stockstats safe to use?
While scanning the latest version of stockstats, we found · that a security review is needed. A total of · 0 vulnerabilities or license issues were · detected. See the full · security scan results.
🌐
snyk.io
snyk.io › advisor › python packages › stockstats
stockstats - Python Package Health Analysis | Snyk
🌐
PyPI
pypi.python.org › pypi › stockstats › 0.1.3
stockstats · PyPI
See examples below: .. code-block:: python # volume delta against previous day stock['volume_delta'] # open delta against next 2 day stock['open_2_d'] # open price change (in percent) between today and the day before yesterday # 'r' stands for rate. stock['open_-2_r'] # CR indicator, including 5, 10, 20 days moving average stock['cr'] stock['cr-ma1'] stock['cr-ma2'] stock['cr-ma3'] # volume max of three days ago, yesterday and two days later stock['volume_-3,2,-1_max'] # volume min between 3 days ago and tomorrow stock['volume_-3~1_min'] # KDJ, default to 9 days stock['kdjk'] stock['kdjd'] sto
Published   Aug 17, 2016
Version   0.1.3
🌐
O'Reilly
oreilly.com › library › view › matplotlib-2-x-by › 9781788295260 › ebde795f-f04f-44e9-92a2-c67db5dd0159.xhtml
Visualizing various stock market indicators - Matplotlib 2.x By Example [Book]
Stockstats (https://github.com... the fly when they are accessed. To use stockstats, we simply install it via PyPI: pip install stockstats....
🌐
PyPI
pypi.org › project › stockstats › 0.1.8
stockstats 0.1.8
JavaScript is disabled in your browser · Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
🌐
Libraries.io
libraries.io › pypi › stockstats
stockstats 0.6.5 on PyPI - Libraries.io - security & maintenance data for open source software
Homepage PyPI Python · Keywords · stock, statistics, indicator · License · BSD-3-Clause · Install · pip install stockstats==0.6.5 · VERSION: 0.6.5 · Supply a wrapper StockDataFrame for pandas.DataFrame with inline stock statistics/indicators support. Supported statistics/indicators are: delta ·
🌐
Snyk
snyk.io › advisor › python packages › stockstats
stockstats - Python Package Health Analysis | Snyk
Further analysis of the maintenance status of stockstats based on released PyPI versions cadence, the repository activity, and other data points determined that its maintenance is Healthy.
🌐
GitHub
github.com › saeed349 › Deep-Reinforcement-Learning-in-Trading › issues › 1
No module named 'stockstats' · Issue #1 · saeed349/Deep-Reinforcement-Learning-in-Trading
October 26, 2018 - No module named 'stockstats'#1 · Copy link · chongyang915 · opened · on Oct 26, 2018 · Issue body actions · if you miss this ? No one assigned · No labels · No labels · No projects · No milestone · None yet · No branches or pull requests ·
Author   chongyang915
Find elsewhere
🌐
PyPI
pypi-org.translate.goog › project › stockstats
stockstats · PyPI
pip install stockstats Copy PIP instructions · Latest version · Released: May 18, 2025 · DataFrame with inline stock statistics support. These details have been verified by PyPI · jealous · These details have not been verified by PyPI · Homepage · License: BSD License (BSD) Author: Cedric Zhuang ·
🌐
Maxieewong
maxieewong.com › Stockstats.html
Stockstats - Maxiee Blog
基于 pandas.DataFrame 封装出一个 StockDataFrame,包含了股票相关的统计、技术指标。 · 包含的技术指标如下:
🌐
PyPI
pypi.org › project › stockstats › 0.3.2
stockstats
October 17, 2020 - JavaScript is disabled in your browser · Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
🌐
GitHub
github.com › jealous › stockstats
GitHub - jealous/stockstats: Supply a wrapper ``StockDataFrame`` based on the ``pandas.DataFrame`` with inline stock statistics/indicators support.
pip install stockstats · Requires Python 3.9+. CI tests against Python 3.10, 3.11, 3.12, and 3.13. BSD-3-Clause License · StockDataFrame works as a wrapper for pandas.DataFrame. Initialize it with wrap or StockDataFrame.retype.
Starred by 1.4K users
Forked by 313 users
Languages   Python 100.0% | Python 100.0%
🌐
PyPI
pypi.org › project › stockstats › 0.2.0
stockstats 0.2.0
JavaScript is disabled in your browser. Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
🌐
Libraries.io
libraries.io › pypi › stockstats-polars
stockstats-polars 0.1.0 on PyPI - Libraries.io - security & maintenance data for open source software
November 9, 2025 - Homepage PyPI Python · License · MIT · Install · pip install stockstats-polars==0.1.0 · Namespace extension of Polars with stock statistics/indicator calculation helper · Polars implementation of the stockstats idea: compute technical indicators inline on your price (ohlcv) DataFrame with simple access.
🌐
PyPI
pypi.org › project › stock-dataframe
Client Challenge
JavaScript is disabled in your browser · Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
Top answer
1 of 1
4

MACD_EMA_SHORT is only a class method

  • you can't get it, unless you update the class
    • you need to return fast = df[ema_short]
  • MACD_EMA_SHORT is a parameter used for a calculation in _get_macd
    • MACD_EMA_SHORT = 12
    • ema_short = 'close_{}_ema'.format(cls.MACD_EMA_SHORT)
    • ema_short = 'close_12_ema'
class StockDataFrame(pd.DataFrame):
    OPERATORS = ['le', 'ge', 'lt', 'gt', 'eq', 'ne']

    # Start of options.
    KDJ_PARAM = (2.0 / 3.0, 1.0 / 3.0)
    KDJ_WINDOW = 9

    BOLL_PERIOD = 20
    BOLL_STD_TIMES = 2

    MACD_EMA_SHORT = 12
    MACD_EMA_LONG = 26
    MACD_EMA_SIGNAL = 9
    @classmethod
    def _get_macd(cls, df):
        """ Moving Average Convergence Divergence
        This function will initialize all following columns.
        MACD Line (macd): (12-day EMA - 26-day EMA)
        Signal Line (macds): 9-day EMA of MACD Line
        MACD Histogram (macdh): MACD Line - Signal Line
        :param df: data
        :return: None
        """
        ema_short = 'close_{}_ema'.format(cls.MACD_EMA_SHORT)
        ema_long = 'close_{}_ema'.format(cls.MACD_EMA_LONG)
        ema_signal = 'macd_{}_ema'.format(cls.MACD_EMA_SIGNAL)
        fast = df[ema_short]
        slow = df[ema_long]
        df['macd'] = fast - slow
        df['macds'] = df[ema_signal]
        df['macdh'] = (df['macd'] - df['macds'])
        log.critical("NOTE: Behavior of MACDH calculation has changed as of "
                     "July 2017 - it is now 1/2 of previous calculated values")
        cls._drop_columns(df, [ema_short, ema_long, ema_signal])

Update:

  • find stockstats.py, then in def _get_macd(cls, df), comment out cls._drop_columns(df, [ema_short, ema_long, ema_signal]) (e.g. put # in front of it)
  • Then you can do stock['close_12_ema']

Code to get the table:

periods = '3600'
resp = requests.get('https://api.cryptowat.ch/markets/poloniex/ethusdt/ohlc', params={'periods': periods})
data = resp.json()
df = pd.DataFrame(data['result'][periods], columns=['date', 'open', 'high', 'low', 'close', 'volume', 'amount'])
df['date'] = pd.to_datetime(df['date'], unit='s')

stock = sdf.retype(df)
print(stock['macds'])

print(stock)
  • The extra columns don't get added until you do stock['macds'].

OUtput:

                           open        high         low       close      volume        amount  close_12_ema  close_26_ema      macd  macd_9_ema     macds     macdh
date                                                                                                                                                               
2019-08-20 00:00:00  201.000000  203.379326  201.000000  202.138224  349.209128  70720.937575    202.138224    202.138224  0.000000    0.000000  0.000000  0.000000
2019-08-20 01:00:00  202.187160  202.650000  200.701061  200.778709  329.485014  66411.899720    201.401820    201.432322 -0.030502   -0.016946 -0.016946 -0.013556
2019-08-20 02:00:00  201.200000  201.558777  200.133667  200.338312   12.812929   2572.209909    200.986733    201.039255 -0.052522   -0.031526 -0.031526 -0.020996
2019-08-20 03:00:00  200.915590  201.177018  200.396571  200.440000   21.910910   4395.692727    200.814151    200.871730 -0.057579   -0.040352 -0.040352 -0.017227
2019-08-20 04:00:00  200.979999  200.979999  198.282603  198.644618  360.432424  71712.376256    200.224696    200.355253 -0.130557   -0.067186 -0.067186 -0.063371
🌐
GitHub
github.com › royopa › stockstats
GitHub - royopa/stockstats: Supply a wrapper ``StockDataFrame`` based on the ``pandas.DataFrame`` with inline stock statistics/indicators support.
pip install stockstats · Please check the setup.py file. Note that pandas add some type check after version 1.0. One type assert is skipped in StockDataFrame. Check ISSUE-50 for detail. BSD · Initialize the StockDataFrame with the retype function which convert a pandas.DataFrame to a StockDataFrame.
Author   royopa
🌐
GitHub
github.com › zachwill › stockstats
GitHub - zachwill/stockstats: Supply a wrapper ``StockDataFrame`` based on the ``pandas.DataFrame`` with inline stock statistics/indicators support. · GitHub
pip install stockstats · BSD · Initialize the StockDataFrame with the retype function which convert a pandas.DataFrame to a StockDataFrame. stock = StockDataFrame.retype(pd.read_csv('stock.csv')) There are some shortcuts for frequent used statistics/indicators like kdjk, boll_hb, macd, etc.
Author   zachwill
🌐
Medium
medium.com › codex › this-python-library-will-help-you-get-stock-technical-indicators-in-one-line-of-code-c11ed2c8e45f
This Python library will help you get Stock technical indicators in one line of code | by Nikhil Adithyan | CodeX | Medium
June 20, 2022 - I started following my conventional ... library. Behold, Stockstats. It is a wrapper for Pandas dataframes and offers data ranging from basic stock information to advanced technical indicators....