Rubygem for interacting with the Tradier API.
gem install tradier
Create an instance of a Tradier::Client
:
require 'tradier'
client = Tradier::Client.new(:access_token => 'token')
Orders can be placed using the create_order
method. Here are some basic examples:
Place an equity order:
client.create_order({
:account => '123456789'
:class => 'equity',
:symbol => 'AAPL',
:duration => 'day',
:side => 'buy',
:quantity => '100',
:type => 'market'
})
Placing an option order:
client.create_order({
:account => '123456789'
:class => 'option',
:symbol => 'AAPL',
:option_symbol => 'AAPL140118C00195000',
:duration => 'day',
:side => 'buy',
:quantity => '100',
:type => 'market'
})
For a complete list of the types of orders accepted, refer to Tradier's trading API documentation
Obtain a user's profile/accounts:
client.profile
Obtain an account's balances:
client.balance('12345678')
Obtain an account's positions
client.positions('12345678')
Obtain positions for all of a user's accounts:
client.positions
Obtain an account's order
client.orders('12345678')
Obtain order for all of a user's accounts:
client.orders
To obtain a quote, simply request:
client.quote('SYMBOL')
Or multiple quotes at one time:
client.quote(['SYMBOL', 'SYMBOL2'])
Option chains can be requested using a symbol and expiration:
client.chain('SYMBOL', :expiration => '2013-11-14')
Refer to the complete documentation for a complete listing of methods and classes.
Copyright (c) 2013 Tradier Inc. See LICENSE for detail.