{"id":13739783,"url":"https://github.com/mr-easy/streaming_indicators","last_synced_at":"2025-08-31T10:08:09.288Z","repository":{"id":164476178,"uuid":"639918696","full_name":"mr-easy/streaming_indicators","owner":"mr-easy","description":"A python library for computing technical analysis indicators on streaming data.","archived":false,"fork":false,"pushed_at":"2025-04-27T13:35:37.000Z","size":41,"stargazers_count":127,"open_issues_count":0,"forks_count":18,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-08-20T14:18:24.067Z","etag":null,"topics":["algotrading","cwa2sigma","halftrend","heikin-ashi","indicator","indicators","quantitative-finance","renko","supertrend","technical-analysis","trading","vwap"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/streaming-indicators/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mr-easy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-05-12T14:21:22.000Z","updated_at":"2025-08-14T09:28:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"1703a008-6229-412f-96fa-b746b1bc8d2b","html_url":"https://github.com/mr-easy/streaming_indicators","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/mr-easy/streaming_indicators","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mr-easy%2Fstreaming_indicators","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mr-easy%2Fstreaming_indicators/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mr-easy%2Fstreaming_indicators/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mr-easy%2Fstreaming_indicators/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mr-easy","download_url":"https://codeload.github.com/mr-easy/streaming_indicators/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mr-easy%2Fstreaming_indicators/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272966117,"owners_count":25023214,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algotrading","cwa2sigma","halftrend","heikin-ashi","indicator","indicators","quantitative-finance","renko","supertrend","technical-analysis","trading","vwap"],"created_at":"2024-08-03T04:00:37.590Z","updated_at":"2025-08-31T10:08:09.256Z","avatar_url":"https://github.com/mr-easy.png","language":"Python","readme":"# Streaming Indicators \n\nA python library for computing technical analysis indicators on streaming data.\n\n## Installation\n```\npip install streaming-indicators\n```\n## Why another TA library?\nThere are many other technical analysis python packages, most notably ta-lib, then why another library?  \nAll other libraries work on static data, you can not add values to any indicator. But in real-time trading system, price values (ticks/candles) keeps streaming, and indicators should update on real-time. This library is for that purpose.\n\n## Usage\nEach indicator is a class, and is statefull. It will have 3 main functions:\n1. Constructor: initialise all parameters such as period.\n2. update: To add new data point in the indicator computation. Returns the new value of the indicator.\n3. compute: Compute indicator value with a new data point, but don't update it's state. This is useful in some cases, for example, compute indictor on ltp, but don't update it.\n\n## List of indicators (and usage)\n- Simple Moving Average (SMA)  \n```\nimport streaming_indicators as si\n\nperiod = 14\nSMA = si.SMA(period)\nfor idx, candle in candles.iterrows():\n    sma = SMA.update(candle['close'])\n    print(sma)\n```\n- Exponential Moving Average (EMA)  \n```\nperiod = 14\nEMA = si.EMA(period)\nfor idx, candle in candles.iterrows():\n    ema = EMA.update(candle['close'])\n    print(ema)\n```\n- Weighted Moving Average (WMA)  \n- Smoothed Moving Average (SMMA)  \n- RMA (RMA)   \nRMA is used in trading view in many indicators including `RSI`. [Ref](https://www.tradingview.com/pine-script-reference/v6/#fun_ta.rma)\n- Volume Weighted Average Price (VWAP)  \nComputes VWAP using hlc3 and volume, anchors at first candle.\n```\nVWAP = si.VWAP()\nfor idx, candle in candles.iterrows():\n    vwap = VWAP.update(candle)\n    print(vwap)\n```\n- Relative Strength Index (RSI)  \n```\nperiod = 14\nRSI = si.RSI(period)\nfor idx, candle in candles.iterrows():\n    rsi = RSI.update(candle['close'])\n    print(rsi)\n```\n- Central Pivot Range (CPR)  \n- True Range (TRANGE)  \n- Average True Range (ATR)  \n```\natr_period = 20\nATR = si.ATR(atr_period)\nfor idx, candle in candles.iterrows():\n    atr = ATR.update(candle)  # Assumes candle to have 'open',high','low','close' - TODO: give multiple inputs to update.\n    print(atr)\n```\n- Bollinger Bands (BBands)  \n- SuperTrend (SuperTrend)   \n```\nst_atr_length = 10\nst_factor = 3\nST = si.SuperTrend(st_atr_length, st_factor)\nfor idx, candle in candles.iterrows():\n    st = ST.update(candle)\n    print(st) # (st_direction:1/-1, band_value)\n```\nTo use some historical candles to initiate, use: `ST = si.SuperTrend(st_atr_length, st_factor, candles=initial_candles)` where `initial_candles` is pandas dataframe with `open,high,low,close` columns, and requires talib package.\n- Heikin Ashi Candlesticks (HeikinAshi)  \n```\nHA = si.HeikinAshi()\nfor idx, candle in candles.iterrows():\n    ha_candle = HA.update(candle)\n    print(ha_candle) # {'close': float, 'open': float, 'high': float, 'low': float}\n```\n- Renko Bricks (Renko)  \n```\n# For fixed brick size\nbrick_size = 20\nRenko = si.Renko()\nfor idx, candle in candles.iterrows():\n    bricks = Renko.update(candle['close'], brick_size)\n    print(bricks) # [{'direction': 1/-1, 'brick_num': int, 'wick_size': float, 'brick_size': float, 'brick_end_price': float, 'price': float}, {}]: list of bricks formed after this candle\n```\n```\n# For brick size using ATR\natr_period = 20\nATR = si.ATR(atr_period)\nRenko = si.Renko()\nfor idx, candle in candles.iterrows():\n    atr = ATR.update(candle)\n    print(atr)\n    bricks = Renko.update(candle['close'], atr)\n    print(bricks)\n```\n- Order Checking (IsOrder)  \nChecks if the running sequence is in a given order, eg increasing, decreasing, exponential, etc. Useful when checking if consecutive n candles/ltps were increasing.\n```\nperiod = 10\nall_increasing = si.IsOrder('\u003e', period)\nfor idx, candle in candles.iterrows():\n    is_increasing = all_increasing.update(candle['close'])\n    print(is_increasing) # True/False\n```\n- HalfTrend (`HalfTrend`)  \nHalfTrend indicator by Alex Orekhov (everget) in tradingview. Refered it's pine script. `trend = 0` for uptrend and `1` for downtrend.\n```\nHT = si.HalfTrend(amplitude=2, channel_deviation=2, atr_period=100)\nfor idx, candle in candles.iterrows():\n    trend, half_trend, up, down, atr_high, atr_low = HT.update(candle)\n```\n- Directional Moving Index (`PLUS_DI` and `MINUS_DI`)  \n- CWA 2-Sigma (`CWA2Sigma`)  \nAs discussed by Mr Rakesh Pujara in his [interview](https://www.youtube.com/watch?v=tSlfPgaWIu4).\n```\nCWA2Sigma = si.CWA2Sigma(bb_period=50, bb_width=2, ema_period=100, atr_period=14, atr_factor=1.8, sl_perc=20)\nfor idx, candle in candles.iterrows():\n    cwa_signal,cwa_entry_price = CWA2Sigma.update(candle)\n```\n\n## Changelogs and TODOs\n- [Version History](version_history.md)\n- [TODOs](TODO.md)\n\nIf you find this repo useful, do consider giving a star. Contributions are most welcome.","funding_links":[],"categories":["Python"],"sub_categories":["Indicators","技术指标"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmr-easy%2Fstreaming_indicators","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmr-easy%2Fstreaming_indicators","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmr-easy%2Fstreaming_indicators/lists"}