unageanu-jiji 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +4 -0
- data/bin/jiji +1 -1
- data/lib/jiji/operator.rb +17 -17
- data/lib/jiji/plugin/embedded/click_securities_demo_plugin.rb +2 -1
- data/lib/jiji/plugin/embedded/single_click_client.rb +1 -1
- data/lib/jiji/process_manager.rb +4 -4
- data/test/util/test_BlockToSession.rb +1 -1
- data/test/util/test_CSV.rb +1 -1
- metadata +8 -8
data/ChangeLog
CHANGED
data/bin/jiji
CHANGED
data/lib/jiji/operator.rb
CHANGED
@@ -50,7 +50,7 @@ module JIJI
|
|
50
50
|
def buy(count, pair=:EURJPY, trader="")
|
51
51
|
rate = @rate[pair]
|
52
52
|
unit = @rate.pair_infos[pair].trade_unit
|
53
|
-
p = Position.new( UUID.random_create().to_s, Position::BUY, count,
|
53
|
+
p = Position.new( UUIDTools::UUID.random_create().to_s, Position::BUY, count,
|
54
54
|
unit, @rate.time, rate.ask, pair, trader, self )
|
55
55
|
p.next( @rate )
|
56
56
|
@profit_or_loss += p.profit_or_loss
|
@@ -67,7 +67,7 @@ module JIJI
|
|
67
67
|
def sell(count, pair=:EURJPY, trader="")
|
68
68
|
rate = @rate[pair]
|
69
69
|
unit = @rate.pair_infos[pair].trade_unit
|
70
|
-
p = Position.new( UUID.random_create().to_s, Position::SELL, count,
|
70
|
+
p = Position.new( UUIDTools::UUID.random_create().to_s, Position::SELL, count,
|
71
71
|
unit, @rate.time, rate.bid, pair, trader, self )
|
72
72
|
p.next( @rate )
|
73
73
|
@profit_or_loss += p.profit_or_loss
|
@@ -301,11 +301,11 @@ module JIJI
|
|
301
301
|
id = nil
|
302
302
|
if @trade_enable
|
303
303
|
JIJI::Util.log_if_error_and_throw( @logger ) {
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
304
|
+
rate = @rate[pair]
|
305
|
+
# 成り行きで買い
|
306
|
+
id = @client.order( pair, :buy, count ).position_id
|
307
|
+
}
|
308
|
+
end
|
309
309
|
p = super(count, pair, trader)
|
310
310
|
p.raw_position_id = id if id
|
311
311
|
p
|
@@ -317,12 +317,12 @@ module JIJI
|
|
317
317
|
def sell(count, pair=:EURJPY, trader="")
|
318
318
|
id = nil
|
319
319
|
if @trade_enable
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
320
|
+
JIJI::Util.log_if_error_and_throw( @logger ) {
|
321
|
+
rate = @rate[pair]
|
322
|
+
# 成り行きで売り
|
323
|
+
id = @client.order( pair, :sell, count ).position_id
|
324
|
+
}
|
325
|
+
end
|
326
326
|
p = super(count, pair, trader)
|
327
327
|
p.raw_position_id = id if id
|
328
328
|
p
|
@@ -331,10 +331,10 @@ module JIJI
|
|
331
331
|
# 取引を確定する
|
332
332
|
def commit(position)
|
333
333
|
if @trade_enable && position.raw_position_id
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
334
|
+
JIJI::Util.log_if_error_and_throw( @logger ) {
|
335
|
+
@client.commit( position.raw_position_id, position.count )
|
336
|
+
}
|
337
|
+
end
|
338
338
|
super(position)
|
339
339
|
end
|
340
340
|
|
@@ -20,7 +20,8 @@ module JIJI
|
|
20
20
|
#「jiji setting」でユーザーに入力を要求するデータの情報を返します。
|
21
21
|
def input_infos
|
22
22
|
[ Input.new( :user, "Please input a user name of CLICK Securities DEMO Trade.", false, nil ),
|
23
|
-
Input.new( :password, "Please input a password of CLICK Securities DEMO Trade.", true, nil )
|
23
|
+
Input.new( :password, "Please input a password of CLICK Securities DEMO Trade.", true, nil ),
|
24
|
+
Input.new( :proxy, "Please input a proxy. example: https://example.com:80 (default: nil )", false, nil )]
|
24
25
|
end
|
25
26
|
|
26
27
|
#プラグインを初期化します。
|
@@ -76,7 +76,7 @@ module JIJI
|
|
76
76
|
logger.info "start single click client."
|
77
77
|
begin
|
78
78
|
JIJI::Util.log_if_error_and_throw( @logger ) {
|
79
|
-
client = ClickClient::Client.new
|
79
|
+
client = ClickClient::Client.new( conf[:proxy] ? conf[:proxy] : nil )
|
80
80
|
client.host_name = conf[:host] ? conf[:host] : "https://fx-demo.click-sec.com"
|
81
81
|
@logger.info "connect host=#{client.host_name}, user=#{conf[:user]}"
|
82
82
|
client.fx_session(conf[:user], conf[:password]){|fx|
|
data/lib/jiji/process_manager.rb
CHANGED
@@ -23,7 +23,7 @@ module JIJI
|
|
23
23
|
next unless File.exist? "#{d}/props.yaml"
|
24
24
|
id = File.basename(d)
|
25
25
|
next if id == "rmt"
|
26
|
-
@back_tests[id] = @registry.backtest_process(id, nil )
|
26
|
+
@back_tests[id] = @registry.backtest_process(id, nil )
|
27
27
|
}
|
28
28
|
end
|
29
29
|
|
@@ -56,7 +56,7 @@ module JIJI
|
|
56
56
|
# バックテストプロセスを列挙する
|
57
57
|
def each( &block )
|
58
58
|
@back_tests.each_pair {|k,v|
|
59
|
-
yield v
|
59
|
+
yield v
|
60
60
|
}
|
61
61
|
end
|
62
62
|
|
@@ -86,7 +86,7 @@ module JIJI
|
|
86
86
|
# バックテストプロセスを新規に作成する
|
87
87
|
def create_back_test( name, memo, start_date, end_date, agent_properties )
|
88
88
|
|
89
|
-
id = UUID.random_create().to_s
|
89
|
+
id = UUIDTools::UUID.random_create().to_s
|
90
90
|
|
91
91
|
# プロパティを記録
|
92
92
|
props = {
|
@@ -97,7 +97,7 @@ module JIJI
|
|
97
97
|
"start_date"=>start_date.to_i,
|
98
98
|
"end_date"=>end_date.to_i,
|
99
99
|
"agents"=>agent_properties,
|
100
|
-
"state"=>:WAITING
|
100
|
+
"state"=>:WAITING
|
101
101
|
}
|
102
102
|
begin
|
103
103
|
btp = @registry.backtest_process(id, props )
|
data/test/util/test_CSV.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unageanu-jiji
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
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: 2009-
|
12
|
+
date: 2009-05-16 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
version_requirement:
|
19
19
|
version_requirements: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
|
-
- - "
|
21
|
+
- - "="
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 0.0.2
|
24
24
|
version:
|
@@ -28,7 +28,7 @@ dependencies:
|
|
28
28
|
version_requirement:
|
29
29
|
version_requirements: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.5.0
|
34
34
|
version:
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
version_requirement:
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
|
-
- - "
|
41
|
+
- - "="
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: 1.3.0
|
44
44
|
version:
|
@@ -48,7 +48,7 @@ dependencies:
|
|
48
48
|
version_requirement:
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - "
|
51
|
+
- - "="
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: 1.1.2
|
54
54
|
version:
|
@@ -58,9 +58,9 @@ dependencies:
|
|
58
58
|
version_requirement:
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- - "
|
61
|
+
- - "="
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
63
|
+
version: 2.0.0
|
64
64
|
version:
|
65
65
|
description:
|
66
66
|
email: y-masaya@red.hot.co.jp
|