Skip to content

Commit e06c193

Browse files
committed
Add gitignore
1 parent 25aba77 commit e06c193

16 files changed

+2891
-1
lines changed

.gitignore

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# Created by .ignore support plugin (hsz.mobi)
2+
### Python template
3+
# Byte-compiled / optimized / DLL files
4+
__pycache__/
5+
*__pycache__/
6+
*.py[cod]
7+
*$py.class
8+
.DS_Store
9+
10+
# C extensions
11+
*.so
12+
13+
# Distribution / packaging
14+
.Python
15+
build/
16+
develop-eggs/
17+
dist/
18+
downloads/
19+
eggs/
20+
.eggs/
21+
lib/
22+
lib64/
23+
parts/
24+
sdist/
25+
var/
26+
wheels/
27+
pip-wheel-metadata/
28+
share/python-wheels/
29+
*.egg-info/
30+
.installed.cfg
31+
*.egg
32+
MANIFEST
33+
34+
# PyInstaller
35+
# Usually these files are written by a python script from a template
36+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
37+
*.manifest
38+
*.spec
39+
40+
# Installer logs
41+
pip-log.txt
42+
pip-delete-this-directory.txt
43+
44+
# Unit test / coverage reports
45+
htmlcov/
46+
.tox/
47+
.nox/
48+
.coverage
49+
.coverage.*
50+
.cache
51+
nosetests.xml
52+
coverage.xml
53+
*.cover
54+
.hypothesis/
55+
.pytest_cache/
56+
57+
# Translations
58+
*.mo
59+
*.pot
60+
61+
# Django stuff:
62+
*.log
63+
local_settings
64+
db.sqlite3
65+
66+
# Flask stuff:
67+
instance/
68+
.webassets-cache
69+
70+
# Scrapy stuff:
71+
.scrapy
72+
73+
# Sphinx documentation
74+
docs/_build/
75+
76+
# PyBuilder
77+
target/
78+
79+
# Jupyter Notebook
80+
.ipynb_checkpoints
81+
82+
# IPython
83+
profile_default/
84+
ipython_config.py
85+
86+
# pyenv
87+
.python-version
88+
89+
# pipenv
90+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
91+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
92+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
93+
# install all needed dependencies.
94+
#Pipfile.lock
95+
96+
# celery beat schedule file
97+
celerybeat-schedule
98+
99+
# SageMath parsed files
100+
*.sage.py
101+
102+
# Environments
103+
.env
104+
.venv
105+
env/
106+
venv/
107+
ENV/
108+
env.bak/
109+
venv.bak/
110+
111+
# Spyder project settings
112+
.spyderproject
113+
.spyproject
114+
115+
# Rope project settings
116+
.ropeproject
117+
118+
# mkdocs documentation
119+
/site
120+
121+
# mypy
122+
.mypy_cache/
123+
.dmypy.json
124+
dmypy.json
125+
126+
# Pyre type checker
127+
.pyre/
128+
129+
# Custom
130+
config.json
131+
bot_configuration.db
132+
*.db
133+
.idea
134+
*log*
135+
136+
!plugins/strategies/
137+
plugins/strategies/*.py
138+
!plugins/data_providers/
139+
plugins/data_providers/*.py
140+
141+
.tox
142+
_test_run/
143+
bin/
144+
include/
145+
lib/
146+
.Python
147+
bumpversion.egg-info/
148+
*.sqlite3
149+
150+
**/backtest_data/*
151+
*/backtest_reports/
152+
**/backtest_reports/*
153+
.vscode/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ PyIndicators is a powerful and user-friendly Python library for technical analys
55
## Features
66

77
* Native Python implementation
8-
* Supports both pandas dataframes and polars dataframes
8+
* Dataframe first approach, with support for both pandas dataframes and polars dataframes
99

1010
## Indicators
1111

poetry.lock

Lines changed: 179 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyindicators/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from .indicators import sma, rsi, crossover, crossunder, ema
2+
3+
__all__ = [
4+
'sma',
5+
'crossover',
6+
'crossunder',
7+
'ema',
8+
'rsi',
9+
]

pyindicators/exceptions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class PyIndicatorException(Exception):
2+
"""Base class for exceptions in this module."""
3+
pass
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from .simple_moving_average import sma
2+
from .crossover import crossover
3+
from .crossunder import crossunder
4+
from .exponential_moving_average import ema
5+
from .rsi import rsi
6+
7+
__all__ = [
8+
'sma',
9+
'crossover',
10+
'crossunder',
11+
'ema',
12+
'rsi',
13+
]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import pandas as pd
2+
3+
4+
def crossover(series_a: pd.Series, series_b: pd.Series):
5+
"""
6+
Returns a boolean series indicating if series_a has crossed over series_b
7+
"""
8+
return (series_a > series_b).astype(int).diff().astype('Int64') == 1
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import pandas as pd
2+
3+
4+
def crossunder(series_a: pd.Series, series_b: pd.Series):
5+
"""
6+
Returns a boolean series indicating if series_a has crossed over series_b
7+
"""
8+
return (series_a > series_b).astype(int).diff().astype('Int64') == 1
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import pandas as pd
2+
3+
4+
def ema(series: pd.Series, period, adjust=False):
5+
return series.ewm(span=period, adjust=adjust).mean()
6+
7+

0 commit comments

Comments
 (0)