Example #1
0
 def __repr__(self):
     attrs = util.dataclassNonDefaults(self)
     if self.__class__ is not Contract:
         attrs.pop('secType', '')
     clsName = self.__class__.__qualname__
     kwargs = ', '.join(f'{k}={v!r}' for k, v in attrs.items())
     return f'{clsName}({kwargs})'
Example #2
0
 def __repr__(self):
     attrs = util.dataclassNonDefaults(self)
     attrs.pop('secType')
     s = 'Forex('
     if 'symbol' in attrs and 'currency' in attrs:
         pair = attrs.pop('symbol')
         pair += attrs.pop('currency')
         s += "'" + pair + "'" + (", " if attrs else "")
     s += ', '.join(f'{k}={v!r}' for k, v in attrs.items())
     s += ')'
     return s