Skip to content

Commit 434913b

Browse files
authored
Fix ticker is None check (#244)
1 parent 6c54ed9 commit 434913b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

beancount_import/source/ofx.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -833,15 +833,15 @@ def get_security(unique_id: str) -> Optional[str]:
833833
return None
834834
sec = securities_map[unique_id]
835835
ticker = sec.ticker
836-
# Treasury bill and bond start with 912
837-
if ticker.startswith("912"):
838-
# Prepend "T" to make it a valid ticker
839-
ticker = "T" + ticker
840836
if ticker is None:
841837
results.add_error(
842838
'Missing ticker for security %r. You must specify it manually using a commodity directive with a cusip metadata field.'
843839
% (unique_id, ))
844840
return None
841+
# Treasury bill and bond start with 912
842+
if ticker.startswith("912"):
843+
# Prepend "T" to make it a valid ticker
844+
ticker = "T" + ticker
845845
if not is_valid_commodity_name(ticker):
846846
results.add_error(
847847
'Ticker %r for security %r is not a valid commodity name. You must specify it manually using a commodity directive with a cusip metadata field.'

0 commit comments

Comments
 (0)