Alpa.Config (AlpaEx v1.0.3)
View SourceConfiguration management for the Alpa client.
Configuration can be provided via:
- Application config (config/runtime.exs recommended)
- Environment variables
- Explicit options passed to functions
Environment Variables
APCA_API_KEY_ID - Your Alpaca API key
APCA_API_SECRET_KEY - Your Alpaca API secret
APCA_USE_PAPER - "true" for paper trading (default), "false" for liveApplication Config
config :alpa_ex,
api_key: "your-key",
api_secret: "your-secret",
use_paper: truePriority (highest to lowest)
- Options passed directly to functions
- Environment variables
- Application config
Summary
Functions
Get the market data URL.
Check if configuration has valid credentials.
Build configuration from application config and options.
Get the base trading URL based on paper/live mode.
Types
@type t() :: %Alpa.Config{ api_key: String.t() | nil, api_secret: String.t() | nil, data_url: String.t(), receive_timeout: pos_integer(), timeout: pos_integer(), trading_url: String.t(), use_paper: boolean() }
Functions
Get the market data URL.
Check if configuration has valid credentials.
Build configuration from application config and options.
Options override application config values.
Options
:api_key- Alpaca API key (required for authenticated requests):api_secret- Alpaca API secret (required for authenticated requests):use_paper- Use paper trading endpoint (default: true):timeout- Request timeout in milliseconds (default: 30_000):receive_timeout- Response receive timeout in milliseconds (default: 30_000)
Get the base trading URL based on paper/live mode.
If a custom trading_url (different from the default) was explicitly set,
it is used regardless of the use_paper flag. Otherwise, use_paper: true
resolves to the paper trading URL.