tdameritrade_cli.tools package¶
Submodules¶
tdameritrade_cli.tools.client_factory module¶
-
class
tdameritrade_cli.tools.client_factory.
ClientFactory
(json_config: str = None, acct_number: int = None, oauth_user_id: str = None, redirect_uri: str = None)¶ Bases:
object
-
from_config
()¶ Create a TDClient from passed parameters
- Returns
An authenticated TDClient.
-
from_json
()¶ Create a TDClient from a json_config
- Returns
An authenticated TDClient.
- Raises
IsADirectoryError – Bad path to json_config
JSONDecodeError – Bad path to json_config
-
tdameritrade_cli.tools.ods_writer module¶
-
class
tdameritrade_cli.tools.ods_writer.
ODSWriter
(sheet_path: str)¶ Bases:
object
-
static
new_position
(position: List[str]) → collections.OrderedDict¶ Create a sheet with a new position.
- Parameters
position – List of the form [position_id, position_type, position_value] to create.
- Returns
The new sheet with the first data point given by position included.
-
sheet_data
¶ The data currently in the sheet located at self.sheet_path.
- Returns
OrderedDict of data.
-
update_position
(position: List[str], pos_sheet: List[List[T]]) → List[List[T]]¶ Update an existing position in an ods document
- Parameters
position – List of the form [position_id, position_type, position_value] to update.
pos_sheet – The sheet in the ods document describing the existing position.
- Returns
Updated pos_sheet
-
write_positions
(liq_value: str, positions: List[List[str]])¶ Write positions data to an ods document.
- Parameters
liq_value – The current liquidation value of a TDA portfolio.
positions – List[List[str]] where each List[str] is [position_id, position_type, position_value].
-
static
-
tdameritrade_cli.tools.ods_writer.
check_version
(func: Callable) → Callable¶ Context manager that checks the written spreadsheet has a supported version.
tdameritrade_cli.tools.positions module¶
-
tdameritrade_cli.tools.positions.
get_positions
(client: tdameritrade_client.client.TDClient) → Tuple[str, List[List[str]]]¶ Retrieve all positions for the authenticated account.
- Parameters
client – An authorized TDClient object.
- Returns
The current liquidation value of the account and a list of positions where each position is [position_id, position_type, position_value].