code: def from_dict(data, ctx):
          
  
          data = data.copy()
  
          if data.get('price') is not None:
              data['price'] = ctx.convert_decimal_number(
                  data.get('price')
              )
  
          if data.get('initialUnits') is not None:
              data['initialUnits'] = ctx.convert_decimal_number(
                  data.get('initialUnits')
              )
  
          if data.get('initialMarginRequired') is not None:
              data['initialMarginRequired'] = ctx.convert_decimal_number(
                  data.get('initialMarginRequired')
              )
  
          if data.get('currentUnits') is not None:
              data['currentUnits'] = ctx.convert_decimal_number(
                  data.get('currentUnits')
              )
  
          if data.get('realizedPL') is not None:
              data['realizedPL'] = ctx.convert_decimal_number(
                  data.get('realizedPL')
              )
  
          if data.get('unrealizedPL') is not None:
              data['unrealizedPL'] = ctx.convert_decimal_number(
                  data.get('unrealizedPL')
              )
  
          if data.get('marginUsed') is not None:
              data['marginUsed'] = ctx.convert_decimal_number(
                  data.get('marginUsed')
              )
  
          if data.get('averageClosePrice') is not None:
              data['averageClosePrice'] = ctx.convert_decimal_number(
                  data.get('averageClosePrice')
              )
  
  
          if data.get('financing') is not None:
              data['financing'] = ctx.convert_decimal_number(
                  data.get('financing')
              )
  
          if data.get('clientExtensions') is not None:
              data['clientExtensions'] = \
                  ctx.transaction.ClientExtensions.from_dict(
                      data['clientExtensions'], ctx
                  )
  
          return TradeSummary(**data)
docs: Instantiate a new TradeSummary from a dict (generally from loading a
          JSON response). The data used to instantiate the TradeSummary is a
          shallow copy of the dict passed in, with any complex child types
          instantiated appropriately.