code: def from_dict(data, ctx):
          
  
          data = data.copy()
  
          if data.get('netUnrealizedPL') is not None:
              data['netUnrealizedPL'] = ctx.convert_decimal_number(
                  data.get('netUnrealizedPL')
              )
  
          if data.get('longUnrealizedPL') is not None:
              data['longUnrealizedPL'] = ctx.convert_decimal_number(
                  data.get('longUnrealizedPL')
              )
  
          if data.get('shortUnrealizedPL') is not None:
              data['shortUnrealizedPL'] = ctx.convert_decimal_number(
                  data.get('shortUnrealizedPL')
              )
  
          if data.get('marginUsed') is not None:
              data['marginUsed'] = ctx.convert_decimal_number(
                  data.get('marginUsed')
              )
  
          return CalculatedPositionState(**data)
docs: Instantiate a new CalculatedPositionState from a dict (generally from
          loading a JSON response). The data used to instantiate the
          CalculatedPositionState is a shallow copy of the dict passed in, with
          any complex child types instantiated appropriately.