Exemplo n.º 1
0
    def setUp(self) -> None:
        """Set up the `TdAmeritradeClient` Client."""

        # Initialize the Parser.
        config = ConfigParser()

        # Read the file.
        config.read('config/config.ini')

        # Get the specified credentials.
        client_id = config.get('main', 'client_id')
        redirect_uri = config.get('main', 'redirect_uri')

        # Intialize our `Crednetials` object.
        self.td_credentials = TdCredentials(
            client_id=client_id,
            redirect_uri=redirect_uri,
            credential_file='config/td_credentials.json')

        # Initalize the `TdAmeritradeClient`
        self.td_client = TdAmeritradeClient(credentials=self.td_credentials)
Exemplo n.º 2
0
# Initialize the Parser.
config = ConfigParser()

# Read the file.
config.read('config/config.ini')

# Get the specified credentials.
client_id = config.get('main', 'client_id')
redirect_uri = config.get('main', 'redirect_uri')
account_number = config.get('main', 'account_number')

# Intialize our `Crednetials` object.
td_credentials = TdCredentials(
    client_id=client_id,
    redirect_uri=redirect_uri,
    credential_file='config/td_credentials.json'
)

# Initalize the `TdAmeritradeClient`
td_client = TdAmeritradeClient(
    credentials=td_credentials
)

# Initialize the `Watchlists` service.
watchlists_service = td_client.watchlists()

# Grab all watchlists for all accounts.
pprint(
    watchlists_service.get_all_accounts_watchlists()
)
Exemplo n.º 3
0
from td.credentials import TdCredentials
from td.client import TdAmeritradeClient
from configparser import ConfigParser

# Initialize the Parser.
config = ConfigParser()

# Read the file.
config.read('config/config.ini')

# Get the specified credentials.
client_id = config.get('main', 'client_id')
redirect_uri = config.get('main', 'redirect_uri')

# Intialize our `Crednetials` object.
td_credentials = TdCredentials(client_id=client_id, redirect_uri=redirect_uri)

td_credentials.to_credential_file(file_path='config/td_credentials.json')

# Initalize the `TdAmeritradeClient`
td_client = TdAmeritradeClient(credentials=td_credentials)