Current section

Files

Jump to
tai lib tai exchanges asset_balance.ex
Raw

lib/tai/exchanges/asset_balance.ex

defmodule Tai.Exchanges.AssetBalance do
@type t :: %Tai.Exchanges.AssetBalance{
exchange_id: atom,
account_id: atom,
asset: atom,
free: Decimal.t(),
locked: Decimal.t()
}
@enforce_keys [
:exchange_id,
:account_id,
:asset,
:free,
:locked
]
defstruct [
:exchange_id,
:account_id,
:asset,
:free,
:locked
]
@spec total(balance :: t) :: Decimal.t()
def total(%Tai.Exchanges.AssetBalance{free: free, locked: locked}) do
Decimal.add(free, locked)
end
end