Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #8 #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 6 additions & 6 deletions trendet/identification.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def identify_trends(stock, country, from_date, to_date, window_size=5, trend_lim

for down in results['Down Trend']:
if down['from'] < up['from'] < down['to'] or down['from'] < up['to'] < down['to']:
if (up['to'] - up['from']).days > (down['to'] - down['from']).days:
if (up['to'] - up['from']) > (down['to'] - down['from']):
flag = True
else:
flag = False
Expand All @@ -204,7 +204,7 @@ def identify_trends(stock, country, from_date, to_date, window_size=5, trend_lim

for up in results['Up Trend']:
if up['from'] < down['from'] < up['to'] or up['from'] < down['to'] < up['to']:
if (up['to'] - up['from']).days < (down['to'] - down['from']).days:
if (up['to'] - up['from']) < (down['to'] - down['from']):
flag = True
else:
flag = False
Expand Down Expand Up @@ -400,7 +400,7 @@ def identify_all_trends(stock, country, from_date, to_date, window_size=5, ident

for down in results['Down Trend']:
if down['from'] < up['from'] < down['to'] or down['from'] < up['to'] < down['to']:
if (up['to'] - up['from']).days > (down['to'] - down['from']).days:
if (up['to'] - up['from']) > (down['to'] - down['from']):
flag = True
else:
flag = False
Expand All @@ -423,7 +423,7 @@ def identify_all_trends(stock, country, from_date, to_date, window_size=5, ident

for up in results['Up Trend']:
if up['from'] < down['from'] < up['to'] or up['from'] < down['to'] < up['to']:
if (up['to'] - up['from']).days < (down['to'] - down['from']).days:
if (up['to'] - up['from']) < (down['to'] - down['from']):
flag = True
else:
flag = False
Expand Down Expand Up @@ -586,7 +586,7 @@ def identify_df_trends(df, column, window_size=5, identify='both'):

for down in results['Down Trend']:
if down['from'] < up['from'] < down['to'] or down['from'] < up['to'] < down['to']:
if (up['to'] - up['from']).days > (down['to'] - down['from']).days:
if (up['to'] - up['from']) > (down['to'] - down['from']):
flag = True
else:
flag = False
Expand All @@ -609,7 +609,7 @@ def identify_df_trends(df, column, window_size=5, identify='both'):

for up in results['Up Trend']:
if up['from'] < down['from'] < up['to'] or up['from'] < down['to'] < up['to']:
if (up['to'] - up['from']).days < (down['to'] - down['from']).days:
if (up['to'] - up['from']) < (down['to'] - down['from']):
flag = True
else:
flag = False
Expand Down