{"record":{"id":"454c80115fbe0312","repo":"nautechsystems/nautilus_trader","slug":"height-must-be-positive-was-self-height","errorCode":null,"errorMessage":"height must be positive, was {self.height}","messagePattern":"height must be positive, was (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/nautilus_trader/analysis/config.py","lineNumber":233,"sourceCode":"    height : int, default 1500\n        Total height of the tearsheet in pixels.\n    show_logo : bool, default True\n        Whether to display NautilusTrader logo in the tearsheet.\n\n    \"\"\"\n\n    charts: list[TearsheetChart] = field(default_factory=_default_charts)\n    theme: str = \"plotly_white\"\n    layout: GridLayout | None = None\n    title: str = \"NautilusTrader Backtest Results\"\n    include_benchmark: bool = True\n    benchmark_name: str = \"Benchmark\"\n    height: int = 1500\n    show_logo: bool = True\n\n    def __post_init__(self) -> None:\n        if self.height <= 0:\n            raise ValueError(f\"height must be positive, was {self.height}\")\n\n    @property\n    def chart_names(self) -> list[str]:\n        return [c.name for c in self.charts]\n","sourceCodeStart":215,"sourceCodeEnd":238,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/python/nautilus_trader/analysis/config.py#L215-L238","documentation":"Thrown when the account_currency string in a Betfair data or execution client config cannot be parsed into a NautilusTrader Currency. Currency parsing only accepts ISO 4217 alpha-3 codes (for Betfair typically \"GBP\" or \"EUR\"), so unrecognized, mistyped, or whitespace-padded strings fail immediately. The parse runs from BetfairDataClientConfig::currency()/BetfairExecutionClientConfig::currency() and is enforced by validate().","triggerScenarios":"Building BetfairDataClientConfig or BetfairExecutionClientConfig (or their Python wrappers) with account_currency set to a non-ISO-4217 value such as \"POUND\", \"gbp \" with a trailing space, \"£\", or a 4-letter code; loading a YAML/TOML/JSON config where the currency key is mistyped or interpolated with whitespace; calling config.validate() or starting the client, which parses the field.","commonSituations":"Hand-written strategy config files using currency names instead of codes; env-var or template interpolation adding whitespace/newlines; porting configs between exchange adapters with different code spellings.","solutions":["Set account_currency to an uppercase ISO 4217 alpha-3 code, e.g. \"GBP\" for UK Betfair accounts","Trim whitespace and uppercase the value before constructing the config","Call config.validate() right after loading config so the failure names the field before the client starts"],"exampleFix":"// before\nlet config = BetfairDataClientConfig::builder()\n    .account_currency(\"Pounds Sterling\".to_string())\n    .build()?;\n\n// after\nlet config = BetfairDataClientConfig::builder()\n    .account_currency(\"GBP\".to_string())\n    .build()?;\nconfig.validate()?;","handlingStrategy":"validation","validationCode":"let code = \"GBP\";\nif code.parse::<Currency>().is_err() {\n    anyhow::bail!(\"account_currency '{code}' is not a valid ISO 4217 alpha-3 code\");\n}\nlet config = BetfairDataClientConfig::builder().account_currency(code.to_string()).build()?;\nconfig.validate()?;","typeGuard":"fn is_valid_currency_code(code: &str) -> bool {\n    code.parse::<Currency>().is_ok()\n}","tryCatchPattern":null,"preventionTips":["Use ISO 4217 alpha-3 codes (GBP, EUR) in every Betfair config","Run config.validate() on every loaded config in CI and at startup","Build configs in typed code rather than hand-editing YAML/JSON strings"],"tags":["betfair","config","currency","validation","rust","nautilustrader"],"backgroundTag":"invalid-currency-code","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}