Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ jobs:
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Run tests
run: |
python -m pytest -q
31 changes: 31 additions & 0 deletions tests/test_indicador.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import math
from indicador import fibonacci, puntocurvaexponencial, curvexprent, MME


def test_fibonacci_basic():
assert fibonacci(8) == [1, 1, 2, 3, 5, 8, 13]


def test_puntocurvaexponencial_example():
res = puntocurvaexponencial(
'2008-01-25', 48.260, '2008-04-18', 76.958, 'w', fechahoy='2008-05-02'
)
assert math.isclose(res, 83.182, rel_tol=1e-3)


def test_curvexprent_basic():
res = curvexprent('2010-01-01', 10.0, '2011-01-01', 11.0)
assert math.isclose(res, 0.1, rel_tol=1e-3)


def test_mme_length_and_values():
datos = [
('2020-01-01', 1, 1, 1, 1, 1),
('2020-01-02', 2, 2, 2, 2, 2),
('2020-01-03', 3, 3, 3, 3, 3),
('2020-01-04', 4, 4, 4, 4, 4),
]
res = MME(datos, MME=3)
assert len(res) == len(datos)
assert res[0][1] == 1
assert math.isclose(res[-1][1], 3.125, rel_tol=1e-3)
2 changes: 1 addition & 1 deletion yahoofinance.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ def descargaHistoricoAccion2(naccion, **config):
o que la url no es valida 'URL invalida'
"""

global _cookie, webheaders #, _crumb


naccion = naccion.upper()
fechaini = config.get('fechaini', None)
Expand Down