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