diff --git a/lib/models/response/streaming/pricing/pricing.ex b/lib/models/response/streaming/pricing/pricing.ex deleted file mode 100644 index 90b7f27..0000000 --- a/lib/models/response/streaming/pricing/pricing.ex +++ /dev/null @@ -1,47 +0,0 @@ -defmodule ExOanda.Response.Pricing do - @moduledoc """ - Schema for Oanda streaming pricing response. - """ - - use TypedEctoSchema - import Ecto.Changeset - - @primary_key false - - typed_embedded_schema do - field(:instrument, :string) - field(:status, Ecto.Enum, values: [:tradeable, :non_tradeable, :invalid]) - field(:time, :utc_datetime_usec) - field(:closeout_ask, :float) - field(:closeout_bid, :float) - - embeds_many :asks, Ask, primary_key: false do - field(:liquidity, :integer) - field(:price, :float) - end - - embeds_many :bids, Bid, primary_key: false do - field(:liquidity, :integer) - field(:price, :float) - end - end - - @doc false - def changeset(struct, params) do - struct - |> cast(params, [ - :instrument, - :status, - :time, - :closeout_ask, - :closeout_bid, - ]) - |> cast_embed(:asks, with: &price_changeset/2) - |> cast_embed(:bids, with: &price_changeset/2) - end - - defp price_changeset(struct, params) do - struct - |> cast(params, [:liquidity, :price]) - end -end diff --git a/lib/util/transform.ex b/lib/util/transform.ex index 79e9020..8ae77f0 100644 --- a/lib/util/transform.ex +++ b/lib/util/transform.ex @@ -9,7 +9,7 @@ defmodule ExOanda.Transform do Response, Response.TransactionEvent, Response.PricingHeartbeat, - Response.Pricing + ClientPrice } @spec transform(map(), atom()) :: Response.t() @@ -92,5 +92,5 @@ defmodule ExOanda.Transform do defp find_stream_schema(val, :transactions), do: {TransactionEvent, %{"event" => val}} defp find_stream_schema(%{"type" => "HEARTBEAT"} = val, :pricing), do: {PricingHeartbeat, val} - defp find_stream_schema(val, :pricing), do: {Pricing, val} + defp find_stream_schema(val, :pricing), do: {ClientPrice, val} end