Module: QuestradeClient::Account
- Included in:
- Client
- Defined in:
- lib/questrade_client/account.rb
Instance Method Summary collapse
-
#accounts ⇒ Array[Hash]
Retrieves the accounts associated with the user on behalf of which the API client is authorized.
-
#activities(id) ⇒ Array[Hash]
Retrieve account activities, including cash transactions, dividends, trades, etc.
-
#balances(id) ⇒ Hash
Retrieves per-currency and combined balances for a specified account.
-
#executions(id) ⇒ Array[Hash]
Retrieves executions for a specific account.
-
#orders(id, orderid = nil) ⇒ Array[Hash]
Retrieves orders for specified account.
-
#positions(id) ⇒ Array[Hash]
Retrieves positions in a specified account.
-
#time ⇒ DateTime
Retrieves current server time.
Instance Method Details
#accounts ⇒ Array[Hash]
Retrieves the accounts associated with the user on behalf of which the API client is authorized.
Docs: www.questrade.com/api/documentation/rest-operations/account-calls/accounts
22 23 24 |
# File 'lib/questrade_client/account.rb', line 22 def accounts get('/accounts')['accounts'] end |
#activities(id) ⇒ Array[Hash]
Retrieve account activities, including cash transactions, dividends, trades, etc.
Docs: www.questrade.com/api/documentation/rest-operations/account-calls/accounts-id-activities
FIXME: Add support for start and end time
88 89 90 |
# File 'lib/questrade_client/account.rb', line 88 def activities(id) get("/accounts/#{id}/activities")['activities'] end |
#balances(id) ⇒ Hash
Retrieves per-currency and combined balances for a specified account.
Docs: www.questrade.com/api/documentation/rest-operations/account-calls/accounts-id-balances
46 47 48 |
# File 'lib/questrade_client/account.rb', line 46 def balances(id) get("/accounts/#{id}/balances") end |
#executions(id) ⇒ Array[Hash]
Retrieves executions for a specific account.
Docs: www.questrade.com/api/documentation/rest-operations/account-calls/accounts-id-executions
FIXME: Add support for start and end time
59 60 61 |
# File 'lib/questrade_client/account.rb', line 59 def executions(id) get("/accounts/#{id}/executions")['executions'] end |
#orders(id, orderid = nil) ⇒ Array[Hash]
Retrieves orders for specified account
Docs: www.questrade.com/api/documentation/rest-operations/account-calls/accounts-id-orders
FIXME: Add support for start and end time FIXME: Add support for statefilter
74 75 76 |
# File 'lib/questrade_client/account.rb', line 74 def orders(id, orderid = nil) get("/accounts/#{id}/orders#{orderid ? "/#{orderid}" : ''}")['orders'] end |
#positions(id) ⇒ Array[Hash]
Retrieves positions in a specified account.
Docs: www.questrade.com/api/documentation/rest-operations/account-calls/accounts-id-positions
34 35 36 |
# File 'lib/questrade_client/account.rb', line 34 def positions(id) get("/accounts/#{id}/positions")['positions'] end |
#time ⇒ DateTime
Retrieves current server time.
Docs: www.questrade.com/api/documentation/rest-operations/account-calls/time
11 12 13 |
# File 'lib/questrade_client/account.rb', line 11 def time DateTime.parse(get('/time')['time']) end |