tr8dr / tseries-patterns

trend / momentum and other patterns in financial timeseries
MIT License
229 stars 70 forks source link

No such file or directory: 'requirements.txt' #1

Closed livinglife2x closed 3 years ago

livinglife2x commented 4 years ago

I tried to install tseries_patterns with pip install tseries_patterns. Looks like requirements.txt is missing in the sdist.

tr8dr commented 4 years ago

I checked both the zip and tar.gz source distributions. Both contain requirements.txt. I was also able to install the package using pip. I am not able to replicate your problem. Could it be that you are having a problem installing one of the dependencies? Try installing from github.

tsferro2 commented 3 years ago

I also had this issue but was able to install per tr8dr's suggesting using:

pip install git+https://github.com/tr8dr/tseries-patterns that said, I am having an issue trying to use data pulled from yahoo:

import yfinance as yf
from tseries_patterns import AmplitudeBasedLabeler

# download data
ticker = 'VTI'

df = yf.download(ticker, start="2000-01-01")
df = df.reset_index()
df = df.iloc[:,:-2]
df.columns = [['stamp','open','high','low','close']]

labeler = AmplitudeBasedLabeler(minamp = 10, Tinactive = 10)
labels = labeler.label(df)
labeler.plot()

this throws the error:

TypeError: only integer scalar arrays can be converted to a scalar index

any suggestions?

tr8dr commented 3 years ago

Hi, there is a bug in your code. When you renamed the columns you indicated a list of lists, should just be a list. Also given that this is for equities and on daily data, your minimum amplitude target should be at least 5% (or 500 bps). The inactive time should also be longer to carry through trends (say 300).

import yfinance as yf
from tseries_patterns import AmplitudeBasedLabeler

# download data
ticker = 'VTI'

df = yf.download(ticker, start="2013-01-01")
df = df.reset_index()
df = df.iloc[:,:-2]
df.columns = ['stamp','open','high','low','close']

labeler = AmplitudeBasedLabeler(minamp = 500, Tinactive = 300)
labels = labeler.label(df)
labeler.plot()

I am also adjusting the code so you do not need to rename the columns. Will check that in shortly.

tsferro2 commented 3 years ago

thanks for the updated code - for some reason when I run it, the last line:

labeler.plot()

throws:

TypeError: groupby() got an unexpected keyword argument 'dropna'

tr8dr commented 3 years ago

Can you forward the error stack trace. I do not have any dropna's in the codebase. Perhaps it is in a library this depends on. Are you using a conda installation and which version? Perhaps some libraries are old (or alternatively bleeding edge).

tsferro2 commented 3 years ago

just emailed you the error stack trace (sorry not sure what you meant specifically by forward in this case) as well as a list of all conda packages in the environment

tr8dr commented 3 years ago

Based on the stack trace you sent, it looks like the conda installation you are running is using an older pandas library. If you look at the documentation: [https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.groupby.html](pandas groupby), it supports the dropna argument. However that support was added in pandas 1.1.0 release in July. Pandas is currently on 1.1.3.

tr8dr commented 3 years ago

The plotnine library (which would not have come with conda) is expecting a recent installation of pandas. Perhaps you can try updating numpy and pandas to the current version.

tsferro2 commented 3 years ago

success!! I updated both numpy and pandas and everything is working now - thanks vm for your help in sorting this for me