Module: Tradier::API::Accounts
Instance Method Summary collapse
- #balances(account_number = nil, options = {}) ⇒ Object (also: #balance)
- #events(account_number = nil, options = {}) ⇒ Object (also: #history)
- #gainloss(account_number = nil, options = {}) ⇒ Object
- #orders(account_number = nil, options = {}) ⇒ Object
- #positions(account_number = nil, options = {}) ⇒ Object (also: #position)
-
#profile ⇒ Tradier::Profile
(also: #user_profile)
The user's profile.
Instance Method Details
#balances ⇒ Array<Tradier::Balance> #balances(account_number) ⇒ Tradier::Balance Also known as: balance
30 31 32 33 34 35 36 |
# File 'lib/tradier/api/accounts.rb', line 30 def balances(account_number=nil, ={}) if account_number object_from_response(Tradier::Balance, :get, "/accounts/#{account_number}/balances", ) else object_from_response(Tradier::API::Utils::Balance, :get, "/user/balances", ).body end end |
#events ⇒ Array<Tradier::Account> #events(account_number) ⇒ Array<Tradier::Event> #events(account_number, options) ⇒ Object Also known as: history
115 116 117 118 119 120 121 |
# File 'lib/tradier/api/accounts.rb', line 115 def events(account_number=nil, ={}) if account_number object_from_response(Tradier::API::Utils::Event, :get, "/accounts/#{account_number}/history", ).body else object_from_response(Tradier::API::Utils::Account, :get, '/user/history', ).body end end |
#gainloss ⇒ Array<Tradier::Account> #gainloss(account_number) ⇒ Array<Tradier::Position>
92 93 94 95 96 97 98 |
# File 'lib/tradier/api/accounts.rb', line 92 def gainloss(account_number=nil, ={}) if account_number object_from_response(Tradier::API::Utils::Gainloss, :get, "/accounts/#{account_number}/gainloss", ).body else object_from_response(Tradier::API::Utils::Account, :get, '/user/gainloss', ).body end end |
#orders ⇒ Array<Tradier::Account> #orders(account_number) ⇒ Array<Tradier::Order>
72 73 74 75 76 77 78 |
# File 'lib/tradier/api/accounts.rb', line 72 def orders(account_number=nil, ={}) if account_number object_from_response(Tradier::API::Utils::Order, :get, "/accounts/#{account_number}/orders", ).body else object_from_response(Tradier::API::Utils::Account, :get, '/user/orders', ).body end end |
#positions ⇒ Array<Tradier::Account> #positions(account_number) ⇒ Array<Tradier::Position> Also known as: position
51 52 53 54 55 56 57 |
# File 'lib/tradier/api/accounts.rb', line 51 def positions(account_number=nil, ={}) if account_number object_from_response(Tradier::API::Utils::Position, :get, "/accounts/#{account_number}/positions", ).body else object_from_response(Tradier::API::Utils::Account, :get, '/user/positions', ).body end end |
#profile ⇒ Tradier::Profile Also known as: user_profile
Returns The user's profile.
13 14 15 |
# File 'lib/tradier/api/accounts.rb', line 13 def profile object_from_response(Tradier::Profile, :get, '/user/profile', {}) end |