Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
streaming-indicators
Advanced tools
A python library for computing technical analysis indicators on streaming data.
A python library for computing technical analysis indicators on streaming data.
pip install streaming-indicators
There are many other technical analysis python packages, most notably ta-lib, then why another library?
All 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.
Each indicator is a class, and is statefull. It will have 3 main functions:
import streaming_indicators as si
period = 14
SMA = si.SMA(period)
for idx, candle in candles.iterrows():
sma = SMA.update(candle['close'])
print(sma)
period = 14
EMA = si.EMA(period)
for idx, candle in candles.iterrows():
ema = EMA.update(candle['close'])
print(ema)
period = 14
RSI = si.RSI(period)
for idx, candle in candles.iterrows():
rsi = RSI.update(candle['close'])
print(rsi)
atr_period = 20
ATR = si.ATR(atr_period)
for idx, candle in candles.iterrows():
atr = ATR.update(candle) # Assumes candle to have 'open',high','low','close' - TODO: give multiple inputs to update.
print(atr)
st_atr_length = 10
st_factor = 3
ST = si.SuperTrend(st_atr_length, st_factor)
for idx, candle in candles.iterrows():
st = ST.update(candle)
print(st) # (st_direction:1/-1, band_value)
To 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.
HA = si.HeikinAshi()
for idx, candle in candles.iterrows():
ha_candle = HA.update(candle)
print(ha_candle) # {'close': float, 'open': float, 'high': float, 'low': float}
# For fixed brick size
brick_size = 20
Renko = si.Renko()
for idx, candle in candles.iterrows():
bricks = Renko.update(candle['close'], brick_size)
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
# For brick size using ATR
atr_period = 20
ATR = si.ATR(atr_period)
Renko = si.Renko()
for idx, candle in candles.iterrows():
atr = ATR.update(candle)
print(atr)
bricks = Renko.update(candle['close'], atr)
print(bricks)
period = 10
all_increasing = si.IsOrder('>', period)
for idx, candle in candles.iterrows():
is_increasing = all_increasing.update(candle['close'])
print(is_increasing) # True/False
HalfTrend
)trend = 0
for uptrend and 1
for downtrend.HT = si.HalfTrend(amplitude=2, channel_deviation=2, atr_period=100)
for idx, candle in candles.iterrows():
trend, half_trend, up, down, atr_high, atr_low = HT.update(candle)
CWA2Sigma
)CWA2Sigma = si.CWA2Sigma(bb_period=50, bb_width=2, ema_period=100, atr_period=14, atr_factor=1.8, sl_perc=20)
for idx, candle in candles.iterrows():
cwa_signal,cwa_entry_price = CWA2Sigma.update(candle)
If you find this repo useful, do consider giving a star. Contributions are most welcome. MIT License
Copyright (c) [2023] [Rishabh Gupta]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
A python library for computing technical analysis indicators on streaming data.
We found that streaming-indicators demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.