Class: Schwab::Client
- Inherits:
-
Object
- Object
- Schwab::Client
- Includes:
- Authentication, Error
- Defined in:
- lib/schwab/client.rb
Instance Attribute Summary
Attributes included from Authentication
#access_token, #access_token_expires_at, #authorization_code, #client_id, #redirect_uri, #refresh_token, #refresh_token_expires_at, #secret
Instance Method Summary collapse
- #get_instrument(symbol, projection) ⇒ Object
- #get_price_history(symbol, **options) ⇒ Object
- #get_quotes(symbols, **options) ⇒ Object
-
#initialize(**args) ⇒ Client
constructor
A new instance of Client.
Methods included from Error
Methods included from Authentication
#authorization_header_token, #default_headers, #refresh_access_token, #request_access_token
Methods included from Util
Constructor Details
#initialize(**args) ⇒ Client
Returns a new instance of Client.
14 15 16 17 18 19 20 21 22 |
# File 'lib/schwab/client.rb', line 14 def initialize(**args) @access_token = args[:access_token] @refresh_token = args[:refresh_token] @access_token_expires_at = args[:access_token_expires_at] @refresh_token_expires_at = args[:refresh_token_expires_at] @client_id = args[:client_id] || raise_error('client_id is required!') @secret = args[:secret] || raise_error('client_id is required!') @redirect_uri = args[:redirect_uri] || raise_error('redirect_uri is required!') end |
Instance Method Details
#get_instrument(symbol, projection) ⇒ Object
24 25 26 |
# File 'lib/schwab/client.rb', line 24 def get_instrument(symbol, projection) Operations::GetInstrument.new(self).call(symbol, projection:) end |
#get_price_history(symbol, **options) ⇒ Object
28 29 30 |
# File 'lib/schwab/client.rb', line 28 def get_price_history(symbol, **) Operations::GetPriceHistory.new(self).call(symbol, **) end |
#get_quotes(symbols, **options) ⇒ Object
32 33 34 |
# File 'lib/schwab/client.rb', line 32 def get_quotes(symbols, **) Operations::GetQuotes.new(self).call(symbols:, **) end |