Permalink
Browse files

Merge pull request #48 from arvicco/master

Complete Rails Engine, TWS 929 support
  • Loading branch information...
2 parents b1b9fd4 + 65967d3 commit 6966d7ec43c3100640ef82dd38dae68cbc57851b @arvicco arvicco committed Aug 11, 2012
Showing with 1,525 additions and 42 deletions.
  1. +1 −1 Gemfile.lock
  2. +3 −0 HISTORY
  3. +6 −4 README.md
  4. +1 −1 VERSION
  5. +87 −0 app/controllers/ib/orders_controller.rb
  6. +4 −0 app/helpers/ib/orders_helper.rb
  7. +1 −1 app/views/ib/contract_details/index.html.erb
  8. +1 −1 app/views/ib/contract_details/new.html.erb
  9. +0 −4 app/views/ib/contracts/_form.html.erb
  10. +353 −0 app/views/ib/orders/_form.html.erb
  11. +6 −0 app/views/ib/orders/edit.html.erb
  12. +193 −0 app/views/ib/orders/index.html.erb
  13. +5 −0 app/views/ib/orders/new.html.erb
  14. +435 −0 app/views/ib/orders/show.html.erb
  15. +29 −0 bin/scaffold.rb
  16. +1 −0 config/routes.rb
  17. +24 −0 db/migrate/131_add_ib_orders.rb
  18. 0 {bin → example}/account_info
  19. 0 {bin → example}/cancel_orders
  20. 0 {bin → example}/contract_details
  21. 0 {bin → example}/depth_of_market
  22. 0 {bin → example}/fa_accounts
  23. 0 {bin → example}/fundamental_data
  24. 0 {bin → example}/historic_data
  25. 0 {bin → example}/historic_data_cli
  26. 0 {bin → example}/list_orders
  27. 0 {bin → example}/market_data
  28. 0 {bin → example}/option_data
  29. 0 {bin → example}/place_combo_order
  30. 0 {bin → example}/place_order
  31. 0 {bin → example}/template
  32. 0 {bin → example}/tick_data
  33. 0 {bin → example}/time_and_sales
  34. +4 −1 lib/ib/errors.rb
  35. +5 −3 lib/ib/symbols/forex.rb
  36. +2 −3 lib/ib/symbols/futures.rb
  37. +2 −1 lib/ib/symbols/options.rb
  38. +2 −1 lib/ib/symbols/stocks.rb
  39. +20 −20 lib/models/ib/order.rb
  40. +185 −0 rails_spec/controllers/ib/orders_controller_spec.rb
  41. +44 −0 rails_spec/integration/contract_detail_spec.rb
  42. +35 −0 rails_spec/integration/contract_spec.rb
  43. +27 −0 rails_spec/integration/order_spec.rb
  44. +11 −0 rails_spec/requests/ib/orders_spec.rb
  45. +37 −0 rails_spec/routing/ib/orders_routing_spec.rb
  46. +1 −1 spec/integration_helper.rb
View
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- ib-ruby (0.8.4)
+ ib-ruby (0.8.5)
activerecord (>= 3.2.0)
bundler (>= 1.1.3)
standalone_migrations
View
@@ -198,3 +198,6 @@
* Working Rails Engine integration
+== 0.8.5 / 2012-08-11
+
+* Complete Rails Engine, TWS 929 support
View
@@ -70,7 +70,7 @@ other API implementations. The choice is yours.
| 0.5.21 | 918-920 | 965 |
| 0.6.1 | 921-923 | 966 |
| 0.7.1 | 924-925 | 966 |
- | 0.8.1+ | 926-927 | 967 |
+ | 0.8.1+ | 926-929 | 967 |
4. Start Interactive Broker's Trader Work Station or Gateway before your code
attempts to connect to it. Note that TWS and Gateway listen to different ports,
@@ -119,9 +119,11 @@ See `lib/ib/messages` for a full list of supported incoming/outgoing messages
and their attributes. The original TWS docs and code samples can also be found
in `misc` directory.
-The sample scripts in `bin` directory provide examples of how common tasks
-can be achieved using ib-ruby. You may also want to look into `spec/integration`
-directory for more scenarios and examples of handling IB messages.
+Sample scripts in `example` directory demonstrate common ib-ruby use cases. Examples
+show you how to access account info, print real time quotes, retrieve historic or
+fundamental data, request options calculations, place, list, and cancel orders.
+You may also want to look into `spec/integration` directory for more scenarios,
+use cases and examples of handling IB messages.
## RAILS INTEGRATION:
View
@@ -1 +1 @@
-0.8.4
+0.8.5
@@ -0,0 +1,87 @@
+require_dependency "ib/application_controller"
+
+module Ib
+ class OrdersController < ApplicationController
+ # GET /orders
+ # GET /orders.json
+ def index
+ @orders = Order.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render :json => @orders }
+ end
+ end
+
+ # GET /orders/1
+ # GET /orders/1.json
+ def show
+ @order = Order.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render :json => @order }
+ end
+ end
+
+ # GET /orders/new
+ # GET /orders/new.json
+ def new
+ @order = Order.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render :json => @order }
+ end
+ end
+
+ # GET /orders/1/edit
+ def edit
+ @order = Order.find(params[:id])
+ end
+
+ # POST /orders
+ # POST /orders.json
+ def create
+ @order = Order.new(params[:order])
+
+ respond_to do |format|
+ if @order.save
+ format.html { redirect_to @order, :notice => 'Order was successfully created.' }
+ format.json { render :json => @order, :status => :created, :location => @order }
+ else
+ format.html { render :action => "new" }
+ format.json { render :json => @order.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /orders/1
+ # PUT /orders/1.json
+ def update
+ @order = Order.find(params[:id])
+
+ respond_to do |format|
+ if @order.update_attributes(params[:order])
+ format.html { redirect_to @order, :notice => 'Order was successfully updated.' }
+ format.json { head :no_content }
+ else
+ format.html { render :action => "edit" }
+ format.json { render :json => @order.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /orders/1
+ # DELETE /orders/1.json
+ def destroy
+ @order = Order.find(params[:id])
+ @order.destroy
+
+ respond_to do |format|
+ format.html { redirect_to orders_url }
+ format.json { head :no_content }
+ end
+ end
+ end
+end
@@ -0,0 +1,4 @@
+module Ib
+ module OrdersHelper
+ end
+end
@@ -80,4 +80,4 @@
<br />
-<%= link_to 'New Contract detail', new_contract_detail_path %>
+<%= link_to 'New Contract Detail', new_contract_detail_path %>
@@ -1,4 +1,4 @@
-<h1>New contract_detail</h1>
+<h1>New Contract Detail</h1>
<%= render 'form' %>
@@ -71,10 +71,6 @@
<%= f.label :right %><br />
<%= f.text_field :right %>
</div>
- <div class="field">
- <%= f.label :type %><br />
- <%= f.text_field :type %>
- </div>
<div class="actions">
<%= f.submit %>
</div>
Oops, something went wrong.

0 comments on commit 6966d7e

Please sign in to comment.