Skip to content

Commit

Permalink
Now uses the complete set of factors in the composite value. Takes 80…
Browse files Browse the repository at this point in the history
… highest and then sort on momentum.
  • Loading branch information
quant@alpacka committed Aug 28, 2023
1 parent ad79b50 commit 32ff5d4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions value.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def clean_data(df):
dtype='object')
"""
def create_ranking(df):
rankings = { 'P/E - Senaste': -1, 'P/FCF - Senaste': -1, 'P/S - Senaste': -1, 'Direktav. - Senaste': 1 }
rankings = { 'P/E - Senaste': -1, 'P/FCF - Senaste': -1, 'EV/EBITDA - Senaste': -1, 'P/S - Senaste': -1, 'Direktav. - Senaste': 1 }
ratio_scores = pd.DataFrame()
for column, rank in rankings.items():
ratio_scores[column] = df[column].rank(ascending=rank)
Expand All @@ -111,7 +111,8 @@ def calc_composite_value(df):
df_clean['comp_value'] = calc_composite_value(ranking)
df_clean['momentum'] = calc_momentum(df_clean)

a = df_clean.sort_values('comp_value', ascending=True)
a = df_clean.sort_values('comp_value', ascending=False)

print(a.head(10))
print(a.tail(10))
result = a.head(80).sort_values('momentum', ascending=False)

print(result.head(15))

0 comments on commit 32ff5d4

Please sign in to comment.