forked from topofocus/ib-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rails integration specs for Order, Contract and ContractDetail
- Loading branch information
Showing
6 changed files
with
108 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<h1>New contract_detail</h1> | ||
<h1>New Contract Detail</h1> | ||
|
||
<%= render 'form' %> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
require 'spec_helper' | ||
|
||
describe "ContractDetails" do | ||
|
||
it "creating a new one" do | ||
visit contract_details_path | ||
click_link "New Contract Detail" | ||
fill_in "Market name", :with => 'AAPL' | ||
fill_in "Trading class", :with => 'AAPL' | ||
fill_in "Min tick", :with => 0.02 | ||
fill_in "Price magnifier", :with => 100 | ||
fill_in "Order types", :with => 'ACTIVETIM,ADJUST,ALERT,ALGO,ALLOC,AON,AVGCOST,BASKET,COND,CONDORDER,DAY,DEACT,DEACTDIS,DEACTEOD,FOK,GAT,GTC,GTD,GTT,HID,ICE,IOC,LIT,LMT,MIT,MKT,MTL,NONALGO,OCA,PAON,POSTONLY,RELSTK,SCALE,SCALERST,SMARTSTG,STP,STPLMT,TRAIL,TRAILLIT,TRAILLMT,TRAILMIT,VOLAT,WHATIF' | ||
fill_in "Valid exchanges", :with => 'SMART,AMEX,BATS,BOX,CBOE,CBOE2,IBSX,ISE,MIBSX,NASDAQOM,PHLX,PSE' | ||
fill_in "Under con", :with => 265598 | ||
fill_in "Long name", :with => 'APPLE INC' | ||
fill_in "Contract month", :with => '201301' | ||
fill_in "Industry", :with => 'Technology' | ||
fill_in "Category", :with => 'Computers' | ||
fill_in "Subcategory", :with => 'Computers' | ||
fill_in "Time zone", :with => 'EST' | ||
fill_in "Trading hours", :with => '20120422:0930-1600;20120423:0930-1600' | ||
fill_in "Liquid hours", :with => '20120422:0930-1600;20120423:0930-1600' | ||
click_button "Create Contract detail" | ||
|
||
within "#notice" do | ||
page.should have_content("Contract detail was successfully created.") | ||
end | ||
# p (page.methods-Object.methods).sort | ||
# p page.body | ||
page.should have_content("AAPL") | ||
page.should have_content("0.02") | ||
page.should have_content("100") | ||
page.should have_content("ACTIVETIM,ADJUST,ALERT,ALGO,ALLOC,AON,AVGCOST,BASKET,COND,CONDORDER,DAY,DEACT,DEACTDIS,DEACTEOD,FOK,GAT,GTC,GTD,GTT,HID,ICE,IOC,LIT,LMT,MIT,MKT,MTL,NONALGO,OCA,PAON,POSTONLY,RELSTK,SCALE,SCALERST,SMARTSTG,STP,STPLMT,TRAIL,TRAILLIT,TRAILLMT,TRAILMIT,VOLAT,WHATIF") | ||
page.should have_content("SMART,AMEX,BATS,BOX,CBOE,CBOE2,IBSX,ISE,MIBSX,NASDAQOM,PHLX,PSE") | ||
page.should have_content("265598") | ||
page.should have_content("APPLE INC") | ||
page.should have_content("201301") | ||
page.should have_content("Technology") | ||
page.should have_content("Computers") | ||
page.should have_content("EST") | ||
page.should have_content("20120422:0930-1600;20120423:0930-1600") | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
require 'spec_helper' | ||
|
||
describe "Contracts" do | ||
|
||
it "creating a new one" do | ||
visit contracts_path | ||
click_link "New Contract" | ||
fill_in "Multiplier", :with => 131313 | ||
fill_in "Strike", :with => 620.22 | ||
fill_in "Right", :with => 'P' | ||
fill_in "Symbol", :with => 'AAPL' | ||
fill_in "Currency", :with => 'USD' | ||
fill_in "Exchange", :with => 'SMART' | ||
fill_in "Sec type", :with => 'OPT' | ||
fill_in "Sec", :with => 'US0378331005' # "Sec id" ? | ||
fill_in "Sec id type", :with => 'ISIN' | ||
click_button "Create Contract" | ||
|
||
within "#notice" do | ||
page.should have_content("Contract was successfully created.") | ||
end | ||
# p (page.methods-Object.methods).sort | ||
# p page.body | ||
page.should have_content("131313") | ||
page.should have_content("620.22") | ||
page.should have_content("put") | ||
page.should have_content("AAPL") | ||
page.should have_content("USD") | ||
page.should have_content("SMART") | ||
page.should have_content("option") | ||
page.should have_content("US0378331005") | ||
page.should have_content("ISIN") | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require 'spec_helper' | ||
|
||
describe "Orders" do | ||
|
||
it "creating a new one" do | ||
visit orders_path | ||
click_link "New Order" | ||
fill_in "Contract", :with => 131313 | ||
fill_in "Limit price", :with => 11.22 | ||
fill_in "Order type", :with => 'STPLMT' | ||
fill_in "Side", :with => 'B' | ||
check "Transmit" | ||
click_button "Create Order" | ||
|
||
within "#notice" do | ||
page.should have_content("Order was successfully created.") | ||
end | ||
# p (page.methods-Object.methods).sort | ||
# p page.body | ||
page.should have_content("131313") | ||
page.should have_content("11.22") | ||
page.should have_content("stop_limit") | ||
page.should have_content("buy") | ||
page.should have_content("true") | ||
|
||
end | ||
end |