ql.UnitedStates() --> TypeError: __init__() missing 1 required positional argument: 'm'

#import the Quant Lib
import QuantLib as ql

# Let the today date whenwe want to value a instrument be
today = ql.Date(15,6,2020)

# we can set evaluationDate in QL as
ql.Settings.instance().evaluationDate = today
print(ql.Settings.instance().evaluationDate);
# prints..June 15th, 2020

# or you can do
today = ql.Date(15,12,2021);
ql.Settings.instance().setEvaluationDate(today)
print(ql.Settings.instance().evaluationDate)
# prints..December 15th, 2021

June 15th, 2020
December 15th, 2021


settlementDays = 2

# Holiday calendar of united states
calendar = ql.UnitedStates()

------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [8], in <cell line: 4>()
      1 settlementDays = 2
      3 # Holiday calendar of united states
----> 4 calendar = ql.UnitedStates()

TypeError: __init__() missing 1 required positional argument: 'm'

 

Hello Douglas,



It seems that you missed adding the arguments inside the "UnitedStates" function. 



For example, it should be of the following format for NYSE calendar:

calendar2 = ql.UnitedStates(ql.UnitedStates.NYSE) 

You can check the documentation here: https://quantlib-python-docs.readthedocs.io/en/latest/dates.html#calendar


Hope this helps.