DpExchange.Core.Types.Balance (DpExchangeCore v0.1.4)

Copy Markdown View Source

Normalised balance entry, returned by every venue package.

:timestamp means when we asked

A balance is the only one of the six value types with no venue event time behind it. It is a snapshot, not an occurrence: no exchange reports "this balance happened at 10:04". So its timestamp is the moment the request was made, and that is its freshness — the only honest answer to "how old is this number".

It is enforced for the same reason every other type enforces its timestamp. A balance with no freshness is indistinguishable from a stale one, and a consumer sizing a trade against a balance it believes is current is exactly the failure this family is built to refuse.

Summary

Types

t()

@type t() :: %DpExchange.Core.Types.Balance{
  available_balance: Decimal.t() | nil,
  balance: Decimal.t(),
  currency: String.t(),
  hold: Decimal.t() | nil,
  provider: atom() | String.t(),
  timestamp: DateTime.t()
}