Exemple #1
0
def get_winning_days(fund_ts):
    """
    @summary Returns percentage of winning days in fund time series
    @param fund_ts: pandas time series of daily fund values
    @return Percentage of winning days over fund time series
    """
    return tsu.get_winning_days(tsu.daily(fund_ts))
Exemple #2
0
print "Reading data..."
high = dataobj.get_data(timestamps, symbols, "high")
actclose = dataobj.get_data(timestamps, symbols, "actual_close")
print actclose.tail()[symbols[:5]]
print high.tail()[symbols[:5]]

eventMatrix = findEvents(symbols, timestamps, high, actclose)

print "Matrix calculated - getting returns..."

rendite = calc_returns(eventMatrix, actclose)
rendite.to_csv('daily_return.csv')
print rendite.describe()
renditereihe = jp.cum_return(rendite)

print
print "Winning Days:"
print tsu.get_winning_days(rendite)
print
print "Max Drawdown:"
print tsu.get_max_draw_down(renditereihe)
print

#jp.plotline(rendite,'Returns (Close to Open)','closetoopen.png',20)

#jp.plotline(renditereihe,'Cum Returns (Close to Open)','closetoopen_cum.png')
rendite.plot()
plt.show()
renditereihe.plot()
plt.show()
Exemple #3
0
high = dataobj.get_data(timestamps, symbols, "high")
actclose = dataobj.get_data(timestamps, symbols, "actual_close")
print actclose.tail()[symbols[:5]]
print high.tail()[symbols[:5]]

eventMatrix = findEvents(symbols,timestamps,high,actclose)

print "Matrix calculated - getting returns..."

rendite=calc_returns(eventMatrix,actclose)
rendite.to_csv('daily_return.csv')
print rendite.describe()
renditereihe=jp.cum_return(rendite)

print
print "Winning Days:"
print tsu.get_winning_days(rendite)
print
print "Max Drawdown:"
print tsu.get_max_draw_down(renditereihe)
print

#jp.plotline(rendite,'Returns (Close to Open)','closetoopen.png',20)

#jp.plotline(renditereihe,'Cum Returns (Close to Open)','closetoopen_cum.png')
rendite.plot()
plt.show()
renditereihe.plot()
plt.show()