clickclient_scrap 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +5 -0
- data/lib/clickclient_scrap.rb +726 -688
- data/lib/jiji_plugin.rb +17 -8
- data/sample/constants.rb +5 -0
- data/sample/sample_get_margin.rb +24 -0
- data/sample/sample_list_open_interests.rb +25 -0
- data/sample/sample_list_orders.rb +28 -0
- data/sample/sample_list_rates.rb +16 -0
- data/sample/sample_market_order.rb +21 -0
- data/sample/sample_oco_order.rb +36 -0
- data/sample/sample_order.rb +64 -0
- data/sample/sample_settle.rb +18 -0
- data/specs/cancel_order_spec.rb +43 -0
- data/specs/common.rb +30 -0
- data/specs/jiji_plugin_spec!.rb +127 -0
- data/specs/limit_order_spec.rb +98 -0
- data/specs/list_orders_spec.rb +28 -0
- data/specs/market_order_spec!.rb +131 -0
- data/specs/oco_order_spec.rb +60 -0
- data/specs/order_error_spec.rb +139 -0
- metadata +27 -6
- data/test/test_FxSession.rb +0 -38
- data/test/test_jiji_plugin.rb +0 -77
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clickclient_scrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masaya Yamauchi
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-03-20 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -35,8 +35,23 @@ files:
|
|
35
35
|
- ChangeLog
|
36
36
|
- lib/clickclient_scrap.rb
|
37
37
|
- lib/jiji_plugin.rb
|
38
|
-
-
|
39
|
-
-
|
38
|
+
- specs/cancel_order_spec.rb
|
39
|
+
- specs/common.rb
|
40
|
+
- specs/jiji_plugin_spec!.rb
|
41
|
+
- specs/limit_order_spec.rb
|
42
|
+
- specs/list_orders_spec.rb
|
43
|
+
- specs/market_order_spec!.rb
|
44
|
+
- specs/oco_order_spec.rb
|
45
|
+
- specs/order_error_spec.rb
|
46
|
+
- sample/constants.rb
|
47
|
+
- sample/sample_get_margin.rb
|
48
|
+
- sample/sample_list_open_interests.rb
|
49
|
+
- sample/sample_list_orders.rb
|
50
|
+
- sample/sample_list_rates.rb
|
51
|
+
- sample/sample_market_order.rb
|
52
|
+
- sample/sample_oco_order.rb
|
53
|
+
- sample/sample_order.rb
|
54
|
+
- sample/sample_settle.rb
|
40
55
|
has_rdoc: true
|
41
56
|
homepage: http://github.com/unageanu/clickclient_scrap/tree/master
|
42
57
|
licenses: []
|
@@ -67,5 +82,11 @@ signing_key:
|
|
67
82
|
specification_version: 3
|
68
83
|
summary: click securities client library for ruby.
|
69
84
|
test_files:
|
70
|
-
-
|
71
|
-
-
|
85
|
+
- specs/cancel_order_spec.rb
|
86
|
+
- specs/common.rb
|
87
|
+
- specs/jiji_plugin_spec!.rb
|
88
|
+
- specs/limit_order_spec.rb
|
89
|
+
- specs/list_orders_spec.rb
|
90
|
+
- specs/market_order_spec!.rb
|
91
|
+
- specs/oco_order_spec.rb
|
92
|
+
- specs/order_error_spec.rb
|
data/test/test_FxSession.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby
|
2
|
-
|
3
|
-
$: << "../lib"
|
4
|
-
|
5
|
-
require "runit/testcase"
|
6
|
-
require "runit/cui/testrunner"
|
7
|
-
require 'clickclient_scrap'
|
8
|
-
|
9
|
-
class FxSessionTest < RUNIT::TestCase
|
10
|
-
|
11
|
-
#convert_rate のテスト
|
12
|
-
def test_convert_rate
|
13
|
-
rate = ClickClient::FX::FxSession.convert_rate("123.34-37").map {|i| i.to_s }
|
14
|
-
assert_equals rate, [ "123.34", "123.37" ]
|
15
|
-
|
16
|
-
rate = ClickClient::FX::FxSession.convert_rate("123.534-37").map {|i| i.to_s }
|
17
|
-
assert_equals rate, [ "123.534", "123.537" ]
|
18
|
-
|
19
|
-
rate = ClickClient::FX::FxSession.convert_rate("123.594-02").map {|i| i.to_s }
|
20
|
-
assert_equals rate, [ "123.594", "123.602" ]
|
21
|
-
|
22
|
-
rate = ClickClient::FX::FxSession.convert_rate("123.00-02").map {|i| i.to_s }
|
23
|
-
assert_equals rate, [ "123.0", "123.02" ]
|
24
|
-
|
25
|
-
rate = ClickClient::FX::FxSession.convert_rate("123.34-33").map {|i| i.to_s }
|
26
|
-
assert_equals rate, [ "123.34", "124.33" ]
|
27
|
-
|
28
|
-
rate = ClickClient::FX::FxSession.convert_rate("123.34-34").map {|i| i.to_s }
|
29
|
-
assert_equals rate, [ "123.34", "123.34" ]
|
30
|
-
|
31
|
-
rate = ClickClient::FX::FxSession.convert_rate("0.334-335").map {|i| i.to_s }
|
32
|
-
assert_equals rate, [ "0.334", "0.335" ]
|
33
|
-
|
34
|
-
rate = ClickClient::FX::FxSession.convert_rate("0.334-333").map {|i| i.to_s }
|
35
|
-
assert_equals rate, [ "0.334", "1.333" ]
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
data/test/test_jiji_plugin.rb
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby
|
2
|
-
|
3
|
-
$: << "../lib"
|
4
|
-
|
5
|
-
require "runit/testcase"
|
6
|
-
require "logger"
|
7
|
-
require "runit/cui/testrunner"
|
8
|
-
require 'clickclient_scrap'
|
9
|
-
require 'jiji/plugin/plugin_loader'
|
10
|
-
require 'jiji/plugin/securities_plugin'
|
11
|
-
|
12
|
-
# jijiプラグインのテスト
|
13
|
-
# ※実際に取引を行うので注意!
|
14
|
-
class JIJIPluginTest < RUNIT::TestCase
|
15
|
-
|
16
|
-
def setup
|
17
|
-
@logger = Logger.new STDOUT
|
18
|
-
@user = IO.read( "../etc/user" )
|
19
|
-
@pass = IO.read( "../etc/pass" )
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_basic
|
23
|
-
# ロード
|
24
|
-
JIJI::Plugin::Loader.new.load
|
25
|
-
plugins = JIJI::Plugin.get( JIJI::Plugin::SecuritiesPlugin::FUTURE_NAME )
|
26
|
-
plugin = plugins.find {|i| i.plugin_id == :click_securities }
|
27
|
-
assert_not_nil plugin
|
28
|
-
assert_equals plugin.display_name, "CLICK Securities"
|
29
|
-
|
30
|
-
begin
|
31
|
-
plugin.init_plugin( {:user=>@user, :password=>@pass}, @logger )
|
32
|
-
|
33
|
-
# 利用可能な通貨ペア一覧とレート
|
34
|
-
pairs = plugin.list_pairs
|
35
|
-
rates = plugin.list_rates
|
36
|
-
pairs.each {|p|
|
37
|
-
# 利用可能とされたペアのレートが取得できていることを確認
|
38
|
-
assert_not_nil p.name
|
39
|
-
assert_not_nil p.trade_unit
|
40
|
-
assert_not_nil rates[p.name]
|
41
|
-
assert_not_nil rates[p.name].bid
|
42
|
-
assert_not_nil rates[p.name].ask
|
43
|
-
assert_not_nil rates[p.name].sell_swap
|
44
|
-
assert_not_nil rates[p.name].buy_swap
|
45
|
-
}
|
46
|
-
sleep 1
|
47
|
-
|
48
|
-
3.times {
|
49
|
-
rates = plugin.list_rates
|
50
|
-
pairs.each {|p|
|
51
|
-
# 利用可能とされたペアのレートが取得できていることを確認
|
52
|
-
assert_not_nil p.name
|
53
|
-
assert_not_nil p.trade_unit
|
54
|
-
assert_not_nil rates[p.name]
|
55
|
-
assert_not_nil rates[p.name].bid
|
56
|
-
assert_not_nil rates[p.name].ask
|
57
|
-
assert_not_nil rates[p.name].sell_swap
|
58
|
-
assert_not_nil rates[p.name].buy_swap
|
59
|
-
}
|
60
|
-
sleep 10
|
61
|
-
}
|
62
|
-
|
63
|
-
# # 売り/買い
|
64
|
-
# sell = plugin.order( :USDJPY, :sell, 1 )
|
65
|
-
# buy = plugin.order( :USDJPY, :buy, 1 )
|
66
|
-
# assert_not_nil sell.position_id
|
67
|
-
# assert_not_nil buy.position_id
|
68
|
-
#
|
69
|
-
# # 約定
|
70
|
-
# plugin.commit sell.position_id, 1
|
71
|
-
# plugin.commit buy.position_id, 1
|
72
|
-
ensure
|
73
|
-
plugin.destroy_plugin
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|