In [1]:
cd /tmp


/tmp

In [2]:
from finta import TA
import pandas as pd

In [3]:
ohlc = pd.read_csv("HistoricalQuotes.csv", index_col="Date", parse_dates=True)

In [4]:
ohlc.columns = ['close', 'volume', 'open', 'high', 'low']

In [5]:
def split(dollar: str) -> float:
    return float(dollar.split("$")[1])

ohlc["close"] = ohlc["close"].apply(split)

ohlc["low"] = ohlc["low"].apply(split)

ohlc["high"] = ohlc["high"].apply(split)

ohlc["open"] = ohlc["open"].apply(split)

In [6]:
TA.RSI(ohlc).tail(10)


Out[6]:
Date
2014-12-26    55.099394
2014-12-24    43.666451
2014-12-23    50.085415
2014-12-22    50.594291
2014-12-19    38.730709
2014-12-18    35.584319
2014-12-17    38.632773
2014-12-16    32.701255
2014-12-15    55.449033
2014-12-12    57.338081
Name: RSI, dtype: float64

In [7]:
from finta.utils import resample_calendar
weekly_ohlc = resample_calendar(ohlc, "7d")

In [8]:
TA.EMA(weekly_ohlc, 5).tail(10)


Out[8]:
Date
2019-10-04    1756.299843
2019-10-11    1766.693228
2019-10-18    1771.388819
2019-10-25    1773.145879
2019-11-01    1778.163920
2019-11-08    1770.309280
2019-11-15    1758.442853
2019-11-22    1778.465235
2019-11-29    1765.803490
2019-12-06    1760.108994
Freq: W-FRI, Name: 5 period EMA, dtype: float64

In [ ]: