robinhood-ruby 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +7 -0
  2. data/.DS_Store +0 -0
  3. data/.coveralls.yml +1 -0
  4. data/.github/robinhood-ruby.png +0 -0
  5. data/.gitignore +9 -0
  6. data/.rspec +2 -0
  7. data/.travis.yml +15 -0
  8. data/CODE_OF_CONDUCT.md +74 -0
  9. data/Gemfile +11 -0
  10. data/Guardfile +5 -0
  11. data/LICENSE.txt +21 -0
  12. data/README.md +520 -0
  13. data/Rakefile +8 -0
  14. data/bin/console +14 -0
  15. data/bin/setup +8 -0
  16. data/example/.DS_Store +0 -0
  17. data/example/robinhood-sample/.DS_Store +0 -0
  18. data/example/robinhood-sample/.env.example +2 -0
  19. data/example/robinhood-sample/.gitignore +19 -0
  20. data/example/robinhood-sample/Gemfile +16 -0
  21. data/example/robinhood-sample/Gemfile.lock +164 -0
  22. data/example/robinhood-sample/README.MD +7 -0
  23. data/example/robinhood-sample/Rakefile +6 -0
  24. data/example/robinhood-sample/app/assets/images/.keep +0 -0
  25. data/example/robinhood-sample/app/assets/javascripts/application.js +16 -0
  26. data/example/robinhood-sample/app/assets/stylesheets/application.css +15 -0
  27. data/example/robinhood-sample/app/controllers/application_controller.rb +5 -0
  28. data/example/robinhood-sample/app/controllers/concerns/.keep +0 -0
  29. data/example/robinhood-sample/app/helpers/application_helper.rb +2 -0
  30. data/example/robinhood-sample/app/mailers/.keep +0 -0
  31. data/example/robinhood-sample/app/models/.keep +0 -0
  32. data/example/robinhood-sample/app/models/concerns/.keep +0 -0
  33. data/example/robinhood-sample/app/views/layouts/application.html.erb +14 -0
  34. data/example/robinhood-sample/bin/bundle +3 -0
  35. data/example/robinhood-sample/bin/rails +9 -0
  36. data/example/robinhood-sample/bin/rake +9 -0
  37. data/example/robinhood-sample/bin/setup +29 -0
  38. data/example/robinhood-sample/bin/spring +16 -0
  39. data/example/robinhood-sample/config.ru +4 -0
  40. data/example/robinhood-sample/config/.DS_Store +0 -0
  41. data/example/robinhood-sample/config/application.rb +26 -0
  42. data/example/robinhood-sample/config/boot.rb +3 -0
  43. data/example/robinhood-sample/config/database.yml +25 -0
  44. data/example/robinhood-sample/config/environment.rb +5 -0
  45. data/example/robinhood-sample/config/environments/development.rb +41 -0
  46. data/example/robinhood-sample/config/environments/production.rb +79 -0
  47. data/example/robinhood-sample/config/environments/test.rb +42 -0
  48. data/example/robinhood-sample/config/initializers/.DS_Store +0 -0
  49. data/example/robinhood-sample/config/initializers/assets.rb +11 -0
  50. data/example/robinhood-sample/config/initializers/backtrace_silencers.rb +7 -0
  51. data/example/robinhood-sample/config/initializers/cookies_serializer.rb +3 -0
  52. data/example/robinhood-sample/config/initializers/filter_parameter_logging.rb +4 -0
  53. data/example/robinhood-sample/config/initializers/inflections.rb +16 -0
  54. data/example/robinhood-sample/config/initializers/mime_types.rb +4 -0
  55. data/example/robinhood-sample/config/initializers/robinhood.rb +1 -0
  56. data/example/robinhood-sample/config/initializers/session_store.rb +3 -0
  57. data/example/robinhood-sample/config/initializers/wrap_parameters.rb +14 -0
  58. data/example/robinhood-sample/config/locales/en.yml +23 -0
  59. data/example/robinhood-sample/config/routes.rb +56 -0
  60. data/example/robinhood-sample/config/secrets.yml +22 -0
  61. data/example/robinhood-sample/db/seeds.rb +7 -0
  62. data/example/robinhood-sample/lib/.DS_Store +0 -0
  63. data/example/robinhood-sample/lib/assets/.keep +0 -0
  64. data/example/robinhood-sample/lib/tasks/.keep +0 -0
  65. data/example/robinhood-sample/log/.keep +0 -0
  66. data/example/robinhood-sample/public/404.html +67 -0
  67. data/example/robinhood-sample/public/422.html +67 -0
  68. data/example/robinhood-sample/public/500.html +66 -0
  69. data/example/robinhood-sample/public/favicon.ico +0 -0
  70. data/example/robinhood-sample/public/robots.txt +5 -0
  71. data/example/robinhood-sample/test/controllers/.keep +0 -0
  72. data/example/robinhood-sample/test/fixtures/.keep +0 -0
  73. data/example/robinhood-sample/test/helpers/.keep +0 -0
  74. data/example/robinhood-sample/test/integration/.keep +0 -0
  75. data/example/robinhood-sample/test/mailers/.keep +0 -0
  76. data/example/robinhood-sample/test/models/.keep +0 -0
  77. data/example/robinhood-sample/test/test_helper.rb +10 -0
  78. data/example/robinhood-sample/vendor/assets/javascripts/.keep +0 -0
  79. data/example/robinhood-sample/vendor/assets/stylesheets/.keep +0 -0
  80. data/lib/.DS_Store +0 -0
  81. data/lib/robinhood-ruby.rb +37 -0
  82. data/lib/robinhood-ruby/.DS_Store +0 -0
  83. data/lib/robinhood-ruby/rest/.DS_Store +0 -0
  84. data/lib/robinhood-ruby/rest/api.rb +184 -0
  85. data/lib/robinhood-ruby/rest/client.rb +120 -0
  86. data/lib/robinhood-ruby/util.rb +4 -0
  87. data/lib/robinhood-ruby/util/.DS_Store +0 -0
  88. data/lib/robinhood-ruby/util/configuration.rb +7 -0
  89. data/lib/robinhood-ruby/util/request.rb +51 -0
  90. data/lib/robinhood-ruby/version.rb +3 -0
  91. data/robinhood-ruby-0.3.2.gem +0 -0
  92. data/robinhood-ruby.gemspec +52 -0
  93. metadata +346 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3fe7fd7a3013d786338e3c42c8bc956fecbc05b5
4
+ data.tar.gz: 594923baf62ffaa3d4cd2d13a6d7ff2949d87412
5
+ SHA512:
6
+ metadata.gz: 55d9fe87708aeb1762c2cf1c1af62026fc4698f3b13a6e62b096f073ec2d4115541e4c7ef2947e7e783acc518413aafce295b3cc6af53f2ff7d9aa8534deb65a
7
+ data.tar.gz: 6dfcda987e230bb2797c2e58fe579aabee4e1375c14abbb180e101d39b82a9ad3bbbeef2d2fc7084900eaa3f6d34da88cb2596c8bf7b2d728d18c747161ea271
data/.DS_Store ADDED
Binary file
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
Binary file
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,15 @@
1
+ language: ruby
2
+ cache: bundler
3
+
4
+ before_install: gem install bundler -v 1.13.6
5
+ rvm:
6
+ - 2.3.1
7
+
8
+ script: 'bundle exec rake'
9
+
10
+ notifications:
11
+ email:
12
+ recipients:
13
+ - rememberlenny@gmail.com
14
+ on_failure: change
15
+ on_success: never
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at rememberlenny@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in robinhood.gemspec
4
+ gemspec
5
+
6
+ group :test do
7
+ gem 'rake', '~> 10.1'
8
+ gem 'rspec', '~> 3.0'
9
+ gem 'fakeweb', '~> 1.3'
10
+ gem 'rack', '~> 1.3'
11
+ end
data/Guardfile ADDED
@@ -0,0 +1,5 @@
1
+ guard :rspec, cmd: 'rspec' do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
+ watch('spec/spec_helper.rb') { "spec" }
5
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Leonard Bogdonoff
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,520 @@
1
+ <h1><img src="https://raw.githubusercontent.com/rememberlenny/robinhood-ruby/master/.github/robinhood-ruby.png"/></h1>
2
+
3
+ [![Coverage Status](https://coveralls.io/repos/github/rememberlenny/robinhood-ruby/badge.svg?branch=master)](https://coveralls.io/github/rememberlenny/robinhood-ruby?branch=master)
4
+
5
+ # robinhood-ruby
6
+
7
+ A module to make trades with the private Robinhood API. Using this API is not encouraged, since it's not officially available and it has been reverse engineered. See [@Sanko's](https://github.com/Sanko) [Unofficial Documentation](https://github.com/sanko/Robinhood) for more information.
8
+
9
+ FYI [Robinhood's Terms and Conditions](https://brokerage-static.s3.amazonaws.com/assets/robinhood/legal/Robinhood%20Terms%20and%20Conditions.pdf)
10
+
11
+ <!-- toc -->
12
+ * [Features](#features)
13
+ * [Installation](#installation)
14
+ * [Usage](#usage)
15
+ * [API](#api)
16
+ * [`investment_profile`](#investment-profilecallback)
17
+ * [`instruments(symbol)`](#instrumentssymbol-callback)
18
+ * [`quote_data(stock) # Not authenticated`](#quote-datastock-callback-not-authenticated)
19
+ * [`accounts`](#accountscallback)
20
+ * [`user`](#usercallback)
21
+ * [`dividends`](#dividendscallback)
22
+ * [`orders`](#orderscallback)
23
+ * [`place_buy_order(options)`](#place-buy-orderoptions-callback)
24
+ * [`trigger`](#trigger)
25
+ * [`time`](#time)
26
+ * [`place_sell_order(options)`](#place-sell-orderoptions-callback)
27
+ * [`trigger`](#trigger)
28
+ * [`time`](#time)
29
+ * [`fundamentals(symbol)`](#fundamentalssymbol-callback)
30
+ * [Response](#response)
31
+ * [`cancel_order(order)`](#cancel-orderorder-callback)
32
+ * [`watchlists(name)`](#watchlistsname-callback)
33
+ * [`create_watch_list(name)`](#create-watch-listname-callback)
34
+ * [`sp500_up`](#sp500-upcallback)
35
+ * [`sp500_down`](#sp500-downcallback)
36
+ * [`splits(instrument)`](#splitsinstrument-callback)
37
+ * [`historicals(symbol, intv, span)`](#historicalssymbol-intv-span-callback)
38
+ * [`url(url)`](#urlurl-callback)
39
+ * [Contributors](#contributors)
40
+
41
+ ## Features
42
+
43
+ * Quote Data
44
+ * Buy, Sell Orders (not yet)
45
+ * Daily Fundamentals
46
+ * Daily, Weekly, Monthly Historicals
47
+
48
+ ## Installation
49
+
50
+ Add this line to your application's Gemfile:
51
+
52
+ ```ruby
53
+ gem 'robinhood-ruby'
54
+ ```
55
+
56
+ And then execute:
57
+
58
+ $ bundle
59
+
60
+ Or install it yourself as:
61
+
62
+ $ gem install robinhood-ruby
63
+
64
+ ## Usage
65
+
66
+ ```ruby
67
+
68
+ require 'rubygems' # not necessary with ruby 1.9 but included for completeness
69
+ require 'robinhood-ruby' # if not loaded through Gemfile
70
+
71
+ # The username and password you use to sign into the robinhood app.
72
+ username = 'username'
73
+ password = 'password'
74
+
75
+ # set up a client to talk to the Robinhood REST API
76
+ @robinhood = Robinhood::REST::Client(username, password)
77
+
78
+ ```
79
+
80
+ ## API
81
+
82
+ Before using these methods, make sure you have initialized Robinhood using the snippet above.
83
+
84
+
85
+ ### `investment_profile`
86
+ Get the current user's investment profile.
87
+
88
+ ```ruby
89
+ @robinhood = Robinhood::REST::Client(username, password)
90
+ investment_profile = @robinhood.investment_profile
91
+ puts(investment_profile)
92
+
93
+ # { annual_income: '25000_39999',
94
+ # investment_experience: 'no_investment_exp',
95
+ # updated_at: '2015-06-24T17:14:53.593009Z',
96
+ # risk_tolerance: 'low_risk_tolerance',
97
+ # total_net_worth: '0_24999',
98
+ # liquidity_needs: 'very_important_liq_need',
99
+ # investment_objective: 'income_invest_obj',
100
+ # source_of_funds: 'savings_personal_income',
101
+ # user: 'https://api.robinhood.com/user/',
102
+ # suitability_verified: true,
103
+ # tax_bracket: '',
104
+ # time_horizon: 'short_time_horizon',
105
+ # liquid_net_worth: '0_24999' }
106
+ ```
107
+
108
+
109
+ ### `instruments(symbol)`
110
+
111
+ ```ruby
112
+ @robinhood = Robinhood::REST::Client(username, password)
113
+ instruments = @robinhood.instruments('AAPL')
114
+ puts(instruments)
115
+
116
+ # { previous: null,
117
+ # results:
118
+ # [ { min_tick_size: null,
119
+ # splits: 'https://api.robinhood.com/instruments/450dfc6d-5510-4d40-abfb-f633b7d9be3e/splits/',
120
+ # margin_initial_ratio: '0.5000',
121
+ # url: 'https://api.robinhood.com/instruments/450dfc6d-5510-4d40-abfb-f633b7d9be3e/',
122
+ # quote: 'https://api.robinhood.com/quotes/AAPL/',
123
+ # symbol: 'AAPL',
124
+ # bloomberg_unique: 'EQ0010169500001000',
125
+ # list_date: '1990-01-02',
126
+ # fundamentals: 'https://api.robinhood.com/fundamentals/AAPL/',
127
+ # state: 'active',
128
+ # day_trade_ratio: '0.2500',
129
+ # tradeable: true,
130
+ # maintenance_ratio: '0.2500',
131
+ # id: '450dfc6d-5510-4d40-abfb-f633b7d9be3e',
132
+ # market: 'https://api.robinhood.com/markets/XNAS/',
133
+ # name: 'Apple Inc. - Common Stock' } ],
134
+ # next: null }
135
+ ```
136
+
137
+
138
+ Get the user's instruments for a specified stock.
139
+
140
+ ### `quote_data(stock) // Not authenticated`
141
+
142
+ Get the user's quote data for a specified stock.
143
+
144
+ ```ruby
145
+ @robinhood = Robinhood::REST::Client(username, password)
146
+ quote_data = @robinhood.quote_data('AAPL')
147
+ puts(quote_data)
148
+
149
+ #{
150
+ # results: [
151
+ # {
152
+ # ask_price: String, // Float number in a String, e.g. '735.7800'
153
+ # ask_size: Number, // Integer
154
+ # bid_price: String, // Float number in a String, e.g. '731.5000'
155
+ # bid_size: Number, // Integer
156
+ # last_trade_price: String, // Float number in a String, e.g. '726.3900'
157
+ # last_extended_hours_trade_price: String, // Float number in a String, e.g. '735.7500'
158
+ # previous_close: String, // Float number in a String, e.g. '743.6200'
159
+ # adjusted_previous_close: String, // Float number in a String, e.g. '743.6200'
160
+ # previous_close_date: String, // YYYY-MM-DD e.g. '2016-01-06'
161
+ # symbol: String, // e.g. 'AAPL'
162
+ # trading_halted: Boolean,
163
+ # updated_at: String, // YYYY-MM-DDTHH:MM:SS e.g. '2016-01-07T21:00:00Z'
164
+ # }
165
+ # ]
166
+ #}
167
+ ```
168
+
169
+ ### `accounts`
170
+
171
+ ```ruby
172
+ @robinhood = Robinhood::REST::Client(username, password)
173
+ accounts = @robinhood.accounts
174
+ puts(accounts)
175
+ #{ previous: null,
176
+ # results:
177
+ # [ { deactivated: false,
178
+ # updated_at: '2016-03-11T20:37:15.971253Z',
179
+ # margin_balances: [Object],
180
+ # portfolio: 'https://api.robinhood.com/accounts/asdf/portfolio/',
181
+ # cash_balances: null,
182
+ # withdrawal_halted: false,
183
+ # cash_available_for_withdrawal: '692006.6600',
184
+ # type: 'margin',
185
+ # sma: '692006.6600',
186
+ # sweep_enabled: false,
187
+ # deposit_halted: false,
188
+ # buying_power: '692006.6600',
189
+ # user: 'https://api.robinhood.com/user/',
190
+ # max_ach_early_access_amount: '1000.00',
191
+ # cash_held_for_orders: '0.0000',
192
+ # only_position_closing_trades: false,
193
+ # url: 'https://api.robinhood.com/accounts/asdf/',
194
+ # positions: 'https://api.robinhood.com/accounts/asdf/positions/',
195
+ # created_at: '2015-06-17T14:53:36.928233Z',
196
+ # cash: '692006.6600',
197
+ # sma_held_for_orders: '0.0000',
198
+ # account_number: 'asdf',
199
+ # uncleared_deposits: '0.0000',
200
+ # unsettled_funds: '0.0000' } ],
201
+ # next: null }
202
+ ```
203
+
204
+
205
+ Get the user's accounts.
206
+
207
+ ### `user`
208
+ Get the user information.
209
+
210
+ ```ruby
211
+ @robinhood = Robinhood::REST::Client(username, password)
212
+ user = @robinhood.user
213
+ puts(user)
214
+ ```
215
+
216
+ ### `dividends`
217
+
218
+ Get the user's dividends information.
219
+ ```ruby
220
+ @robinhood = Robinhood::REST::Client(username, password)
221
+ dividends = @robinhood.dividends
222
+ puts(dividends)
223
+ ```
224
+
225
+
226
+ ### `orders`
227
+
228
+ Get the user's orders information.
229
+ ```ruby
230
+ @robinhood = Robinhood::REST::Client(username, password)
231
+ orders = @robinhood.orders
232
+ puts(orders)
233
+ ```
234
+ ### `place_buy_order(options)`
235
+
236
+ Place a buy order on a specified stock.
237
+
238
+ ```ruby
239
+ @robinhood = Robinhood::REST::Client(username, password)
240
+ options = {
241
+ "type": 'limit',
242
+ "quantity": 1,
243
+ "bid_price": 1.00,
244
+ "instrument": {
245
+ "url": String,
246
+ "symbol": String
247
+ }
248
+ # # Optional:
249
+ # "trigger": String, # Defaults to "gfd" (Good For Day)
250
+ # "time": String, # Defaults to "immediate"
251
+ # "type": String # Defaults to "market"
252
+ }
253
+ @robinhood.place_buy_order(options)
254
+ ```
255
+
256
+ For the Optional ones, the values can be:
257
+
258
+ *[Disclaimer: This is an unofficial API based on reverse engineering, and the following option values have not been confirmed]*
259
+
260
+ #### `trigger`
261
+
262
+ A *[trade trigger](http://www.investopedia.com/terms/t/trade-trigger.asp)* is usually a market condition, such as a rise or fall in the price of an index or security.
263
+
264
+ Values can be:
265
+
266
+ * `gfd`: Good For Day
267
+ * `gtc`: Good Till Cancelled
268
+ * `oco`: Order Cancels Other
269
+
270
+ #### `time`
271
+
272
+ The *[time in force](http://www.investopedia.com/terms/t/timeinforce.asp?layout=infini&v=3A)* for an order defines the length of time over which an order will continue working before it is canceled.
273
+
274
+ Values can be:
275
+
276
+ * `immediate` : The order will be cancelled unless it is fulfilled immediately.
277
+ * `day` : The order will be cancelled at the end of the trading day.
278
+
279
+ ### `place_sell_order(options)`
280
+
281
+ Place a sell order on a specified stock.
282
+
283
+ ```ruby
284
+ @robinhood = Robinhood::REST::Client(username, password)
285
+ options = {
286
+ "type": 'limit',
287
+ "quantity": 1,
288
+ "bid_price": 1.00,
289
+ "instrument": {
290
+ "url": String,
291
+ "symbol": String
292
+ },
293
+ # # Optional:
294
+ # "trigger": String, # Defaults to "gfd" (Good For Day)
295
+ # "time": String, # Defaults to "immediate"
296
+ # "type": String # Defaults to "market"
297
+ }
298
+ @robinhood.place_sell_order(options)
299
+
300
+ ```
301
+
302
+ For the Optional ones, the values can be:
303
+
304
+ *[Disclaimer: This is an unofficial API based on reverse engineering, and the following option values have not been confirmed]*
305
+
306
+ #### `trigger`
307
+
308
+ A *[trade trigger](http://www.investopedia.com/terms/t/trade-trigger.asp)* is usually a market condition, such as a rise or fall in the price of an index or security.
309
+
310
+ Values can be:
311
+
312
+ * `gfd`: Good For Day
313
+ * `gtc`: Good Till Cancelled
314
+ * `oco`: Order Cancels Other
315
+
316
+ #### `time`
317
+
318
+ The *[time in force](http://www.investopedia.com/terms/t/timeinforce.asp?layout=infini&v=3A)* for an order defines the length of time over which an order will continue working before it is canceled.
319
+
320
+ Values can be:
321
+
322
+ * `immediate` : The order will be cancelled unless it is fulfilled immediately.
323
+ * `day` : The order will be cancelled at the end of the trading day.
324
+
325
+ ### `fundamentals(symbol)`
326
+
327
+ Get fundamental data about a symbol.
328
+
329
+ #### Response
330
+
331
+ An object containing information about the symbol:
332
+
333
+ ```ruby
334
+ @robinhood = Robinhood::REST::Client(username, password)
335
+ fundamentals = @robinhood.fundamentals("SBPH")
336
+ puts(fundamentals)
337
+
338
+ #{ // Example for SBPH
339
+ # average_volume: string, // "14381.0215"
340
+ # description: string, // "Spring Bank Pharmaceuticals, Inc. [...]"
341
+ # dividend_yield: string, // "0.0000"
342
+ # high: string, // "12.5300"
343
+ # high_52_weeks: string, // "13.2500"
344
+ # instrument: string, // "https://api.robinhood.com/instruments/42e07e3a-ca7a-4abc-8c23-de49cb657c62/"
345
+ # low: string, // "11.8000"
346
+ # low_52_weeks: string, // "7.6160"
347
+ # market_cap: string, // "94799500.0000"
348
+ # open: string, // "12.5300"
349
+ # pe_ratio: string, // null (price/earnings ratio)
350
+ # volume: string // "4119.0000"
351
+ #}
352
+
353
+ ```
354
+
355
+ ### `watchlists(name)`
356
+ ```ruby
357
+ @robinhood = Robinhood::REST::Client(username, password)
358
+ watchlists = @robinhood.watchlists
359
+ puts(watchlists)
360
+
361
+ # { previous: null,
362
+ # results:
363
+ # [ { url: 'https://api.robinhood.com/watchlists/Default/',
364
+ # user: 'https://api.robinhood.com/user/',
365
+ # name: 'Default' } ],
366
+ # }
367
+ ```
368
+
369
+ ### `create_watch_list(name)`
370
+ ```
371
+ # Your account type must support multiple watchlists to use this endpoint otherwise will get { detail: 'Request was throttled.' } and watchlist is not created.
372
+ @robinhood = Robinhood::REST::Client(username, password)
373
+ watchlist = @robinhood.create_watch_list('Technology)
374
+ puts(watchlist)
375
+ // {
376
+ // "url": "https://api.robinhood.com/watchlists/Technology/",
377
+ // "user": "https://api.robinhood.com/user/",
378
+ // "name": "Technology"
379
+ // }
380
+ ```
381
+
382
+ ### `sp500_up`
383
+ ```ruby
384
+ @robinhood = Robinhood::REST::Client(username, password)
385
+ sp500_up = @robinhood.sp500_up
386
+ puts(sp500_up)
387
+
388
+ #{ count: 10,
389
+ # next: null,
390
+ # previous: null,
391
+ # results:
392
+ # [ { instrument_url: 'https://api.robinhood.com/instruments/adbc3ce0-dd0d-4a7a-92e0-88c1f127cbcb/',
393
+ # symbol: 'NEM',
394
+ # updated_at: '2016-09-21T13:03:32.310184Z',
395
+ # price_movement: [{ market_hours_last_movement_pct: '7.55', market_hours_last_price: '41.0300' }],
396
+ # description: 'Newmont Mining Corp. is a gold producer, which is engaged in the acquisition, exploration and production of gold and copper properties in U.S., Australia, Peru, Indonesia, Ghana, Canada, New Zealand and Mexico. The company\'s operating segments include North America, South America, Asia Pacific and Africa. The North America segment consists of Nevada in the United States, La Herradura in Mexico and Hope Bay in Canada. The South America segment consists of Yanacocha and Conga in Peru. The Asia Pacific segment consists of Boddington in Australia, Batu Hijau in Indonesia and other smaller operations in Australia and New Zealand. The Africa segment consists of Ahafo and Akyem in Ghana. The company was founded by William Boyce Thompson on May 2, 1921 and is headquartered in Greenwood Village, CO.' },
397
+ # { instrument_url: 'https://api.robinhood.com/instruments/809adc21-ef75-4c3d-9c0e-5f9a167f235b/',
398
+ # symbol: 'ADBE',
399
+ # updated_at: '2016-09-21T13:01:31.748590Z',
400
+ # price_movement: [{ market_hours_last_movement_pct: '7.55', market_hours_last_price: '41.0300' }],
401
+ # description: 'Adobe Systems, Inc. provides digital marketing and digital media solutions. The company operates its business through three segments: Digital Media, Digital Marketing, and Print and Publishing. The Digital Media segment offers creative cloud services, which allow members to download and install the latest versions of products, such as Adobe Photoshop, Adobe Illustrator, Adobe Premiere Pro, Adobe Photoshop Lightroom and Adobe InDesign, as well as utilize other tools, such as Adobe Acrobat. This segment also offers other tools and services, including hobbyist products, such as Adobe Photoshop Elements and Adobe Premiere Elements, Adobe Digital Publishing Suite, Adobe PhoneGap, Adobe Typekit, as well as mobile apps, such as Adobe Photoshop Mix, Adobe Photoshop Sketch and Adobe Premiere Clip that run on tablets and mobile devices. The Digital Media serves professionals, including graphic designers, production artists, web designers and developers, user interface designers, videographers, motion graphic artists, prepress professionals, video game developers, mobile application developers, students and administrators. The Digital Marketing segment offers various solutions, including analytics, social marketing, targeting, media optimization, digital experience management and cross-channel campaign management, as well as premium video delivery and monetization. This segment also offers legacy enterprise software, such as Adobe Connect web conferencing platform and Adobe LiveCycle. The Print and Publishing segment offers legacy products and services for eLearning solutions, technical document publishing, web application development and high-end printing. Adobe Systems was founded by Charles M. Geschke and John E. Warnock in December 1982 and is headquartered in San Jose, CA.' }
402
+ # ]
403
+ ```
404
+
405
+ ### `sp500_down`
406
+ ```ruby
407
+ @robinhood = Robinhood::REST::Client(username, password)
408
+ sp500_down = @robinhood.sp500_down
409
+ puts(sp500_down)
410
+
411
+ #{ count: 10,
412
+ # next: null,
413
+ # previous: null,
414
+ # results:
415
+ # [ { instrument_url: 'https://api.robinhood.com/instruments/adbc3ce0-dd0d-4a7a-92e0-88c1f127cbcb/',
416
+ # symbol: 'NEM',
417
+ # updated_at: '2016-09-21T13:03:32.310184Z',
418
+ # price_movement: [{ market_hours_last_movement_pct: '-3.70', market_hours_last_price: '13.2800' }],
419
+ # description: 'Newmont Mining Corp. is a gold producer, which is engaged in the acquisition, exploration and production of gold and copper properties in U.S., Australia, Peru, Indonesia, Ghana, Canada, New Zealand and Mexico. The company\'s operating segments include North America, South America, Asia Pacific and Africa. The North America segment consists of Nevada in the United States, La Herradura in Mexico and Hope Bay in Canada. The South America segment consists of Yanacocha and Conga in Peru. The Asia Pacific segment consists of Boddington in Australia, Batu Hijau in Indonesia and other smaller operations in Australia and New Zealand. The Africa segment consists of Ahafo and Akyem in Ghana. The company was founded by William Boyce Thompson on May 2, 1921 and is headquartered in Greenwood Village, CO.' },
420
+ # { instrument_url: 'https://api.robinhood.com/instruments/809adc21-ef75-4c3d-9c0e-5f9a167f235b/',
421
+ # symbol: 'ADBE',
422
+ # updated_at: '2016-09-21T13:01:31.748590Z',
423
+ # price_movement: [{ market_hours_last_movement_pct: '-3.70', market_hours_last_price: '13.2800' }],
424
+ # description: 'Adobe Systems, Inc. provides digital marketing and digital media solutions. The company operates its business through three segments: Digital Media, Digital Marketing, and Print and Publishing. The Digital Media segment offers creative cloud services, which allow members to download and install the latest versions of products, such as Adobe Photoshop, Adobe Illustrator, Adobe Premiere Pro, Adobe Photoshop Lightroom and Adobe InDesign, as well as utilize other tools, such as Adobe Acrobat. This segment also offers other tools and services, including hobbyist products, such as Adobe Photoshop Elements and Adobe Premiere Elements, Adobe Digital Publishing Suite, Adobe PhoneGap, Adobe Typekit, as well as mobile apps, such as Adobe Photoshop Mix, Adobe Photoshop Sketch and Adobe Premiere Clip that run on tablets and mobile devices. The Digital Media serves professionals, including graphic designers, production artists, web designers and developers, user interface designers, videographers, motion graphic artists, prepress professionals, video game developers, mobile application developers, students and administrators. The Digital Marketing segment offers various solutions, including analytics, social marketing, targeting, media optimization, digital experience management and cross-channel campaign management, as well as premium video delivery and monetization. This segment also offers legacy enterprise software, such as Adobe Connect web conferencing platform and Adobe LiveCycle. The Print and Publishing segment offers legacy products and services for eLearning solutions, technical document publishing, web application development and high-end printing. Adobe Systems was founded by Charles M. Geschke and John E. Warnock in December 1982 and is headquartered in San Jose, CA.' }
425
+ # ]
426
+ #}
427
+ ```
428
+ ### `splits(instrument)`
429
+
430
+ ```ruby
431
+ @robinhood = Robinhood::REST::Client(username, password)
432
+ splits = @robinhood.splits("7a3a677d-1664-44a0-a94b-3bb3d64f9e20")
433
+ puts("splits")
434
+ ```
435
+
436
+ ### `historicals(symbol, intv, span)`
437
+
438
+ ```ruby
439
+
440
+ # {interval=5minute|10minute (required) span=week|day| }
441
+ @robinhood = Robinhood::REST::Client(username, password)
442
+ historicals = @robinhood.historicals("AAPL", '5minute', 'week')
443
+ puts(historicals)
444
+
445
+ #
446
+ # { quote: 'https://api.robinhood.com/quotes/AAPL/',
447
+ # symbol: 'AAPL',
448
+ # interval: '5minute',
449
+ # span: 'week',
450
+ # bounds: 'regular',
451
+ # previous_close: null,
452
+ # historicals:
453
+ # [ { begins_at: '2016-09-15T13:30:00Z',
454
+ # open_price: '113.8300',
455
+ # close_price: '114.1700',
456
+ # high_price: '114.3500',
457
+ # low_price: '113.5600',
458
+ # volume: 3828122,
459
+ # session: 'reg',
460
+ # interpolated: false },
461
+ # { begins_at: '2016-09-15T13:35:00Z',
462
+ # open_price: '114.1600',
463
+ # close_price: '114.3800',
464
+ # high_price: '114.7300',
465
+ # low_price: '114.1600',
466
+ # volume: 2166098,
467
+ # session: 'reg',
468
+ # interpolated: false },
469
+ # ... 290 more items
470
+ # ]}
471
+ # }
472
+
473
+ ```
474
+
475
+ ### `url(url)`
476
+
477
+ `url` is used to get continued or paginated data from the API. Queries with long results return a reference to the next sete. Example -
478
+
479
+ ```
480
+ next: 'https://api.robinhood.com/orders/?cursor=cD0yMD82LTA0LTAzKzkwJVNCNTclM0ExNC45MzYyKDYlMkIwoCUzqtAW' }
481
+ ```
482
+
483
+ The url returned can be passed to the `url` method to continue getting the next set of results.
484
+
485
+
486
+
487
+ ## Development
488
+
489
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
490
+
491
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
492
+
493
+ ## Contributing
494
+
495
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rememberlenny/robinhood-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
496
+
497
+
498
+ # Contributors
499
+
500
+ Leonard Bogdonoff ([@rememberlenny](https://github.com/rememberlenny))
501
+ ------------------
502
+ * Alejandro U. Alvarez ([@aurbano](https://github.com/aurbano))
503
+ * Jesse Spencer ([@Jspenc72](https://github.com/jspenc72))
504
+ * Justin Keller ([@nodesocket](https://github.com/nodesocket))
505
+ * Wei-Sheng Su ([@ted7726](https://github.com/ted7726))
506
+ * Dustin Moore ([@dustinmoorenet](https://github.com/dustinmoorenet))
507
+ * Alex Ryan ([@ialexryan](https://github.com/ialexryan))
508
+ * Ben Van Treese ([@vantreeseba](https://github.com/vantreeseba))
509
+ * Zaheen ([@z123](https://github.com/z123))
510
+ * Chris Busse ([@busse](https://github.com/busse))
511
+ * Jason Truluck ([@jasontruluck](https://github.com/jasontruluck))
512
+
513
+ ------------------
514
+
515
+
516
+ ## License
517
+
518
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
519
+
520
+ > Even though this should be obvious: I am not affiliated in any way with Robinhood Financial LLC. I don't mean any harm or disruption in their service by providing this. Furthermore, I believe they are working on an amazing product, and hope that by publishing this NodeJS framework their users can benefit in even more ways from working with them.