sbiclient 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,51 +1,55 @@
1
+ # -*- coding: utf-8 -*-
2
+
1
3
  $: << "../lib"
2
4
 
3
5
  require 'sbiclient'
4
6
  require 'common'
5
7
 
6
8
  describe "trail" do
7
- it_should_behave_like "login"
9
+ it_should_behave_like "login" do
10
+
11
+ it "買い" do
12
+ @order_id = @s.order( SBIClient::FX::EURUSD, SBIClient::FX::BUY, 1, {
13
+ :rate=>@rates[SBIClient::FX::EURUSD].ask_rate + 0.05,
14
+ :trail_range=>0.5,
15
+ :expiration_type=>SBIClient::FX::EXPIRATION_TYPE_TODAY
16
+ })
17
+ @order_id.should_not be_nil
18
+ @order_id.order_no.should_not be_nil
19
+ @order = @s.list_orders[@order_id.order_no]
20
+ @order.should_not be_nil
21
+ @order.order_no.should == @order_id.order_no
22
+ @order.trade_type.should == SBIClient::FX::TRADE_TYPE_NEW
23
+ @order.execution_expression.should == SBIClient::FX::EXECUTION_EXPRESSION_REVERSE_LIMIT_ORDER
24
+ @order.sell_or_buy.should == SBIClient::FX::BUY
25
+ @order.pair.should == SBIClient::FX::EURUSD
26
+ @order.count.should == 1
27
+ normalize_rate(@order.rate).should == normalize_rate(@rates[SBIClient::FX::EURUSD].ask_rate + 0.05)
28
+ @order.trail_range.to_s.should == (0.5).to_s
29
+ @order.order_type= SBIClient::FX::ORDER_TYPE_TRAIL
30
+ end
31
+
32
+ it "売り" do
33
+ @order_id = @s.order( SBIClient::FX::MURJPY, SBIClient::FX::SELL, 2, {
34
+ :rate=>@rates[SBIClient::FX::MURJPY].ask_rate - 0.5,
35
+ :trail_range=>1,
36
+ :expiration_type=>SBIClient::FX::EXPIRATION_TYPE_SPECIFIED, # 有効期限: 指定
37
+ :expiration_date=>Date.today+2 # 2日後
38
+ })
39
+ @order = @s.list_orders[@order_id.order_no]
40
+ @order_id.should_not be_nil
41
+ @order_id.order_no.should_not be_nil
42
+ @order.should_not be_nil
43
+ @order.order_no.should == @order_id.order_no
44
+ @order.trade_type.should == SBIClient::FX::TRADE_TYPE_NEW
45
+ @order.execution_expression.should == SBIClient::FX::EXECUTION_EXPRESSION_REVERSE_LIMIT_ORDER
46
+ @order.sell_or_buy.should == SBIClient::FX::SELL
47
+ @order.pair.should == SBIClient::FX::MURJPY
48
+ @order.count.should == 2
49
+ normalize_rate(@order.rate).should == normalize_rate(@rates[SBIClient::FX::MURJPY].ask_rate - 0.5)
50
+ @order.trail_range.to_s.should == (1.0).to_s
51
+ @order.order_type= SBIClient::FX::ORDER_TYPE_TRAIL
52
+ end
8
53
 
9
- it "買い" do
10
- @order_id = @s.order( SBIClient::FX::EURUSD, SBIClient::FX::BUY, 1, {
11
- :rate=>@rates[SBIClient::FX::EURUSD].ask_rate + 0.05,
12
- :trail_range=>0.5,
13
- :expiration_type=>SBIClient::FX::EXPIRATION_TYPE_TODAY
14
- })
15
- @order_id.should_not be_nil
16
- @order_id.order_no.should_not be_nil
17
- @order = @s.list_orders[@order_id.order_no]
18
- @order.should_not be_nil
19
- @order.order_no.should == @order_id.order_no
20
- @order.trade_type.should == SBIClient::FX::TRADE_TYPE_NEW
21
- @order.execution_expression.should == SBIClient::FX::EXECUTION_EXPRESSION_REVERSE_LIMIT_ORDER
22
- @order.sell_or_buy.should == SBIClient::FX::BUY
23
- @order.pair.should == SBIClient::FX::EURUSD
24
- @order.count.should == 1
25
- @order.rate.to_s.should == (@rates[SBIClient::FX::EURUSD].ask_rate + 0.05).to_s
26
- @order.trail_range.to_s.should == (0.5).to_s
27
- @order.order_type= SBIClient::FX::ORDER_TYPE_TRAIL
28
- end
29
-
30
- it "売り" do
31
- @order_id = @s.order( SBIClient::FX::MURJPY, SBIClient::FX::SELL, 2, {
32
- :rate=>@rates[SBIClient::FX::MURJPY].ask_rate - 0.5,
33
- :trail_range=>1,
34
- :expiration_type=>SBIClient::FX::EXPIRATION_TYPE_SPECIFIED, # 有効期限: 指定
35
- :expiration_date=>Date.today+2 # 2日後
36
- })
37
- @order = @s.list_orders[@order_id.order_no]
38
- @order_id.should_not be_nil
39
- @order_id.order_no.should_not be_nil
40
- @order.should_not be_nil
41
- @order.order_no.should == @order_id.order_no
42
- @order.trade_type.should == SBIClient::FX::TRADE_TYPE_NEW
43
- @order.execution_expression.should == SBIClient::FX::EXECUTION_EXPRESSION_REVERSE_LIMIT_ORDER
44
- @order.sell_or_buy.should == SBIClient::FX::SELL
45
- @order.pair.should == SBIClient::FX::MURJPY
46
- @order.count.should == 2
47
- @order.rate.should == @rates[SBIClient::FX::MURJPY].ask_rate - 0.5
48
- @order.trail_range.to_s.should == (1.0).to_s
49
- @order.order_type= SBIClient::FX::ORDER_TYPE_TRAIL
50
54
  end
51
55
  end
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sbiclient
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ hash: 19
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 4
10
+ version: 0.1.4
5
11
  platform: ruby
6
12
  authors:
7
13
  - Masaya Yamauchi
@@ -9,19 +15,25 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-04-14 00:00:00 +09:00
18
+ date: 2010-11-07 00:00:00 +09:00
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: mechanize
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
27
  - - ">="
22
28
  - !ruby/object:Gem::Version
23
- version: 0.9.3
24
- version:
29
+ hash: 23
30
+ segments:
31
+ - 1
32
+ - 0
33
+ - 0
34
+ version: 1.0.0
35
+ type: :runtime
36
+ version_requirements: *id001
25
37
  description:
26
38
  email: y-masaya@red.hot.co.jp
27
39
  executables: []
@@ -32,6 +44,7 @@ extra_rdoc_files:
32
44
  - README
33
45
  files:
34
46
  - README
47
+ - ChangeLog
35
48
  - lib/jiji_plugin.rb
36
49
  - lib/sbiclient.rb
37
50
  - sample/common.rb
@@ -47,6 +60,7 @@ files:
47
60
  - spec/common.rb
48
61
  - spec/ifd_oco_order_spec.rb
49
62
  - spec/ifd_order_spec.rb
63
+ - spec/jiji_plugin_daily_spec.rb
50
64
  - spec/jiji_plugin_spec!.rb
51
65
  - spec/limit_order_spec.rb
52
66
  - spec/list_orders_spec.rb
@@ -65,21 +79,27 @@ rdoc_options:
65
79
  require_paths:
66
80
  - lib
67
81
  required_ruby_version: !ruby/object:Gem::Requirement
82
+ none: false
68
83
  requirements:
69
84
  - - ">="
70
85
  - !ruby/object:Gem::Version
86
+ hash: 3
87
+ segments:
88
+ - 0
71
89
  version: "0"
72
- version:
73
90
  required_rubygems_version: !ruby/object:Gem::Requirement
91
+ none: false
74
92
  requirements:
75
93
  - - ">="
76
94
  - !ruby/object:Gem::Version
95
+ hash: 3
96
+ segments:
97
+ - 0
77
98
  version: "0"
78
- version:
79
99
  requirements: []
80
100
 
81
101
  rubyforge_project:
82
- rubygems_version: 1.3.5
102
+ rubygems_version: 1.3.7
83
103
  signing_key:
84
104
  specification_version: 3
85
105
  summary: SBI securities client library for ruby.
@@ -97,6 +117,7 @@ test_files:
97
117
  - spec/common.rb
98
118
  - spec/ifd_oco_order_spec.rb
99
119
  - spec/ifd_order_spec.rb
120
+ - spec/jiji_plugin_daily_spec.rb
100
121
  - spec/jiji_plugin_spec!.rb
101
122
  - spec/limit_order_spec.rb
102
123
  - spec/list_orders_spec.rb