Class: Tradier::Client
- Inherits:
-
Object
- Object
- Tradier::Client
- Includes:
- API::Accounts, API::Markets, API::Orders, API::Watchlists, Configurable
- Defined in:
- lib/tradier/client.rb
Overview
Wrapper for the Tradier REST API
Instance Attribute Summary
Attributes included from Configurable
#access_token, #connection_options, #endpoint, #middleware, #version
Instance Method Summary collapse
-
#delete(path, params = {}) ⇒ Object
Perform an HTTP DELETE request.
-
#get(path, params = {}) ⇒ Object
Perform an HTTP GET request.
-
#initialize(options = {}) ⇒ Tradier::Client
constructor
Initializes a new Client object.
-
#post(path, params = {}) ⇒ Object
Perform an HTTP POST request.
-
#put(path, params = {}) ⇒ Object
Perform an HTTP PUT request.
Methods included from Configurable
#configure, #credentials?, keys, #reset!
Methods included from API::Watchlists
#add_watchlist_item, #create_watchlist, #delete_watchlist, #remove_watchlist_item, #update_watchlist, #update_watchlist_item, #watchlist, #watchlist_item, #watchlists
Methods included from API::Orders
#cancel_order, #create_order, #order, #preview_order, #update_order
Methods included from API::Markets
#calendar, #chains, #clock, #etb, #expirations, #history, #lookup, #markets_session, #quotes, #search, #strikes, #timesales
Methods included from API::Accounts
#balances, #events, #gainloss, #orders, #positions, #profile
Constructor Details
#initialize(options = {}) ⇒ Tradier::Client
Initializes a new Client object
25 26 27 28 29 |
# File 'lib/tradier/client.rb', line 25 def initialize(={}) Tradier::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", [key] || Tradier.instance_variable_get(:"@#{key}")) end end |
Instance Method Details
#delete(path, params = {}) ⇒ Object
Perform an HTTP DELETE request
32 33 34 |
# File 'lib/tradier/client.rb', line 32 def delete(path, params={}) request(:delete, path, params) end |
#get(path, params = {}) ⇒ Object
Perform an HTTP GET request
37 38 39 |
# File 'lib/tradier/client.rb', line 37 def get(path, params={}) request(:get, path, params) end |
#post(path, params = {}) ⇒ Object
Perform an HTTP POST request
42 43 44 |
# File 'lib/tradier/client.rb', line 42 def post(path, params={}) request(:post, path, params) end |
#put(path, params = {}) ⇒ Object
Perform an HTTP PUT request
47 48 49 |
# File 'lib/tradier/client.rb', line 47 def put(path, params={}) request(:put, path, params) end |