hadif1999
pycoin
Python

a lovable data analysis and algorithmic trading library for cryptocurrencies

Last updated Dec 3, 2025
10
Stars
1
Forks
0
Issues
0
Stars/day
Attention Score
0
Language breakdown
No language data available.
Files click to expand
README

pycoin

Pycoin

a lovable data analysis and algorithmic trading library for cryptocurrencies :moneybag:

including tools for deploying any strategy including pattern based strategies, Price Action strategies, Indicator based strategies and also Machine learning based strategies. able to run multi strategy instances on a single bot as a webapp and a lot more...

what can this package do:

  • [x] download market historical data for all symbols from almost all exchanges thanks to ccxt :chartwithupwardstrend:
  • [x] visualizing capabilities to easily analyze market using plotly :chartwithdownwardstrend:
  • [x] able to perform some useful analysis such as finding market trend according to market past high and lows, finding market important levels (like support and resistance) and more :bar_chart:
  • [ ] able to define your strategy, backtest it, run it in dry run mode and also in real mode :mag: (soon)
  • [ ] using telegram bot and webapp to control and monitor your bot :robot: (soon)
  • [ ] run multiple strategy instances for each user as a single bot. (soon)
>[!NOTE] >for usage examples please checkout examples folder and open provided notebooks and run each cell.

Installation

>[!NOTE]

for installation on Google Colab notebook please refer to installation on google colab section

via cloning (recommended)

pip install -e git+https://github.com/hadif1999/pycoin.git#egg="pythoncoin"
if you need extra dependencies such as ploting or AI packages add [extra](name of extra dependency that will be mentioned below) to end of "pythoncoin" (keep using quotes)

example of installing plotting and jupyter dependencies:

pip install -e git+https://github.com/hadif1999/pycoin.git#egg="pythoncoin[jupyter,plot]"
please be careful not to use spaces between extra packages list

available extra packages:

  • plot: installs packages related to plotting.
  • jupyter: installs packages related to using in jupyter notebook.
  • ai: installs packages related to using AI features.
  • hdf5: installs packages related to big data features.
  • all: installs all available dependencies.

installing from PyPI

installation with standard dependencies

!pip install "pythoncoin"

installation with extra dependencies

!pip install "pythoncoin[plot]"
as mentioned earlier you can also use ai, plot, jupyter, hdf5 or all to install needed extra dependencies.

installation on Google Colab

before using above installation methods on Google Colab first you have to install ta-lib properly using conda, you use a conda alternative for colab like condacolab.
!pip install -q condacolab
import condacolab
condacolab.install()
!conda install -c conda-forge ta-lib
then you can use one of the installation methods that mentioned earlier to install pycoin. for example:
!pip install "pythoncoin[plot]"
finally you can verify installation by running:
import pycoin
restart the runtime if colab asked for it.

Quick start

after installation you can run below code to download market historical data:

from pycoin.datagathering import KlineDataFetcher
import datetime as dt

df = KlineData_Fetcher(symbol="BTC/USDT", timeframe="4h", data_exchange="binance", since = dt.datetime(2020, 1, 1) )

ploting the candlestick data

from pycoin.plotting import Market_Plotter

plots = MarketPlotter(OHLCVdf=df)

if plotbygrp is False then it will plot the whole candlestick data

figure = plots.plot_market()

if plotbygrp is True you can plot candlestick data by group and plot a specific year, month,etc.

figure = plots.plotmarket(plotby_grp=True, grp={"year":2023, "month":2}) figure.show()

alt text

evaluating market high & lows

from pycoin.datagathering import getmarketHighLows
df = getmarketHighLows(df, candlerange = 100)
df
candle_range : range of candles to look for high and lows alt text

ploting market high and lows

plots.plothighlows(df, R = 800, y_scale= 0.5)
alt text

the method above puts a circle for each high and low. R is the radius and y_scale can scale the price in y axis for better visualizing.

evaluate market trend with high and lows

every trend that is found with any method such as high & lows, SMA,etc. adds a new column that holds the trend label for each row of data, and when you want to plot these trend you should give this column name to drawtrendhighlight method.
# finding trend 
from pycoin.datagathering import TrendEvaluator
df = TrendEvaluator.evaltrendwithhighlows(df, HighLowrange=100)

ploting trend

plots.drawtrendhighlight("highlowtrend", df, addhighlows_shapes = True, R = 10000, # circle size of high and lows y_scale = 0.1 # scales y dim of circles )
alt text

evaluate trend using MACD + Signal

df = TrendEvaluator.evaltrendwithMACD(df, dropMACDcol = True)
plots.drawtrendhighlight("MACD_trend", df)
alt text
🔗 More in this category

© 2026 GitRepoTrend · hadif1999/pycoin · Updated daily from GitHub