我正在阅读的代码使用@batch_transform
. 符号有什么作用@
?它是 ipython 特定的吗?
from zipline.transforms import batch_transform
from scipy import stats
@batch_transform
def regression_transform(data):
pep_price = data.price['PEP']
ko_price = data.price['KO']
slope, intercept, _, _, _ = stats.linregress(pep_price, ko_price)
return intercept, slope