Module: QuestradeApi::AccountCall

Included in:
Client
Defined in:
lib/questrade_api/modules/account_call.rb

Instance Method Summary collapse

Instance Method Details

#accountsArray<QuestradeApi::REST::Account>

Fetch all accounts associated with user.

Returns:



23
24
25
# File 'lib/questrade_api/modules/account_call.rb', line 23

def accounts
  QuestradeApi::REST::Account.fetch(authorization)
end

#activities(account_id, params = {}) ⇒ Object



49
50
51
# File 'lib/questrade_api/modules/account_call.rb', line 49

def activities(, params = {})
  QuestradeApi::REST::Activity.fetch(authorization, , params)
end

#balances(account_id) ⇒ OpenStruct(per_currency_balances)

Fetch all balances associated with account.

Parameters:

  • account_id (String)

    to which balances will be fetched.

Returns:

  • (OpenStruct(per_currency_balances))


41
42
43
# File 'lib/questrade_api/modules/account_call.rb', line 41

def balances()
  QuestradeApi::REST::Balance.fetch(authorization, )
end

#executions(account_id, params = {}) ⇒ Object



45
46
47
# File 'lib/questrade_api/modules/account_call.rb', line 45

def executions(, params = {})
  QuestradeApi::REST::Execution.fetch(authorization, , params)
end

#orders(account_id, params = {}) ⇒ Object



53
54
55
# File 'lib/questrade_api/modules/account_call.rb', line 53

def orders(, params = {})
  QuestradeApi::REST::Order.fetch(authorization, , params)
end

#positions(account_id) ⇒ OpenStruct(accounts: Array<QuestradeApi::REST::Position>)

Fetch all positions associated with account.

Parameters:

  • account_id (String)

    to which positions will be fetched.

Returns:



32
33
34
# File 'lib/questrade_api/modules/account_call.rb', line 32

def positions()
  QuestradeApi::REST::Position.fetch(authorization, )
end

#timeDateTime, Faraday::Response

Fetch current server time.

Returns:

  • (DateTime)

    if no issues to call /time endpoint occurs.

  • (Faraday::Response)

    if current server time cannot be fetched.



15
16
17
18
# File 'lib/questrade_api/modules/account_call.rb', line 15

def time
  time = QuestradeApi::REST::Time.new(authorization)
  time.fetch
end