# Introduction
Yet another Questrade API wrapper.
For details about the input parameters and output results, please visit
the [Questrade API documentation](https://www.questrade.com/api/home).
### To install:
**python -m pip install kwess**
# Usage Example
```
import kwess
from datetime import datetime as dt
from pprint import pprint
# It is assumed that your manually generated token has been saved in local file
# my_token.txt
qs = kwess.Trader(rt_file="my_token.txt", verbose="v")
accs = qs.get_accounts()
for acc in accs:
print(acc, "\n")
accn = qs.find_account_number("tfsa")
print(accn)
# Get account activities from 1/12/1999 to 28/9/2022
accs = qs.get_account_activities(startdatetime=dt(year=1999, month=12, day=1), \
enddatetime=dt(year=2022, month=9, day=28), verbose="xxx")
for acc in accs:
print(acc, "\n")
# Get (all types of) TFSA account orders from 17/8/2022 to now
# Questrade does not seem to keep old account orders - only the most recent
accs = qs.get_account_orders(startdatetime=dt(year=2022, month=8, day=17), \
verbose="vv")
for acc in accs:
print(acc, "\n")
# Get margin account orders that are still open
accs = qs.get_account_orders(accounttype="margin", startdatetime=dt(year=2022, \
month=7, day=28), enddatetime=dt.now(), statefilter="opened", verbose="333")
for acc in accs:
print(acc, "\n")
ords = qs.get_account_orders_by_ids(accounttype="tfsa", orderid="1088713788", \
verbose="b")
pprint(ords)
ords = qs.get_account_orders_by_ids(orderid="1098747429,1088752426,1088713788", \
verbose="aa")
pprint(ords)
ords = qs.get_account_orders_by_ids(orderid=1098747429)
pprint(ords)
# Get the current time from the API server
dto = qs.get_server_time()
print(dto[0])
print(dto[1])
# Questrade does not seem to keep old account executions - only the most recent
excs = qs.get_account_executions(startdatetime=dt(year=2022, month=1, day=28), \
enddatetime=dt(year=2022, month=9, day=30), verbose="o")
for exc in excs:
print(exc, "\n")
accs = qs.get_account_balances()
print(accs)
accs = qs.get_account_positions(verbose="d")
print(accs)
sim = qs.search_symbols("vfv", verbose="88")
print(sim)
sim = qs.get_symbols_by_names("xdiv.to,xuu.to,cve.to", verbose="**")
print(sim)
sim = qs.get_symbols_by_names("hom.un.to")
print(sim)
sim = qs.get_symbols_by_ids(26070347, verbose="e")
print(sim)
sim = qs.get_symbols_by_ids("26070347,12890,8953192,18070692", verbose="ee")
print(sim)
sim = qs.get_symbol_options(12890, verbose="s")
pprint(sim)
mks = qs.get_markets()
pprint(mks)
mks = qs.get_market_quotes(12890,verbose="zz")
print(mks)
mks = qs.get_market_quotes("26070347,12890,8953192,18070692", verbose="h")
print(mks)
ops = qs.get_market_quotes_options(option_ids=[9907637,9907638])
pprint(ops)
```
# API Class And Methods
class Trader
```
__init__(self, rt_file='refreshToken', server_type='live', timeout=15, verbose='')
Description:
Initializer of a Trader object. Before creating a Trader object (for the very
first time or when the present token has expired), you must generate a new
token for manual authorization from your Questrade APP HUB, and save that
manually generated token in a local file. That local file's filename
(or pathname) is passed to rt_file.
When Trader creates a Trader object, it exchanges that manually obtained token
for an access token and a refresh token. The access token expires in 30 minutes
and the refresh token expires in three days.
As long as the refresh token has not expired, creating Trader objects or
calling method get_new_refresh_token will obtain a new access token (if the
current access token has expired) and obtain a new replacement refresh token
that will last for another 3 days.
Technically, as long as the current refresh token has not expired, it is
possible to keep exchanging the current refresh token for a new access token and
new refresh token pair indefinitely (by creating Trader objects or calling
method get_new_refresh_token).
If the refresh token ever expires, you must log back into your Questrade account,
generate a new token for manual authorization under APP HUB, and save that token
in the local file referred to by rt_file.
Parameters:
- rt_file name of your local file containing your refresh token.
Defaults to "refreshToken".
- server_type could be 2 possible values: "live" or "test".
"live" will allow you to interact with your real Questrade account.
"test" is for interacting with your test account.
- timeout number of seconds to wait for the server to respond before
giving up.
Defaults to 15 seconds. Set timeout to None if you wish to wait forever
for a response.
- verbose level of verbosity represented by the number of characters in a string.
Defaults to empty string. Maximum verbosity is 1 or "v".
Returns:
Trader object.
build_datetime_string(self, adatetime=None, gmt=False)
Description:
Higher level helper method used to build a Questrade datetime string.
Parameters:
- adatetime a datetime object. Defaults to now.
- gmt optional boolean indicating if datetime is Greenwich Mean Time.
Default value is False.
Returns:
A Questrade datetime string.
find_account_number(self, accounttype)
Description:
Finds the account number corresponding to account type.
Parameters:
- accounttype the type of account. Example "tfsa", "margin", etc.
Returns:
An account number in string format.
get_account_activities(self, startdatetime, enddatetime=None, accounttype='TFSA',
verbose='')
Description:
Generator that returns the account activities from the account related to account
type accounttype, between the range specified by startdatetime and enddatetime.
Both objects are datetime objects.
Parameters:
- startdatetime datetime object specifying the start of a range.
- enddatetime optional datetime object specifying the end of a range.
Defaults to now (datetime.datetime.now()) if not specified.
- accounttype type of Questrade account.
Defaults to "tfsa".
- verbose level of verbosity represented by the number of characters in a string.
Defaults to empty string. Maximum verbosity is 3 or "vvv".
Yields:
The account activities as a Python object representation of the returned json,
between the range startdatetime and enddatetime, in chunks of 30 days.
get_account_balances(self, accounttype='TFSA', verbose='')
Definition:
Provides the account balances for the account related to account type
accounttype.
Paramaters:
- accounttype type of Questrade account.
Defaults to "tfsa".
- verbose level of verbosity represented by the number of characters in
a string.
Defaults to empty string. Maximum verbosity is 2 or "vv".
Returns:
Account balances as a Python object representation of the returned json.
get_account_executions(self, startdatetime, enddatetime=None,
accounttype='TFSA', verbose='')
Description:
Generator that provides account executions from the account related to
account type accounttype, between the range specified by startdatetime and
enddatetime. Both objects are datetime objects.
Parameters:
- startdatetime datetime object representing the beginning of a range.
- enddatetime datetime object representing the end of a range.
Defaults to now (datetime.datetime.now()) if not specified.
- accounttype type of Questrade account.
Defaults to "tfsa".
- verbose level of verbosity represented by the number of characters in
a string.
Defaults to empty string. Maximum verbosity is 3 or "vvv".
Yields:
Account executions as a Python object representation of the returned json,
between the range startdatetime and enddatetime, in chunks of 30 days.
get_account_orders(self, startdatetime, enddatetime=None, accounttype='TFSA',
statefilter='All', verbose='')
Description:
Generator that provides the account orders from the account related to
account type accounttype, between the range specified by startdatetime and
enddatetime. Both objects are datetime objects.
Parameters:
- startdatetime datetime object representing the beginning of a range.
- enddatetime optional datetime object representing the end of a range.
Defaults to now (datetime.datetime.now()) if not specified.
- accounttype type of Questrade account.
Defaults to "tfsa".
- statefilter can be used to specify the state of orders.
It has 3 possible values: Opened, Closed, or All.
Defaults to "All".
- verbose level of verbosity represented by the number of characters in a string.
Defaults to empty string. Maximum verbosity is 3 or "vvv".
Yields:
Account orders as a Python object representation of the returned json,
between the range startdatetime and enddatetime, in chunks of 30 days.
get_account_orders_by_ids(self, orderid, accounttype='TFSA', verbose='')
Description:
Provides the account orders, specified by orderid, from the account related to
account type accounttype.
Parameters:
- orderid is a string of one or many orderid numbers. Several orderid numbers are
seperated by commas (with no spaces). A single orderid could be passed as
a numeral instead of a string.
- accounttype type of Questrade account.
Defaults to "tfsa".
- verbose level of verbosity represented by the number of characters in a string.
Defaults to empty string. Maximum verbosity is 2 or "vv".
Returns:
Account orders as a Python object representation of the returned json.
get_account_positions(self, accounttype='TFSA', verbose='')
Definition:
Provides the account positions for the account related to account type
accounttype.
Paramaters:
- accounttype type of Questrade account.
Defaults to "tfsa".
- verbose level of verbosity represented by the number of characters in a string.
Defaults to empty string. Maximum verbosity is 2 or "vv".
Returns:
Account positions as a Python object representation of the returned json.
get_accounts(self, verbose='')
Description:
Generator that provides the accounts.
Parameters:
- verbose level of verbosity represented by the number of characters in a string.
Defaults to empty string. Maximum verbosity is 1 or "v".
Yields:
All your Questrade accounts as a Python object representation of the returned
json.
get_market_candles(self, sid, interval, startdatetime, enddatetime=None,
verbose='')
Description:
Provides a list of json formatted market candles.
Parameters:
- sid symbol id as a string or numeral.
- interval is the Historical Data Granularity.
Examples: "OneMinute", "HalfHour", "OneYear".
- startdatetime datetime object representing the beginning of a range.
- enddatetime datetime object representing the end of a range.
Defaults to now if not specified.
- verbose level of verbosity represented by the number of characters in a string.
Defaults to empty string. Maximum verbosity is 2 or "vv".
Returns:
Historical market data in the form of OHLC candlesticks for a specified symbol
as a Python object representation of the returned json.
This call is limited to returning 2,000 candlesticks in a single response.
sid is a symbol id.
get_market_quotes(self, ids, verbose='')
Definition:
Provides market quotes data.
Parameter:
- ids Internal symbol identifier. Could be a single value or a string of values.
- verbose level of verbosity represented by the number of characters in a string.
Defaults to empty string. Maximum verbosity is 2 or "vv".
Returns:
A single Level 1 market data quote for one or more symbols in json string format
as a Python object representation of the returned json.
IMPORTANT NOTE: Questrade user needs to be subscribed to a real-time data
package, to receive market quotes in real-time, otherwise call to get quote
is considered snap quote and limit per market can be quickly reached.
Without real-time data package, once limit is reached, the response will return
delayed data. (Please check "delay" parameter in response always).
get_market_quotes_options(self, option_ids, filters=None, verbose='')
Definition:
Provides market quotes options.
Parameters:
- option_ids is a list of stock option ids.
- filters optional list of dictionary items.
- verbose level of verbosity represented by the number of characters in a string.
Defaults to empty string. Maximum verbosity is 2 or "vv".
Returns:
A single Level 1 market data quote and Greek data for one or more option symbols
as a Python object representation of the returned json.
get_market_quotes_strategies(self, variants, verbose='')
Definition:
Provides a calculated L1 market data quote for a single or many multi-leg
strategies.
Parameter:
- variants is a list of dictionary items.
- verbose level of verbosity represented by the number of characters in a string.
Defaults to empty string. Maximum verbosity is 2 or "vv".
Returns:
A calculated L1 market data quote for a single or many multi-leg strategies
as a Python object representation of the returned json.
get_markets(self, verbose='')
Description:
Provides market data.
Parameters:
- verbose level of verbosity represented by the number of characters in a string.
Defaults to empty string. Maximum verbosity is 2 or "vv".
Returns:
Information about supported markets as a Python object representation of
the returned json.
get_new_refresh_token(self, token, server_type, verbose='')
Description:
Obtains a new refresh token (and new access token) from the Authorization server.
You generally would not need to call this method, as it is potentially called by
Trader during initialization.
Trader will only call this method if the access token has expired.
Parameters:
- token the refresh token that is stored in the local file pointed to by rt_file.
- server_type should be "live" or "test" for your live Questrade account or
your test Questrade account, respectively.
- verbose level of verbosity represented by the number of characters in a string.
Defaults to empty string. Maximum verbosity is 1 or "v".
get_server_time(self, verbose='')
Description:
Provides the time from the Questrade API server.
Parameters:
- verbose level of verbosity represented by the number of characters in a string.
Defaults to empty string. Maximum verbosity is 2 or "vv".
Returns:
The time on the server as a tuple made of a simple datetime object,
as well as in the expected Python object representation of the returned json.
get_symbol_options(self, sid, verbose='')
Definition:
Provides symbol options data.
Parameter:
- sid Internal symbol identifier.
- verbose level of verbosity represented by the number of characters in a string.
Defaults to empty string. Maximum verbosity is 2 or "vv".
Returns:
An option chain for a particular underlying symbol as a Python object
representation of the returned json.
get_symbols_by_ids(self, ids, verbose='')
Definition:
Provides symbols data from symbol id(s).
Parameter:
- ids Internal symbol identifier(s). Could be a single numeric value or a string
of comma-seperated values (with no spaces).
- verbose level of verbosity represented by the number of characters in a string.
Defaults to empty string. Maximum verbosity is 2 or "vv".
Returns:
Detailed information about one or more symbol as a Python object representation
of the returned json.
get_symbols_by_names(self, names, verbose='')
Definition:
Provides symbols data from name(s).
Parameter:
- names is a string of names seperated by commas (with no spaces).
- verbose level of verbosity represented by the number of characters in a string.
Defaults to empty string. Maximum verbosity is 2 or "vv".
Returns:
Detailed information about one or more symbol as a Python object representation
of the returned json.
object_to_qdstr(self, dto, gmt=False)
Description:
Converts a datetime object to a Questrade datetime string.
Parameters:
- dto datetime object.
- gmt optional boolean indicating if datetime is Greenwich Mean Time.
Default value is False.
Returns:
The provided datetime object in Questrade API compatible string format.
Example: "2011-02-01T00:00:00-05:00".
If gmt is set to False, time will be in local time.
If gmt is True, the returned time will be considered as gmt time.
search_symbols(self, prefix, offset=0, verbose='')
Definition:
Provides symbol(s) data using several search criteria.
Parameters:
- prefix Prefix of a symbol or any word in the description.
- offset Offset in number of records from the beginning of a result set.
Default is not to offset.
- verbose level of verbosity represented by the number of characters in a string.
Defaults to empty string. Maximum verbosity is 2 or "vv".
Returns:
Symbol(s) data as a Python object representation of the returned json.
values_to_dobj(self, y, m, d, h=0, mi=0, s=0)
Description:
Helper method that builds a datetime object.
Parameters:
- y integer to be set as the year.
- m intiger to be set as the month.
- d integer to be set as the day.
- h optional integer to be set as the hour. Default value is 0.
- mi optional integer to be set as the minutes. Default value is 0.
- s optional integer to be set as the seconds. Default value is 0.
Returns:
A datetime object from the values provided as parameters.
values_to_qdstr(self, y, m, d, h=0, mi=0, s=0, gmt=False)
Description:
Helper method that builds a Questrade datetime string.
- y integer to be set as the year.
- m intiger to be set as the month.
- d integer to be set as the day.
- h optional integer to be set as the hour. Default value is 0.
- mi optional integer to be set as the minutes. Default value is 0.
- s optional integer to be set as the seconds. Default value is 0.
- gmt optional boolean indicating if datetime is Greenwich Mean Time.
Default value is False.
Returns:
The date time and timezone values provided as parameters in Questrade API
compatible string format.
Example: "2011-02-01T00:00:00-05:00".
If gmt is set to False, time will be in local time.
If gmt is True, the returned time will be considered as gmt time.
```
Let me know if you have any questions: <kaiyoux@gmail.com>
Raw data
{
"_id": null,
"home_page": "https://github.com/kaiyoux/kwess",
"name": "kwess",
"maintainer": "Issa Lompo",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "kaiyoux@gmail.com",
"keywords": "Questrade, api, REST, wrapper",
"author": "Issa Lompo",
"author_email": "kaiyoux@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/a0/11/8c56d05abf38b4b4909a01ce25958cc078b8cda5c19c2e7ed6dfcf9236e7/kwess-0.0.7.tar.gz",
"platform": null,
"description": "# Introduction\r\n\r\nYet another Questrade API wrapper.\r\n\r\nFor details about the input parameters and output results, please visit\r\nthe [Questrade API documentation](https://www.questrade.com/api/home).\r\n\r\n### To install:\r\n**python -m pip install kwess**\r\n\r\n\r\n# Usage Example\r\n\r\n```\r\nimport kwess\r\nfrom datetime import datetime as dt\r\nfrom pprint import pprint\r\n\r\n# It is assumed that your manually generated token has been saved in local file \r\n# my_token.txt\r\nqs = kwess.Trader(rt_file=\"my_token.txt\", verbose=\"v\")\r\n\r\naccs = qs.get_accounts()\r\nfor acc in accs:\r\n print(acc, \"\\n\")\r\n\r\naccn = qs.find_account_number(\"tfsa\")\r\nprint(accn)\r\n\r\n# Get account activities from 1/12/1999 to 28/9/2022\r\naccs = qs.get_account_activities(startdatetime=dt(year=1999, month=12, day=1), \\\r\nenddatetime=dt(year=2022, month=9, day=28), verbose=\"xxx\")\r\nfor acc in accs:\r\n print(acc, \"\\n\")\r\n\r\n# Get (all types of) TFSA account orders from 17/8/2022 to now\r\n# Questrade does not seem to keep old account orders - only the most recent\r\naccs = qs.get_account_orders(startdatetime=dt(year=2022, month=8, day=17), \\\r\nverbose=\"vv\")\r\nfor acc in accs:\r\n print(acc, \"\\n\")\r\n\r\n# Get margin account orders that are still open\r\naccs = qs.get_account_orders(accounttype=\"margin\", startdatetime=dt(year=2022, \\\r\nmonth=7, day=28), enddatetime=dt.now(), statefilter=\"opened\", verbose=\"333\")\r\nfor acc in accs:\r\n print(acc, \"\\n\")\r\n\r\nords = qs.get_account_orders_by_ids(accounttype=\"tfsa\", orderid=\"1088713788\", \\\r\nverbose=\"b\")\r\npprint(ords)\r\n\r\nords = qs.get_account_orders_by_ids(orderid=\"1098747429,1088752426,1088713788\", \\\r\nverbose=\"aa\")\r\npprint(ords)\r\n\r\nords = qs.get_account_orders_by_ids(orderid=1098747429)\r\npprint(ords)\r\n\r\n# Get the current time from the API server\r\ndto = qs.get_server_time()\r\nprint(dto[0])\r\nprint(dto[1])\r\n\r\n# Questrade does not seem to keep old account executions - only the most recent\r\nexcs = qs.get_account_executions(startdatetime=dt(year=2022, month=1, day=28), \\\r\nenddatetime=dt(year=2022, month=9, day=30), verbose=\"o\")\r\nfor exc in excs:\r\n print(exc, \"\\n\")\r\n\r\naccs = qs.get_account_balances()\r\nprint(accs)\r\n\r\naccs = qs.get_account_positions(verbose=\"d\")\r\nprint(accs)\r\n\r\nsim = qs.search_symbols(\"vfv\", verbose=\"88\")\r\nprint(sim)\r\n\r\nsim = qs.get_symbols_by_names(\"xdiv.to,xuu.to,cve.to\", verbose=\"**\")\r\nprint(sim)\r\n\r\nsim = qs.get_symbols_by_names(\"hom.un.to\")\r\nprint(sim)\r\n\r\nsim = qs.get_symbols_by_ids(26070347, verbose=\"e\")\r\nprint(sim)\r\n\r\nsim = qs.get_symbols_by_ids(\"26070347,12890,8953192,18070692\", verbose=\"ee\")\r\nprint(sim)\r\n\r\nsim = qs.get_symbol_options(12890, verbose=\"s\")\r\npprint(sim)\r\n\r\nmks = qs.get_markets()\r\npprint(mks)\r\n\r\nmks = qs.get_market_quotes(12890,verbose=\"zz\")\r\nprint(mks)\r\n\r\nmks = qs.get_market_quotes(\"26070347,12890,8953192,18070692\", verbose=\"h\")\r\nprint(mks)\r\n\r\nops = qs.get_market_quotes_options(option_ids=[9907637,9907638])\r\npprint(ops)\r\n\r\n```\r\n\r\n\r\n# API Class And Methods\r\n\r\nclass Trader\r\n```\r\n__init__(self, rt_file='refreshToken', server_type='live', timeout=15, verbose='')\r\nDescription:\r\n Initializer of a Trader object. Before creating a Trader object (for the very \r\n first time or when the present token has expired), you must generate a new \r\n token for manual authorization from your Questrade APP HUB, and save that \r\n manually generated token in a local file. That local file's filename \r\n (or pathname) is passed to rt_file.\r\n When Trader creates a Trader object, it exchanges that manually obtained token \r\n for an access token and a refresh token. The access token expires in 30 minutes \r\n and the refresh token expires in three days.\r\n As long as the refresh token has not expired, creating Trader objects or \r\n calling method get_new_refresh_token will obtain a new access token (if the \r\n current access token has expired) and obtain a new replacement refresh token \r\n that will last for another 3 days.\r\n Technically, as long as the current refresh token has not expired, it is \r\n possible to keep exchanging the current refresh token for a new access token and \r\n new refresh token pair indefinitely (by creating Trader objects or calling \r\n method get_new_refresh_token).\r\n If the refresh token ever expires, you must log back into your Questrade account,\r\n generate a new token for manual authorization under APP HUB, and save that token\r\n in the local file referred to by rt_file.\r\nParameters:\r\n - rt_file name of your local file containing your refresh token.\r\n Defaults to \"refreshToken\".\r\n - server_type could be 2 possible values: \"live\" or \"test\". \r\n \"live\" will allow you to interact with your real Questrade account. \r\n \"test\" is for interacting with your test account.\r\n - timeout number of seconds to wait for the server to respond before \r\n giving up.\r\n Defaults to 15 seconds. Set timeout to None if you wish to wait forever \r\n for a response.\r\n - verbose level of verbosity represented by the number of characters in a string.\r\n Defaults to empty string. Maximum verbosity is 1 or \"v\".\r\nReturns:\r\n Trader object.\r\n\r\n\r\nbuild_datetime_string(self, adatetime=None, gmt=False)\r\nDescription:\r\n Higher level helper method used to build a Questrade datetime string.\r\nParameters:\r\n - adatetime a datetime object. Defaults to now.\r\n - gmt optional boolean indicating if datetime is Greenwich Mean Time.\r\n Default value is False.\r\nReturns:\r\n A Questrade datetime string.\r\n\r\n\r\nfind_account_number(self, accounttype)\r\nDescription:\r\n Finds the account number corresponding to account type.\r\nParameters:\r\n - accounttype the type of account. Example \"tfsa\", \"margin\", etc.\r\nReturns:\r\n An account number in string format.\r\n\r\n\r\nget_account_activities(self, startdatetime, enddatetime=None, accounttype='TFSA',\r\nverbose='')\r\nDescription:\r\n Generator that returns the account activities from the account related to account \r\n type accounttype, between the range specified by startdatetime and enddatetime. \r\n Both objects are datetime objects.\r\nParameters:\r\n - startdatetime datetime object specifying the start of a range.\r\n - enddatetime optional datetime object specifying the end of a range. \r\n Defaults to now (datetime.datetime.now()) if not specified.\r\n - accounttype type of Questrade account. \r\n Defaults to \"tfsa\".\r\n - verbose level of verbosity represented by the number of characters in a string.\r\n Defaults to empty string. Maximum verbosity is 3 or \"vvv\".\r\nYields:\r\n The account activities as a Python object representation of the returned json,\r\n between the range startdatetime and enddatetime, in chunks of 30 days.\r\n\r\n\r\nget_account_balances(self, accounttype='TFSA', verbose='')\r\nDefinition:\r\n Provides the account balances for the account related to account type \r\n accounttype.\r\nParamaters:\r\n - accounttype type of Questrade account. \r\n Defaults to \"tfsa\".\r\n - verbose level of verbosity represented by the number of characters in \r\n a string. \r\n Defaults to empty string. Maximum verbosity is 2 or \"vv\".\r\nReturns:\r\n Account balances as a Python object representation of the returned json.\r\n\r\n\r\nget_account_executions(self, startdatetime, enddatetime=None, \r\naccounttype='TFSA', verbose='')\r\nDescription:\r\n Generator that provides account executions from the account related to \r\n account type accounttype, between the range specified by startdatetime and \r\n enddatetime. Both objects are datetime objects.\r\nParameters:\r\n - startdatetime datetime object representing the beginning of a range.\r\n - enddatetime datetime object representing the end of a range.\r\n Defaults to now (datetime.datetime.now()) if not specified.\r\n - accounttype type of Questrade account. \r\n Defaults to \"tfsa\".\r\n - verbose level of verbosity represented by the number of characters in \r\n a string.\r\n Defaults to empty string. Maximum verbosity is 3 or \"vvv\".\r\nYields:\r\n Account executions as a Python object representation of the returned json,\r\n between the range startdatetime and enddatetime, in chunks of 30 days.\r\n\r\n\r\nget_account_orders(self, startdatetime, enddatetime=None, accounttype='TFSA', \r\nstatefilter='All', verbose='')\r\nDescription:\r\n Generator that provides the account orders from the account related to \r\n account type accounttype, between the range specified by startdatetime and \r\n enddatetime. Both objects are datetime objects.\r\nParameters:\r\n - startdatetime datetime object representing the beginning of a range.\r\n - enddatetime optional datetime object representing the end of a range.\r\n Defaults to now (datetime.datetime.now()) if not specified.\r\n - accounttype type of Questrade account. \r\n Defaults to \"tfsa\".\r\n - statefilter can be used to specify the state of orders.\r\n It has 3 possible values: Opened, Closed, or All. \r\n Defaults to \"All\".\r\n - verbose level of verbosity represented by the number of characters in a string.\r\n Defaults to empty string. Maximum verbosity is 3 or \"vvv\".\r\nYields:\r\n Account orders as a Python object representation of the returned json,\r\n between the range startdatetime and enddatetime, in chunks of 30 days.\r\n\r\n\r\nget_account_orders_by_ids(self, orderid, accounttype='TFSA', verbose='')\r\nDescription:\r\n Provides the account orders, specified by orderid, from the account related to \r\n account type accounttype.\r\nParameters:\r\n - orderid is a string of one or many orderid numbers. Several orderid numbers are\r\n seperated by commas (with no spaces). A single orderid could be passed as \r\n a numeral instead of a string.\r\n - accounttype type of Questrade account. \r\n Defaults to \"tfsa\".\r\n - verbose level of verbosity represented by the number of characters in a string.\r\n Defaults to empty string. Maximum verbosity is 2 or \"vv\".\r\nReturns:\r\n Account orders as a Python object representation of the returned json.\r\n\r\n\r\nget_account_positions(self, accounttype='TFSA', verbose='')\r\nDefinition:\r\n Provides the account positions for the account related to account type \r\n accounttype.\r\nParamaters:\r\n - accounttype type of Questrade account. \r\n Defaults to \"tfsa\".\r\n - verbose level of verbosity represented by the number of characters in a string.\r\n Defaults to empty string. Maximum verbosity is 2 or \"vv\".\r\nReturns:\r\n Account positions as a Python object representation of the returned json.\r\n\r\n\r\nget_accounts(self, verbose='')\r\nDescription:\r\n Generator that provides the accounts.\r\nParameters:\r\n - verbose level of verbosity represented by the number of characters in a string.\r\n Defaults to empty string. Maximum verbosity is 1 or \"v\".\r\nYields:\r\n All your Questrade accounts as a Python object representation of the returned \r\n json.\r\n\r\n\r\nget_market_candles(self, sid, interval, startdatetime, enddatetime=None, \r\nverbose='')\r\nDescription:\r\n Provides a list of json formatted market candles.\r\nParameters:\r\n - sid symbol id as a string or numeral.\r\n - interval is the Historical Data Granularity.\r\n Examples: \"OneMinute\", \"HalfHour\", \"OneYear\".\r\n - startdatetime datetime object representing the beginning of a range.\r\n - enddatetime datetime object representing the end of a range.\r\n Defaults to now if not specified.\r\n - verbose level of verbosity represented by the number of characters in a string.\r\n Defaults to empty string. Maximum verbosity is 2 or \"vv\".\r\nReturns:\r\n Historical market data in the form of OHLC candlesticks for a specified symbol\r\n as a Python object representation of the returned json.\r\n This call is limited to returning 2,000 candlesticks in a single response.\r\n sid is a symbol id.\r\n\r\n\r\nget_market_quotes(self, ids, verbose='')\r\nDefinition:\r\n Provides market quotes data.\r\nParameter:\r\n - ids Internal symbol identifier. Could be a single value or a string of values.\r\n - verbose level of verbosity represented by the number of characters in a string.\r\n Defaults to empty string. Maximum verbosity is 2 or \"vv\".\r\nReturns:\r\n A single Level 1 market data quote for one or more symbols in json string format\r\n as a Python object representation of the returned json.\r\n IMPORTANT NOTE: Questrade user needs to be subscribed to a real-time data \r\n package, to receive market quotes in real-time, otherwise call to get quote \r\n is considered snap quote and limit per market can be quickly reached. \r\n Without real-time data package, once limit is reached, the response will return \r\n delayed data. (Please check \"delay\" parameter in response always).\r\n\r\n\r\nget_market_quotes_options(self, option_ids, filters=None, verbose='')\r\nDefinition:\r\n Provides market quotes options.\r\nParameters:\r\n - option_ids is a list of stock option ids.\r\n - filters optional list of dictionary items.\r\n - verbose level of verbosity represented by the number of characters in a string.\r\n Defaults to empty string. Maximum verbosity is 2 or \"vv\".\r\nReturns:\r\n A single Level 1 market data quote and Greek data for one or more option symbols\r\n as a Python object representation of the returned json.\r\n\r\n\r\nget_market_quotes_strategies(self, variants, verbose='')\r\nDefinition:\r\n Provides a calculated L1 market data quote for a single or many multi-leg \r\n strategies.\r\nParameter:\r\n - variants is a list of dictionary items.\r\n - verbose level of verbosity represented by the number of characters in a string.\r\n Defaults to empty string. Maximum verbosity is 2 or \"vv\".\r\nReturns:\r\n A calculated L1 market data quote for a single or many multi-leg strategies\r\n as a Python object representation of the returned json.\r\n\r\n\r\nget_markets(self, verbose='')\r\nDescription:\r\n Provides market data.\r\nParameters:\r\n - verbose level of verbosity represented by the number of characters in a string.\r\n Defaults to empty string. Maximum verbosity is 2 or \"vv\".\r\nReturns:\r\n Information about supported markets as a Python object representation of \r\n the returned json.\r\n\r\n\r\nget_new_refresh_token(self, token, server_type, verbose='')\r\nDescription:\r\n Obtains a new refresh token (and new access token) from the Authorization server.\r\n You generally would not need to call this method, as it is potentially called by\r\n Trader during initialization.\r\n Trader will only call this method if the access token has expired.\r\nParameters:\r\n - token the refresh token that is stored in the local file pointed to by rt_file.\r\n - server_type should be \"live\" or \"test\" for your live Questrade account or \r\n your test Questrade account, respectively.\r\n - verbose level of verbosity represented by the number of characters in a string.\r\n Defaults to empty string. Maximum verbosity is 1 or \"v\".\r\n\r\n\r\nget_server_time(self, verbose='')\r\nDescription:\r\n Provides the time from the Questrade API server.\r\nParameters:\r\n - verbose level of verbosity represented by the number of characters in a string.\r\n Defaults to empty string. Maximum verbosity is 2 or \"vv\".\r\nReturns:\r\n The time on the server as a tuple made of a simple datetime object,\r\n as well as in the expected Python object representation of the returned json.\r\n\r\n\r\nget_symbol_options(self, sid, verbose='')\r\nDefinition:\r\n Provides symbol options data.\r\nParameter:\r\n - sid Internal symbol identifier.\r\n - verbose level of verbosity represented by the number of characters in a string.\r\n Defaults to empty string. Maximum verbosity is 2 or \"vv\".\r\nReturns:\r\n An option chain for a particular underlying symbol as a Python object \r\n representation of the returned json.\r\n\r\n\r\nget_symbols_by_ids(self, ids, verbose='')\r\nDefinition:\r\n Provides symbols data from symbol id(s).\r\nParameter:\r\n - ids Internal symbol identifier(s). Could be a single numeric value or a string \r\n of comma-seperated values (with no spaces).\r\n - verbose level of verbosity represented by the number of characters in a string.\r\n Defaults to empty string. Maximum verbosity is 2 or \"vv\".\r\nReturns:\r\n Detailed information about one or more symbol as a Python object representation\r\n of the returned json.\r\n\r\n\r\nget_symbols_by_names(self, names, verbose='')\r\nDefinition:\r\n Provides symbols data from name(s).\r\nParameter:\r\n - names is a string of names seperated by commas (with no spaces).\r\n - verbose level of verbosity represented by the number of characters in a string.\r\n Defaults to empty string. Maximum verbosity is 2 or \"vv\".\r\nReturns:\r\n Detailed information about one or more symbol as a Python object representation\r\n of the returned json.\r\n\r\n\r\nobject_to_qdstr(self, dto, gmt=False)\r\nDescription:\r\n Converts a datetime object to a Questrade datetime string.\r\nParameters:\r\n - dto datetime object.\r\n - gmt optional boolean indicating if datetime is Greenwich Mean Time.\r\n Default value is False.\r\nReturns:\r\n The provided datetime object in Questrade API compatible string format.\r\n Example: \"2011-02-01T00:00:00-05:00\".\r\n If gmt is set to False, time will be in local time.\r\n If gmt is True, the returned time will be considered as gmt time.\r\n\r\n\r\nsearch_symbols(self, prefix, offset=0, verbose='')\r\nDefinition:\r\n Provides symbol(s) data using several search criteria.\r\nParameters:\r\n - prefix Prefix of a symbol or any word in the description.\r\n - offset Offset in number of records from the beginning of a result set.\r\n Default is not to offset.\r\n - verbose level of verbosity represented by the number of characters in a string.\r\n Defaults to empty string. Maximum verbosity is 2 or \"vv\".\r\nReturns:\r\n Symbol(s) data as a Python object representation of the returned json.\r\n\r\n\r\nvalues_to_dobj(self, y, m, d, h=0, mi=0, s=0)\r\nDescription:\r\n Helper method that builds a datetime object.\r\nParameters:\r\n - y integer to be set as the year.\r\n - m intiger to be set as the month.\r\n - d integer to be set as the day.\r\n - h optional integer to be set as the hour. Default value is 0.\r\n - mi optional integer to be set as the minutes. Default value is 0.\r\n - s optional integer to be set as the seconds. Default value is 0.\r\nReturns:\r\n A datetime object from the values provided as parameters.\r\n\r\n\r\nvalues_to_qdstr(self, y, m, d, h=0, mi=0, s=0, gmt=False)\r\nDescription:\r\n Helper method that builds a Questrade datetime string.\r\n - y integer to be set as the year.\r\n - m intiger to be set as the month.\r\n - d integer to be set as the day.\r\n - h optional integer to be set as the hour. Default value is 0.\r\n - mi optional integer to be set as the minutes. Default value is 0.\r\n - s optional integer to be set as the seconds. Default value is 0.\r\n - gmt optional boolean indicating if datetime is Greenwich Mean Time.\r\n Default value is False.\r\nReturns:\r\n The date time and timezone values provided as parameters in Questrade API \r\n compatible string format.\r\n Example: \"2011-02-01T00:00:00-05:00\".\r\n If gmt is set to False, time will be in local time.\r\n If gmt is True, the returned time will be considered as gmt time.\r\n```\r\n\r\n\r\nLet me know if you have any questions: <kaiyoux@gmail.com>\r\n",
"bugtrack_url": null,
"license": "GNU General Public License v3 (GPLv3)",
"summary": "Questrade API wrapper.",
"version": "0.0.7",
"project_urls": {
"Bug Tracker": "https://github.com/kaiyoux/kwess/issues",
"Homepage": "https://github.com/kaiyoux/kwess"
},
"split_keywords": [
"questrade",
" api",
" rest",
" wrapper"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "038756ecd7ffa7b3fd10f5cf98a48bd803e0c04347aceb8194022b36c205a64d",
"md5": "8a17a20daf1c55c8445b13bf3d73c19c",
"sha256": "0bdc927501bcc02c345d9a236132328de7d37789f937d67f7f94713b4c8ffb7e"
},
"downloads": -1,
"filename": "kwess-0.0.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8a17a20daf1c55c8445b13bf3d73c19c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 24443,
"upload_time": "2024-04-02T03:09:13",
"upload_time_iso_8601": "2024-04-02T03:09:13.455722Z",
"url": "https://files.pythonhosted.org/packages/03/87/56ecd7ffa7b3fd10f5cf98a48bd803e0c04347aceb8194022b36c205a64d/kwess-0.0.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a0118c56d05abf38b4b4909a01ce25958cc078b8cda5c19c2e7ed6dfcf9236e7",
"md5": "560d2231d01c346f82f2c0fe85e8b5be",
"sha256": "bab5618bde2a00bf3067f660edb533d8bb6cd4562a726f9ab29606fddd128a0e"
},
"downloads": -1,
"filename": "kwess-0.0.7.tar.gz",
"has_sig": false,
"md5_digest": "560d2231d01c346f82f2c0fe85e8b5be",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 26976,
"upload_time": "2024-04-02T03:09:17",
"upload_time_iso_8601": "2024-04-02T03:09:17.008639Z",
"url": "https://files.pythonhosted.org/packages/a0/11/8c56d05abf38b4b4909a01ce25958cc078b8cda5c19c2e7ed6dfcf9236e7/kwess-0.0.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-02 03:09:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kaiyoux",
"github_project": "kwess",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "kwess"
}