DeltaCalc.Allocation (DeltaCalc v0.3.0)

Copy Markdown View Source

Subaccount allocation-envelope calculations.

API Functions

FunctionArityDescriptionParam Kinds
allocate5Compute subaccount equity envelope from mode configuration.aum: value, mode_cfg: value, assets: value, weights: value, per_sub_cap_pct: value

Summary

Functions

Compute subaccount equity envelope from mode configuration.

Functions

allocate(aum, mode_cfg, assets, weights, per_sub_cap_pct)

@spec allocate(Decimal.t(), map(), [atom()], map(), Decimal.t()) :: map()

Compute subaccount equity envelope from mode configuration.

Parameters

  • aum - Assets under management as a canonical decimal string; native Elixir callers may also pass Decimal or integer. (value)
  • mode_cfg - Mode config with :pct and :cap as canonical decimal strings; native Elixir callers may also pass Decimal or integer. (value)
  • assets - Asset symbols (interface compatibility) (value)
  • weights - Asset weight map (interface compatibility). Exact values use canonical decimal strings; native Elixir callers may also pass Decimal or integer. (value)
  • per_sub_cap_pct - Per-subaccount capital percentage (0-1) as a canonical decimal string; native Elixir callers may also pass Decimal or integer. (value)

Returns

Map with :sub_eq, :init_margin, :reserve, :leftover Decimal fields (map)

# descripex:contract
%{
  params: %{
    aum: %{
      description: "Assets under management as a canonical decimal string; native Elixir callers may also pass Decimal or integer.",
      kind: :value,
      schema: %{"type" => "string"}
    },
    mode_cfg: %{
      description: "Mode config with :pct and :cap as canonical decimal strings; native Elixir callers may also pass Decimal or integer.",
      kind: :value,
      schema: %{
        "additionalProperties" => false,
        "properties" => %{
          "cap" => %{"type" => "string"},
          "pct" => %{"type" => "string"}
        },
        "required" => ["pct", "cap"],
        "type" => "object"
      }
    },
    assets: %{
      description: "Asset symbols (interface compatibility)",
      kind: :value,
      schema: %{"items" => %{"type" => "string"}, "type" => "array"}
    },
    weights: %{
      description: "Asset weight map (interface compatibility). Exact values use canonical decimal strings; native Elixir callers may also pass Decimal or integer.",
      kind: :value,
      schema: %{"type" => "object"}
    },
    per_sub_cap_pct: %{
      description: "Per-subaccount capital percentage (0-1) as a canonical decimal string; native Elixir callers may also pass Decimal or integer.",
      kind: :value,
      schema: %{"type" => "string"}
    }
  },
  returns: %{
    type: :map,
    description: "Map with :sub_eq, :init_margin, :reserve, :leftover Decimal fields"
  }
}