If you are using Quantopian, it is advisable that you become familiar with numpy and pandas. For instance:
>>> import numpy as np
>>> -1*np.arange(20)
array([ 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12,
-13, -14, -15, -16, -17, -18, -19])
Then you will have a[1]==-1, a[5]==-5etc.
source
share