Compile-time exchange lookup registry.
Maps exchange ID atoms and strings to their generated module names. Built from the spec manifest at compile time — recompiles automatically when the manifest changes.
Usage
Bourse.Registry.lookup(:bybit)
#=> {:ok, Bourse.Bybit}
Bourse.Registry.lookup!("binance")
#=> Bourse.Binance
Bourse.Registry.exchanges()
#=> ["alpaca", "binance", ..., "okx"]
Bourse.Registry.loaded?(:bybit)
#=> true # if Bourse.Bybit module is compiled
Summary
Functions
Returns the closed runtime-support inventory as strings.
Checks if the exchange module is compiled and loaded.
Looks up the module for an exchange ID.
Looks up the module for an exchange ID, raising on unknown.
Returns the module for an exchange ID, or nil if unsupported.
Checks if an exchange ID is registered.
Functions
@spec exchanges() :: [String.t()]
Returns the closed runtime-support inventory as strings.
Examples
Bourse.Registry.exchanges()
#=> ["alpaca", "binance", ..., "okx"]
Checks if the exchange module is compiled and loaded.
Returns true only if the exchange is registered AND its module is available in the BEAM. Useful for distinguishing "known exchange" from "exchange module exists."
Examples
Bourse.Registry.loaded?(:bybit)
#=> true # if Bourse.Bybit is compiled
@spec lookup(String.t() | atom()) :: {:ok, module()} | {:error, {:unsupported_exchange, String.t()}}
Looks up the module for an exchange ID.
Accepts both string and atom IDs.
Examples
Bourse.Registry.lookup("bybit")
#=> {:ok, Bourse.Bybit}
Bourse.Registry.lookup(:kraken)
#=> {:error, {:unsupported_exchange, "kraken"}}
Looks up the module for an exchange ID, raising on unknown.
Examples
Bourse.Registry.lookup!(:bybit)
#=> Bourse.Bybit
Returns the module for an exchange ID, or nil if unsupported.
Examples
Bourse.Registry.module_for("bybit")
#=> Bourse.Bybit
Bourse.Registry.module_for("nope")
#=> nil
Checks if an exchange ID is registered.
Examples
Bourse.Registry.registered?(:bybit)
#=> true