FixAlchemy.Feed.Pipeline behaviour (FIXAlchemy v0.2.4)
View SourceTurns a permission stage into a price transform.
FixAlchemy.Feed keys its tree on stages and never interprets them. A venue
implements this behaviour to say what each stage does to a price.
defmodule MyVenue.Prices do
@behaviour FixAlchemy.Feed.Pipeline
@impl true
def apply_stage({:spread, points}, price) do
%{price | bid: price.bid - points, ask: price.ask + points}
end
def apply_stage({:markup, points}, price) do
%{price | ask: price.ask + points}
end
def apply_stage({:commission, :none}, price), do: price
endapply_stage/2 is called once per live edge of the tree, not once per
subscriber, and runs in the publishing process. It must be pure and must not
block.
Summary
Callbacks
Apply one stage to a price.