clickclient_scrap 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/clickclient_scrap.rb +6 -3
- data/lib/jiji_plugin.rb +1 -0
- data/sample/constants.rb +14 -4
- data/sample/sample_get_margin.rb +2 -0
- data/sample/sample_list_open_interests.rb +2 -0
- data/sample/sample_list_orders.rb +2 -0
- data/sample/sample_list_rates.rb +2 -0
- data/sample/sample_market_order.rb +2 -0
- data/sample/sample_oco_order.rb +2 -0
- data/sample/sample_order.rb +2 -0
- data/sample/sample_settle.rb +2 -0
- data/{specs → spec}/cancel_order_spec.rb +2 -0
- data/spec/common.rb +39 -0
- data/{specs/jiji_plugin_spec!.rb → spec/jiji_plugin_daily_spec.rb} +109 -127
- data/spec/jiji_plugin_spec!.rb +97 -0
- data/{specs → spec}/limit_order_spec.rb +2 -0
- data/{specs → spec}/list_orders_spec.rb +2 -0
- data/{specs → spec}/market_order_spec!.rb +2 -0
- data/{specs → spec}/oco_order_spec.rb +2 -0
- data/{specs → spec}/order_error_spec.rb +2 -0
- metadata +46 -26
- data/specs/common.rb +0 -30
data/lib/clickclient_scrap.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
1
3
|
begin
|
2
4
|
require 'rubygems'
|
3
5
|
rescue LoadError
|
@@ -47,7 +49,7 @@ module ClickClientScrap
|
|
47
49
|
# 例) https://proxyhost.com:80
|
48
50
|
#
|
49
51
|
def initialize( proxy=ENV["http_proxy"], demo=false )
|
50
|
-
@client =
|
52
|
+
@client = Mechanize.new {|c|
|
51
53
|
# プロキシ
|
52
54
|
if proxy
|
53
55
|
uri = URI.parse( proxy )
|
@@ -70,6 +72,7 @@ module ClickClientScrap
|
|
70
72
|
#options:: オプション
|
71
73
|
#戻り値:: ClickClientScrap::FX::FxSession
|
72
74
|
def fx_session( userid, password, options={}, &block )
|
75
|
+
|
73
76
|
page = @client.get(@host_name)
|
74
77
|
ClickClientScrap::Client.error(page) if page.forms.length <= 0
|
75
78
|
form = page.forms.first
|
@@ -714,9 +717,9 @@ module ClickClientScrap
|
|
714
717
|
end
|
715
718
|
end
|
716
719
|
|
717
|
-
class <<
|
720
|
+
class << Mechanize::Util
|
718
721
|
def from_native_charset(s, code)
|
719
|
-
if
|
722
|
+
if Mechanize.html_parser == Nokogiri::HTML
|
720
723
|
return unless s
|
721
724
|
Iconv.iconv(code, "UTF-8", s).join("") rescue s # エラーになった場合、変換前の文字列を返す
|
722
725
|
else
|
data/lib/jiji_plugin.rb
CHANGED
data/sample/constants.rb
CHANGED
@@ -1,5 +1,15 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
|
2
|
-
# ※「../etc
|
3
|
-
#
|
4
|
-
|
5
|
-
|
3
|
+
# ※「../etc/auth.yaml」を作成し、以下の内容を設定しておくこと。
|
4
|
+
# <pre>
|
5
|
+
# ---
|
6
|
+
# user: <クリック証券のアクセスユーザー名>
|
7
|
+
# pass: <クリック証券のアクセスユーザーパスワード>
|
8
|
+
# demo_user: <クリック証券デモ取引のアクセスユーザー名>
|
9
|
+
# demo_pass: <クリック証券デモ取引のアクセスユーザーパスワード>
|
10
|
+
# </pre>
|
11
|
+
require 'yaml'
|
12
|
+
|
13
|
+
auth = YAML.load_file "#{File.dirname(__FILE__)}/../etc/auth.yaml"
|
14
|
+
USER=auth["user"]
|
15
|
+
PASS=auth["pass"]
|
data/sample/sample_get_margin.rb
CHANGED
data/sample/sample_list_rates.rb
CHANGED
data/sample/sample_oco_order.rb
CHANGED
data/sample/sample_order.rb
CHANGED
data/sample/sample_settle.rb
CHANGED
data/spec/common.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
# ※「../etc/auth.yaml」を作成し、以下の内容を設定しておくこと。
|
4
|
+
# <pre>
|
5
|
+
# ---
|
6
|
+
# user: <クリック証券のアクセスユーザー名>
|
7
|
+
# pass: <クリック証券のアクセスユーザーパスワード>
|
8
|
+
# demo_user: <クリック証券デモ取引のアクセスユーザー名>
|
9
|
+
# demo_pass: <クリック証券デモ取引のアクセスユーザーパスワード>
|
10
|
+
# </pre>
|
11
|
+
require 'yaml'
|
12
|
+
|
13
|
+
auth = YAML.load_file "#{File.dirname(__FILE__)}/../etc/auth.yaml"
|
14
|
+
USER=auth["user"]
|
15
|
+
PASS=auth["pass"]
|
16
|
+
DEMO_USER=auth["demo_user"]
|
17
|
+
DEMO_PASS=auth["demo_pass"]
|
18
|
+
|
19
|
+
# ベース
|
20
|
+
module TestBase
|
21
|
+
# 通常/デモのそれぞれのセッションでブロックを実行する。
|
22
|
+
def do_test
|
23
|
+
[#{:c=>ClickClientScrap::Client.new, :p=>PASS, :u=>USER },
|
24
|
+
{:c=>ClickClientScrap::Client.new(nil, true), :p=>DEMO_PASS, :u=>DEMO_USER }].each {|i|
|
25
|
+
@s = i[:c].fx_session( i[:u], i[:p] )
|
26
|
+
@rates = @s.list_rates
|
27
|
+
@order_ids = []
|
28
|
+
begin
|
29
|
+
yield @s
|
30
|
+
ensure
|
31
|
+
begin
|
32
|
+
@order_ids.each {|order| @s.cancel_order(order.order_no) } if @s
|
33
|
+
ensure
|
34
|
+
@s.logout if @s
|
35
|
+
end
|
36
|
+
end
|
37
|
+
}
|
38
|
+
end
|
39
|
+
end
|
@@ -1,127 +1,109 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
$: << "../lib"
|
4
|
-
|
5
|
-
require "rubygems"
|
6
|
-
require "logger"
|
7
|
-
require 'clickclient_scrap'
|
8
|
-
require "common"
|
9
|
-
require 'jiji/plugin/plugin_loader'
|
10
|
-
require 'jiji/plugin/securities_plugin'
|
11
|
-
|
12
|
-
# jijiプラグインのテスト
|
13
|
-
#
|
14
|
-
describe "
|
15
|
-
before(:all) {
|
16
|
-
# ロード
|
17
|
-
JIJI::Plugin::Loader.new.load
|
18
|
-
@logger = Logger.new STDOUT
|
19
|
-
}
|
20
|
-
it "jiji pluginのテスト(DEMO)" do
|
21
|
-
plugins = JIJI::Plugin.get( JIJI::Plugin::SecuritiesPlugin::FUTURE_NAME )
|
22
|
-
plugin = plugins.find {|i| i.plugin_id == :click_securities_demo }
|
23
|
-
|
24
|
-
plugin.should_not be_nil
|
25
|
-
plugin.display_name.should == "CLICK Securities DEMO"
|
26
|
-
|
27
|
-
begin
|
28
|
-
plugin.init_plugin( {:user=>DEMO_USER, :password=>DEMO_PASS}, @logger )
|
29
|
-
|
30
|
-
# 利用可能な通貨ペア一覧とレート
|
31
|
-
pairs = plugin.list_pairs
|
32
|
-
rates = plugin.list_rates
|
33
|
-
pairs.each {|p|
|
34
|
-
# 利用可能とされたペアのレートが取得できていることを確認
|
35
|
-
p.name.should_not be_nil
|
36
|
-
p.trade_unit.should_not be_nil
|
37
|
-
rates[p.name].should_not be_nil
|
38
|
-
rates[p.name].bid.should_not be_nil
|
39
|
-
rates[p.name].ask.should_not be_nil
|
40
|
-
rates[p.name].sell_swap.should_not be_nil
|
41
|
-
rates[p.name].buy_swap.should_not be_nil
|
42
|
-
}
|
43
|
-
sleep 1
|
44
|
-
|
45
|
-
3.times {
|
46
|
-
rates = plugin.list_rates
|
47
|
-
pairs.each {|p|
|
48
|
-
# 利用可能とされたペアのレートが取得できていることを確認
|
49
|
-
p.name.should_not be_nil
|
50
|
-
p.trade_unit.should_not be_nil
|
51
|
-
rates[p.name].should_not be_nil
|
52
|
-
rates[p.name].bid.should_not be_nil
|
53
|
-
rates[p.name].ask.should_not be_nil
|
54
|
-
rates[p.name].sell_swap.should_not be_nil
|
55
|
-
rates[p.name].buy_swap.should_not be_nil
|
56
|
-
}
|
57
|
-
sleep 3
|
58
|
-
}
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
rates
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
}
|
111
|
-
sleep 3
|
112
|
-
}
|
113
|
-
|
114
|
-
# 売り/買い
|
115
|
-
sell = plugin.order( :EURJPY, :sell, 1 )
|
116
|
-
buy = plugin.order( :EURJPY, :buy, 1 )
|
117
|
-
sell.position_id.should_not be_nil
|
118
|
-
buy.position_id.should_not be_nil
|
119
|
-
|
120
|
-
# 約定
|
121
|
-
plugin.commit sell.position_id, 1
|
122
|
-
plugin.commit buy.position_id, 1
|
123
|
-
ensure
|
124
|
-
plugin.destroy_plugin
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
$: << "../lib"
|
4
|
+
|
5
|
+
require "rubygems"
|
6
|
+
require "logger"
|
7
|
+
require 'clickclient_scrap'
|
8
|
+
require "common"
|
9
|
+
require 'jiji/plugin/plugin_loader'
|
10
|
+
require 'jiji/plugin/securities_plugin'
|
11
|
+
|
12
|
+
# jijiプラグインのテスト
|
13
|
+
# ※dailyでのテスト用。レート情報の参照のみをテストする。
|
14
|
+
describe "jiji plugin daily" do
|
15
|
+
before(:all) {
|
16
|
+
# ロード
|
17
|
+
JIJI::Plugin::Loader.new.load
|
18
|
+
@logger = Logger.new STDOUT
|
19
|
+
}
|
20
|
+
it "jiji pluginのテスト(DEMO)" do
|
21
|
+
plugins = JIJI::Plugin.get( JIJI::Plugin::SecuritiesPlugin::FUTURE_NAME )
|
22
|
+
plugin = plugins.find {|i| i.plugin_id == :click_securities_demo }
|
23
|
+
|
24
|
+
plugin.should_not be_nil
|
25
|
+
plugin.display_name.should == "CLICK Securities DEMO"
|
26
|
+
|
27
|
+
begin
|
28
|
+
plugin.init_plugin( {:user=>DEMO_USER, :password=>DEMO_PASS}, @logger )
|
29
|
+
|
30
|
+
# 利用可能な通貨ペア一覧とレート
|
31
|
+
pairs = plugin.list_pairs
|
32
|
+
rates = plugin.list_rates
|
33
|
+
pairs.each {|p|
|
34
|
+
# 利用可能とされたペアのレートが取得できていることを確認
|
35
|
+
p.name.should_not be_nil
|
36
|
+
p.trade_unit.should_not be_nil
|
37
|
+
rates[p.name].should_not be_nil
|
38
|
+
rates[p.name].bid.should_not be_nil
|
39
|
+
rates[p.name].ask.should_not be_nil
|
40
|
+
rates[p.name].sell_swap.should_not be_nil
|
41
|
+
rates[p.name].buy_swap.should_not be_nil
|
42
|
+
}
|
43
|
+
sleep 1
|
44
|
+
|
45
|
+
3.times {
|
46
|
+
rates = plugin.list_rates
|
47
|
+
pairs.each {|p|
|
48
|
+
# 利用可能とされたペアのレートが取得できていることを確認
|
49
|
+
p.name.should_not be_nil
|
50
|
+
p.trade_unit.should_not be_nil
|
51
|
+
rates[p.name].should_not be_nil
|
52
|
+
rates[p.name].bid.should_not be_nil
|
53
|
+
rates[p.name].ask.should_not be_nil
|
54
|
+
rates[p.name].sell_swap.should_not be_nil
|
55
|
+
rates[p.name].buy_swap.should_not be_nil
|
56
|
+
}
|
57
|
+
sleep 3
|
58
|
+
}
|
59
|
+
|
60
|
+
ensure
|
61
|
+
plugin.destroy_plugin
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
it "jiji pluginのテスト" do
|
66
|
+
plugins = JIJI::Plugin.get( JIJI::Plugin::SecuritiesPlugin::FUTURE_NAME )
|
67
|
+
plugin = plugins.find {|i| i.plugin_id == :click_securities }
|
68
|
+
|
69
|
+
plugin.should_not be_nil
|
70
|
+
plugin.display_name.should == "CLICK Securities"
|
71
|
+
|
72
|
+
begin
|
73
|
+
plugin.init_plugin( {:user=>USER, :password=>PASS}, @logger )
|
74
|
+
|
75
|
+
# 利用可能な通貨ペア一覧とレート
|
76
|
+
pairs = plugin.list_pairs
|
77
|
+
rates = plugin.list_rates
|
78
|
+
pairs.each {|p|
|
79
|
+
# 利用可能とされたペアのレートが取得できていることを確認
|
80
|
+
p.name.should_not be_nil
|
81
|
+
p.trade_unit.should_not be_nil
|
82
|
+
rates[p.name].should_not be_nil
|
83
|
+
rates[p.name].bid.should_not be_nil
|
84
|
+
rates[p.name].ask.should_not be_nil
|
85
|
+
rates[p.name].sell_swap.should_not be_nil
|
86
|
+
rates[p.name].buy_swap.should_not be_nil
|
87
|
+
}
|
88
|
+
sleep 1
|
89
|
+
|
90
|
+
3.times {
|
91
|
+
rates = plugin.list_rates
|
92
|
+
pairs.each {|p|
|
93
|
+
# 利用可能とされたペアのレートが取得できていることを確認
|
94
|
+
p.name.should_not be_nil
|
95
|
+
p.trade_unit.should_not be_nil
|
96
|
+
rates[p.name].should_not be_nil
|
97
|
+
rates[p.name].bid.should_not be_nil
|
98
|
+
rates[p.name].ask.should_not be_nil
|
99
|
+
rates[p.name].sell_swap.should_not be_nil
|
100
|
+
rates[p.name].buy_swap.should_not be_nil
|
101
|
+
}
|
102
|
+
sleep 3
|
103
|
+
}
|
104
|
+
|
105
|
+
ensure
|
106
|
+
plugin.destroy_plugin
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
$: << "../lib"
|
4
|
+
|
5
|
+
require "rubygems"
|
6
|
+
require "logger"
|
7
|
+
require 'clickclient_scrap'
|
8
|
+
require "common"
|
9
|
+
require 'jiji/plugin/plugin_loader'
|
10
|
+
require 'jiji/plugin/securities_plugin'
|
11
|
+
|
12
|
+
# jijiプラグインのテスト
|
13
|
+
# ※実際に取引を行うので注意!
|
14
|
+
describe "market order" do
|
15
|
+
before(:all) {
|
16
|
+
# ロード
|
17
|
+
JIJI::Plugin::Loader.new.load
|
18
|
+
@logger = Logger.new STDOUT
|
19
|
+
}
|
20
|
+
it "jiji pluginのテスト(DEMO)" do
|
21
|
+
plugins = JIJI::Plugin.get( JIJI::Plugin::SecuritiesPlugin::FUTURE_NAME )
|
22
|
+
plugin = plugins.find {|i| i.plugin_id == :click_securities_demo }
|
23
|
+
|
24
|
+
plugin.should_not be_nil
|
25
|
+
plugin.display_name.should == "CLICK Securities DEMO"
|
26
|
+
|
27
|
+
begin
|
28
|
+
plugin.init_plugin( {:user=>DEMO_USER, :password=>DEMO_PASS}, @logger )
|
29
|
+
|
30
|
+
# 利用可能な通貨ペア一覧とレート
|
31
|
+
pairs = plugin.list_pairs
|
32
|
+
rates = plugin.list_rates
|
33
|
+
pairs.each {|p|
|
34
|
+
# 利用可能とされたペアのレートが取得できていることを確認
|
35
|
+
p.name.should_not be_nil
|
36
|
+
p.trade_unit.should_not be_nil
|
37
|
+
rates[p.name].should_not be_nil
|
38
|
+
rates[p.name].bid.should_not be_nil
|
39
|
+
rates[p.name].ask.should_not be_nil
|
40
|
+
rates[p.name].sell_swap.should_not be_nil
|
41
|
+
rates[p.name].buy_swap.should_not be_nil
|
42
|
+
}
|
43
|
+
sleep 1
|
44
|
+
|
45
|
+
# 売り/買い
|
46
|
+
sell = plugin.order( :EURJPY, :sell, 1 )
|
47
|
+
buy = plugin.order( :EURJPY, :buy, 1 )
|
48
|
+
sell.position_id.should_not be_nil
|
49
|
+
buy.position_id.should_not be_nil
|
50
|
+
|
51
|
+
# 約定
|
52
|
+
plugin.commit sell.position_id, 1
|
53
|
+
plugin.commit buy.position_id, 1
|
54
|
+
ensure
|
55
|
+
plugin.destroy_plugin
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
it "jiji pluginのテスト" do
|
60
|
+
plugins = JIJI::Plugin.get( JIJI::Plugin::SecuritiesPlugin::FUTURE_NAME )
|
61
|
+
plugin = plugins.find {|i| i.plugin_id == :click_securities }
|
62
|
+
|
63
|
+
plugin.should_not be_nil
|
64
|
+
plugin.display_name.should == "CLICK Securities"
|
65
|
+
|
66
|
+
begin
|
67
|
+
plugin.init_plugin( {:user=>USER, :password=>PASS}, @logger )
|
68
|
+
|
69
|
+
# 利用可能な通貨ペア一覧とレート
|
70
|
+
pairs = plugin.list_pairs
|
71
|
+
rates = plugin.list_rates
|
72
|
+
pairs.each {|p|
|
73
|
+
# 利用可能とされたペアのレートが取得できていることを確認
|
74
|
+
p.name.should_not be_nil
|
75
|
+
p.trade_unit.should_not be_nil
|
76
|
+
rates[p.name].should_not be_nil
|
77
|
+
rates[p.name].bid.should_not be_nil
|
78
|
+
rates[p.name].ask.should_not be_nil
|
79
|
+
rates[p.name].sell_swap.should_not be_nil
|
80
|
+
rates[p.name].buy_swap.should_not be_nil
|
81
|
+
}
|
82
|
+
sleep 1
|
83
|
+
|
84
|
+
# 売り/買い
|
85
|
+
sell = plugin.order( :EURJPY, :sell, 1 )
|
86
|
+
buy = plugin.order( :EURJPY, :buy, 1 )
|
87
|
+
sell.position_id.should_not be_nil
|
88
|
+
buy.position_id.should_not be_nil
|
89
|
+
|
90
|
+
# 約定
|
91
|
+
plugin.commit sell.position_id, 1
|
92
|
+
plugin.commit buy.position_id, 1
|
93
|
+
ensure
|
94
|
+
plugin.destroy_plugin
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clickclient_scrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 13
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 11
|
10
|
+
version: 0.1.11
|
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-
|
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
|
-
|
18
|
-
|
19
|
-
|
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
|
-
|
24
|
-
|
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: []
|
@@ -35,14 +47,15 @@ files:
|
|
35
47
|
- ChangeLog
|
36
48
|
- lib/clickclient_scrap.rb
|
37
49
|
- lib/jiji_plugin.rb
|
38
|
-
-
|
39
|
-
-
|
40
|
-
-
|
41
|
-
-
|
42
|
-
-
|
43
|
-
-
|
44
|
-
-
|
45
|
-
-
|
50
|
+
- spec/cancel_order_spec.rb
|
51
|
+
- spec/common.rb
|
52
|
+
- spec/jiji_plugin_daily_spec.rb
|
53
|
+
- spec/jiji_plugin_spec!.rb
|
54
|
+
- spec/limit_order_spec.rb
|
55
|
+
- spec/list_orders_spec.rb
|
56
|
+
- spec/market_order_spec!.rb
|
57
|
+
- spec/oco_order_spec.rb
|
58
|
+
- spec/order_error_spec.rb
|
46
59
|
- sample/constants.rb
|
47
60
|
- sample/sample_get_margin.rb
|
48
61
|
- sample/sample_list_open_interests.rb
|
@@ -63,30 +76,37 @@ rdoc_options:
|
|
63
76
|
require_paths:
|
64
77
|
- lib
|
65
78
|
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
66
80
|
requirements:
|
67
81
|
- - ">="
|
68
82
|
- !ruby/object:Gem::Version
|
83
|
+
hash: 3
|
84
|
+
segments:
|
85
|
+
- 0
|
69
86
|
version: "0"
|
70
|
-
version:
|
71
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
72
89
|
requirements:
|
73
90
|
- - ">="
|
74
91
|
- !ruby/object:Gem::Version
|
92
|
+
hash: 3
|
93
|
+
segments:
|
94
|
+
- 0
|
75
95
|
version: "0"
|
76
|
-
version:
|
77
96
|
requirements: []
|
78
97
|
|
79
98
|
rubyforge_project:
|
80
|
-
rubygems_version: 1.3.
|
99
|
+
rubygems_version: 1.3.7
|
81
100
|
signing_key:
|
82
101
|
specification_version: 3
|
83
102
|
summary: click securities client library for ruby.
|
84
103
|
test_files:
|
85
|
-
-
|
86
|
-
-
|
87
|
-
-
|
88
|
-
-
|
89
|
-
-
|
90
|
-
-
|
91
|
-
-
|
92
|
-
-
|
104
|
+
- spec/cancel_order_spec.rb
|
105
|
+
- spec/common.rb
|
106
|
+
- spec/jiji_plugin_daily_spec.rb
|
107
|
+
- spec/jiji_plugin_spec!.rb
|
108
|
+
- spec/limit_order_spec.rb
|
109
|
+
- spec/list_orders_spec.rb
|
110
|
+
- spec/market_order_spec!.rb
|
111
|
+
- spec/oco_order_spec.rb
|
112
|
+
- spec/order_error_spec.rb
|
data/specs/common.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
|
2
|
-
# ※「../etc」ディレクトリにuser,passファイルを作成し、
|
3
|
-
# ユーザー名,パスワードを設定しておくこと。
|
4
|
-
USER=IO.read("../etc/user")
|
5
|
-
PASS=IO.read("../etc/pass")
|
6
|
-
DEMO_USER=IO.read("../etc/demo_user")
|
7
|
-
DEMO_PASS=IO.read("../etc/demo_pass")
|
8
|
-
|
9
|
-
|
10
|
-
# ベース
|
11
|
-
module TestBase
|
12
|
-
# 通常/デモのそれぞれのセッションでブロックを実行する。
|
13
|
-
def do_test
|
14
|
-
[{:c=>ClickClientScrap::Client.new, :p=>PASS, :u=>USER },
|
15
|
-
{:c=>ClickClientScrap::Client.new(nil, true), :p=>DEMO_PASS, :u=>DEMO_USER }].each {|i|
|
16
|
-
@s = i[:c].fx_session( i[:u], i[:p] )
|
17
|
-
@rates = @s.list_rates
|
18
|
-
@order_ids = []
|
19
|
-
begin
|
20
|
-
yield @s
|
21
|
-
ensure
|
22
|
-
begin
|
23
|
-
@order_ids.each {|order| @s.cancel_order(order.order_no) } if @s
|
24
|
-
ensure
|
25
|
-
@s.logout if @s
|
26
|
-
end
|
27
|
-
end
|
28
|
-
}
|
29
|
-
end
|
30
|
-
end
|