{"record":{"id":"4e7450d1f017c12b","repo":"nautechsystems/nautilus_trader","slug":"invalid-account-currency-code-code","errorCode":null,"errorMessage":"Invalid account currency code: {code}","messagePattern":"Invalid account currency code: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/betfair/src/config.rs","lineNumber":42,"sourceCode":"use nautilus_model::{\n    identifiers::AccountId,\n    types::{Currency, Money},\n};\nuse rust_decimal::Decimal;\nuse serde::{Deserialize, Serialize};\n\nuse crate::{\n    common::{\n        credential::{BetfairCredential, CredentialError},\n        parse::parse_betfair_timestamp,\n    },\n    provider::NavigationFilter,\n    stream::config::BetfairStreamConfig,\n};\n\nfn parse_currency(code: &str) -> anyhow::Result<Currency> {\n    code.parse::<Currency>()\n        .map_err(|_| anyhow::anyhow!(\"Invalid account currency code: {code}\"))\n}\n\nfn make_min_notional(value: Option<Decimal>, currency: Currency) -> anyhow::Result<Option<Money>> {\n    value\n        .map(|amount| Money::from_decimal(amount, currency))\n        .transpose()\n        .map_err(Into::into)\n}\n\nfn validate_market_start_time(label: &str, value: &Option<String>) -> anyhow::Result<()> {\n    if let Some(value) = value {\n        parse_betfair_timestamp(value)\n            .map(|_| ())\n            .map_err(|e| anyhow::anyhow!(\"Invalid {label} '{value}': {e}\"))?;\n    }\n\n    Ok(())\n}","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/betfair/src/config.rs#L24-L60","documentation":"Betfair adapter config validation: the configured account currency string is parsed into the nautilus Currency type, and any parse failure is converted into this anyhow error. It means the currency code string is not a recognized currency in the codebase.","triggerScenarios":"Setting an account_currency (or similar) config value to a code that Currency::from_str does not recognize — misspelled codes, lowercase codes, or non-ISO codes.","commonSituations":"Typos in TOML/env config; using lowercase or free-text currency names; using an exotic venue-specific code nautilus has no Currency registered for.","solutions":["Use a valid ISO 4217 code supported by nautilus (e.g. GBP, USD, EUR, AUD) with exact casing","Check nautilus' Currency registry for supported codes or register a custom Currency before use","Fix the config file or environment variable supplying the code"],"exampleFix":"// before\naccount_currency = \"gbp\"\n// after\naccount_currency = \"GBP\"","handlingStrategy":"validation","validationCode":"// Rust\nlet code = \"GBP\";\nassert!(\n    code.parse::<nautilus_model::enums::Currency>().is_ok(),\n    \"unsupported currency: {code}\"\n);","typeGuard":"fn is_supported_currency(code: &str) -> bool {\n    code.parse::<nautilus_model::enums::Currency>().is_ok()\n}","tryCatchPattern":null,"preventionTips":["Use exact ISO 4217 codes with correct casing in config","Validate currency codes at config-load time before constructing the adapter","Check nautilus' registered Currency list when introducing a new venue currency","Avoid free-text or lowercase currency names in TOML/env"],"tags":["config","currency","validation","betfair"],"backgroundTag":"invalid-argument-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}