Created
June 14, 2020 00:28
-
-
Save MauricioLetelier/81aa8b69f7a12d0ec34e89564613d1cc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Results=pd.DataFrame([]) | |
sns.set(font_scale=1.2) | |
for i in matrix: | |
results1=pd.read_csv('Results'+str(i)+'.csv') | |
Positive_Fees=(i[0]+100)*0.00075+100*0.00075 | |
Negative_Fees=(i[1]+100)*0.00075+100*0.00075 | |
No_Outcome_Fees=200*0.00075 | |
results1['Return']=(i[0]-Positive_Fees)*results1['Success rate']*results1['Quantity']+(i[1]-Positive_Fees)*(results1['Quantity']-results1['Success rate']*results1['Quantity'])+((i[0]+i[1])/7-No_Outcome_Fees)*results1['Quantity']*results1['no_outcome'] | |
results1['Combination']=str(i[0])+', '+str(i[1]) | |
results1.drop(results1.columns[0],inplace=True,axis=1) | |
Results=Results.append(results1,ignore_index=True) | |
selected_lines=Results.sort_values(by='Return',ascending=False)['Combination'].unique()[0:5] | |
from celluloid import Camera | |
camera = Camera(plt.figure(figsize=(11,7))) | |
plt.title('Models Return') | |
plt.xlabel('Models Return') | |
plt.ylabel('Models Return') | |
for i in range(75): | |
print(i) | |
line=Results[(Results['Combination'].isin(selected_lines)) & (Results['P(p)>']<0.16+i/100)] | |
if(i==1): | |
sns.lineplot(data=line,x='P(p)>',y='Return',hue='Combination') | |
else: | |
sns.lineplot(data=line,x='P(p)>',y='Return',hue='Combination',legend=False,lw=0.5) | |
sns.scatterplot(data=line,x='P(p)>',y='Return',hue='Combination',legend=False) | |
#plt.plot('P(p)>','Return',data=line[line['Combination']==j],lw=0.5) | |
camera.snap() | |
print('a') | |
anim = camera.animate(blit=True,interval=100) | |
print('a') | |
anim.save('scatter'+str(i)+'.gif') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment