def format(model, defaults = {})
      model.class.defined_attributes.each_with_object(defaults.dup) do |(name, options), formatted|
        value = model.send name

        next if value.nil?

        formatted[snake_case_to_camel_case(name)] = format_value value, options
      end
    end
def format(model, defaults = {})
      model.class.defined_attributes.each_with_object(defaults.dup) do |(name, options), formatted|
        value = model.send name

        next if value.nil?

        formatted[snake_case_to_camel_case(name)] = format_value value, options
      end
    end
Takes a {Model} and returns its attributes in a hash ready to be passed as a request body to the IG Markets API.
 Attribute names will be converted from snake case to camel case, `Symbol` attributes will be converted to strings
 and will be uppercased, and both `Date` and `Time` attributes will be converted to strings using their first
 available `:format` option.

 @param [Model] model The model instance to convert attributes for.
 @param [Hash] defaults The default attribute values to return, can be overridden by values set on `model`.

 @return [Hash] The resulting attributes hash.