Very confused,

trying to sort my options chain list like this:

contracts=sorted(puts,key= lambda x: x.BidPrice / (self.TradingCalendar.GetDaysByType(TradingDayType.BusinessDay, self.Time, x.Expiry)))

and it seems that business days function is returning some random type called a '0, i have tried converting to float using float() but it also fails, anyone know an easy solution to this? im just trying to divide the bid price by the days until option expiry so i can sort it on that.


Runtime Error: Trying to perform a summation, subtraction, multiplication or division between 'float' and '0, Culture=neutral, PublicKeyToken=null]]' objects throws a TypeError exception. To prevent the exception, ensure that both values share the same type.