I am completely new to Python, just trying to reference Quantlib Cookbook to construct eonia curve, here is my code. I didn't change much compared to the cookbook Eonia Curve BootStrapping chapter, but run into errors with syntax:
import QuantLib as ql
import math
import utils
today=ql.Date(9, ql.September, 2019)
ql.Settings.instance().evaluationDate = today
helpers = [ql.DepositRateHelper(ql.QuoteHandle(ql.SimpleQuote(rate)),
ql.Period(1, ql.Days), fixingDays, ql.TARGET(),
ql.ModifiedFollowing, False, ql.Actual360())
for rate, fixingDays in [(-0.00363,0)]
helpers += [ql.OISRateHelper(2, ql.Period(*tenor),
ql.QuoteHandle(ql.SimpleQuote(rate)), ql.Eonia())
for rate, tenor in
[(-0.004415, (2, ql.Weeks)), (-0.00478, (1, ql.Months)),
(-0.00496, (2, ql.Months)), (-0.005065, (3, ql.Months)),
(-0.005235, (4, ql.Months)), (-0.00537, (5, ql.Months)),
(-0.005465, (6, ql.Months)), (-0.005595, (7, ql.Months)),
(-0.005871, (10, ql.Months)), (-0.0059495, (11,ql.Months)),
(-0.005871, (1, ql.Years)), (-0.006349, (18, ql.Months))]]
Errors:
The error exist in the second helpers, below is what pycharm give me:
helpers += [\
^
SyntaxError: invalid syntax
Can anybody give me some hint where went wrong?