Introduction to Qtrade ====================== This is a very basic Python 3 wrapper for the `Questrade API `_, a Canadian low cost broker. Installation ------------ This package is available via `PyPI `_ and can be installed via the command .. code:: bash pip install qtrade Usage ----- The main class of the package is called ``Questrade`` and houses most of the functionality provided by the package. Below are a few examples for possible use cases. Token management ^^^^^^^^^^^^^^^^ The central class can be initialized via .. code:: python from qtrade import Questrade qtrade = Questrade(access_code='') where ```` is the token that one gets from the Questrade API portal. It is called ``access_code`` since this initial token is used to get the full token data that will include .. code:: python {'access_token': , 'api_server': '', 'expires_in': 1234, 'refresh_token': , 'token_type': 'Bearer'} The first call initializes the class and the second call gets the full token. Another way to initialize the class is to use a token yaml-file via: .. code:: python qtrade = Questrade(token_yaml='') where the yaml-file would have the general form ..code:: yaml access_token: api_server: expires_in: 1234 refresh_token: token_type: Bearer If the token is expired, one can use .. code:: python qtrade.refresh_token() to refresh the access token using the saved refresh token. Once the tokens are set correctly, I have currently added methods to get ticker quotes, the current status of all positions in any Questrade account that is associated with the tokens, any account activities such as trades and dividend payments as well as historical data for tickers that are supported by Questrade. Basic functionality ^^^^^^^^^^^^^^^^^^^ There currently exists some basic functionality to get stock information via .. code:: python aapl, amzn = qtrade.ticker_information(['AAPL', 'AMZN']) and current stock quotes can be obtained via .. code:: python aapl_quote, amzn_quote = qtrade.get_quote(['AAPL', 'AMZN']) In addition, one can get historical stock quotes via .. code:: python aapl_history = qtrade.get_historical_data('AAPL', '2018-08-01', '2018-08-21','OneHour') Here, the last input parameter is the interval between quotes. Another option could be ``'OneDay'``. For more options, see the `Questrade API description