Skip to content

Instantly share code, notes, and snippets.

@icexelloss
Created October 18, 2018 19:17
Show Gist options
  • Save icexelloss/93d29477240774074737e76a3e9a2ba2 to your computer and use it in GitHub Desktop.
Save icexelloss/93d29477240774074737e76a3e9a2ba2 to your computer and use it in GitHub Desktop.
FlintCase5
from ts.flint import udf
@udf('double', arg_type='numpy')
def decayed(columns):
v = columns[0]
decay = np.power(0.5, np.arange(len(v)))[::-1]
return (v * decay).sum()
sp500_decayed_return = sp500_joined_return.summarizeWindows(
window = windows.past_absolute_time('7day'),
summarizer = {'previous_day_decayed_return':
decayed(sp500_joined_return[['previous_day_return']])})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment