From ee7ed0fee6019a24b8c23154e6ed9d8b973dd8fa Mon Sep 17 00:00:00 2001 From: Omar Al-Jadda Date: Sat, 29 Jun 2024 07:19:42 -0700 Subject: [PATCH] add childOptionHoldsngs to get_account_info_v2() --- schwab_api/schwab.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/schwab_api/schwab.py b/schwab_api/schwab.py index d4f8e58..11de801 100644 --- a/schwab_api/schwab.py +++ b/schwab_api/schwab.py @@ -708,6 +708,19 @@ def get_account_info_v2(self): position["symbolDetail"]["schwabSecurityId"] )._as_dict() ) + if "childOptionHoldings" in position: + for child_position in position["childOptionHoldings"]: + positions.append( + Position( + child_position["symbolDetail"]["symbol"], + child_position["symbolDetail"]["description"], + float(child_position["quantity"]), + 0 if "costDetail" not in child_position else float(child_position["costDetail"]["costBasisDetail"]["costBasis"]), + 0 if "priceDetail" not in child_position else float(child_position["priceDetail"]["marketValue"]), + child_position["symbolDetail"]["schwabSecurityId"] + )._as_dict() + ) + if not valid_parse: continue account_info[int(account["accountId"])] = Account(