Hello Guys,

I am new to the debugging in spyder. I usually use a step by step debugging 
but I am getting confused because I am not able to get the different values 
of the for loop at some point. 

Here is the code :

# NelSon Siegel Yield Curve Computation
from datetime import date
import numpy as np
def nelsonsiegel(Beta0,Beta1,Beta2,Beta3,Lambda1,Lambda2):
    SettleDate = date(2017,07,14)
    Bond1MaturityDate = date(2018,7,13)
    Bond3MaturityDate = date(2020,2,17)
    Bond5MaturityDate = date(2022,7,21)
    Bond10MaturityDate = date(2027,1,20)
    Bond15MaturityDate = date(2031,9,16)
    Bond20MaturityDate = date(2037,3,17)
    Yearfraction = 
[float((Bond1MaturityDate-SettleDate).days)/365,float((Bond3MaturityDate-SettleDate).days)/365,
 
float((Bond5MaturityDate-SettleDate).days)/365, 
float((Bond10MaturityDate-SettleDate).days)/365, 
float((Bond15MaturityDate-SettleDate).days)/365, 
float((Bond20MaturityDate-SettleDate).days)/365]
#    CouponRate = [0,0.0290,0.0321,0.0494,0.0585,0.0624]
#    BondPrices = [0.97863,0.99745,0.9968, 0.99922,0.98724,0.96679 ]
    NS = []
#    df = []
#    rst = []
#    NSS = []
#    result = []
    for i in range(len(Yearfraction)):        
      NelsonSiegel = Beta0 + (Beta1 * 
((1-np.exp(-Yearfraction[i]/Lambda1)/Yearfraction[i]*Lambda1))) +  (Beta2 * 
((((1-np.exp(-Yearfraction[i]/Lambda1))/(Yearfraction[i]*Lambda1))) - 
(np.exp(-Yearfraction[i]/Lambda1)))) + (Beta3 * 
((((1-np.exp(-Yearfraction[i]/Lambda2))/(Yearfraction[i]*Lambda2))) - 
(np.exp(-Yearfraction[i]/Lambda2)))) 
      NS.append(NelsonSiegel)
      a = np.array(NS) # array for nelson siegel values             
      return NelsonSiegel

to run this function I use  : nelsonsiegel(0.01,0.01,0.01,0.01,1,1)

I normally put a break point one row before the return command.

can you explain to me please how to debug this in the loop step by step. I 
put the breakpoint and executed the command but it never stops at my 
breakpoint.

Thank you

FMG

-- 
You received this message because you are subscribed to the Google Groups 
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/d/optout.

Reply via email to