unageanu-jiji 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +3 -0
- data/bin/jiji +1 -1
- data/html/swf/chart.swf +0 -0
- data/lib/jiji/agent/agent.rb +0 -1
- data/lib/jiji/agent/agent_manager.rb +0 -1
- data/lib/jiji/collector.rb +14 -17
- data/lib/jiji/command.rb +40 -12
- data/lib/jiji/configuration.rb +8 -2
- data/lib/jiji/dao/trade_result_dao.rb +1 -1
- data/lib/jiji/migration/migrator1_1_0.rb +46 -0
- data/lib/jiji/models.rb +1 -5
- data/lib/jiji/operator.rb +12 -30
- data/lib/jiji/plugin/embedded/click_securities_demo_plugin.rb +140 -0
- data/lib/jiji/plugin/embedded/single_click_client.rb +107 -0
- data/lib/jiji/plugin/plugin_loader.rb +53 -0
- data/lib/jiji/plugin/securities_plugin.rb +135 -0
- data/lib/jiji/registry.rb +24 -19
- data/lib/jiji/server.rb +3 -1
- data/lib/jiji/service/rate_service.rb +7 -2
- data/lib/jiji/util/block_to_session.rb +4 -4
- data/lib/jiji/util/util.rb +0 -67
- data/lib/jiji_plugin.rb +6 -0
- data/swf/build.xml +1 -1
- data/swf/chart/fx/chart/Chart.as +6 -4
- data/swf/chart/fx/chart/ctrl/Controller.as +12 -0
- data/swf/chart/fx/chart/model/Model.as +3 -1
- data/swf/chart/fx/chart/ui/RangeInfoWindow.as +1 -1
- data/swf/chart/fx/chart/ui/ScaleSelector.as +6 -17
- data/test/OutputregistryTest/conf/configuration.yaml +3 -0
- data/test/ProcessManagerTest/conf/configuration.yaml +4 -17
- data/test/{test_AgentManager.rb → agent/test_AgentManager.rb} +37 -39
- data/test/{test_AgentRegistry.rb → agent/test_AgentRegistry.rb} +3 -2
- data/test/{test_PeriodicallyAgent.rb → agent/test_PeriodicallyAgent.rb} +7 -6
- data/test/{test_Permitter.rb → agent/test_Permitter.rb} +10 -9
- data/test/all_tests.rb +31 -24
- data/test/{test_RateDao.rb → dao/test_RateDao.rb} +5 -5
- data/test/{test_TradeResultDao.rb → dao/test_TradeResultDao.rb} +12 -11
- data/test/jiji_plugin.rb +7 -0
- data/test/migration/migrator1_1_0test_data/configuration.yaml +11 -0
- data/test/migration/test_Migrator1_1_0.rb +56 -0
- data/test/{test_SingleClickClient.rb → plugin/embedded/test_SingleClickClient.rb} +44 -14
- data/test/plugin/error_test/jiji_plugin.rb +2 -0
- data/test/plugin/test/foo_plugin.rb +1 -0
- data/test/plugin/test/jiji_plugin.rb +2 -0
- data/test/plugin/test_Loader.rb +33 -0
- data/test/plugin/test_gem/a/jiji_plugin_test_gem_a-1.0.0.gem +0 -0
- data/test/plugin/test_gem/a/jiji_plugin_test_gem_a.gemspec +10 -0
- data/test/plugin/test_gem/a/lib/jiji_plugin.rb +2 -0
- data/test/plugin/test_gem/a/lib/jiji_plugin_test.rb +6 -0
- data/test/plugin/test_gem/b/jiji_plugin_test_gem_b-1.0.0.gem +0 -0
- data/test/plugin/test_gem/b/jiji_plugin_test_gem_b.gemspec +9 -0
- data/test/plugin/test_gem/b/lib/jiji_plugin.rb +2 -0
- data/test/test_BackTestCollector.rb +12 -20
- data/test/test_Collector.rb +16 -32
- data/test/test_Configuration.rb +3 -3
- data/test/test_Operator.rb +9 -9
- data/test/test_Output.rb +2 -3
- data/test/test_Output_registry.rb +9 -9
- data/test/test_Process.rb +6 -6
- data/test/test_ProcessManager.rb +11 -9
- data/test/test_utils.rb +49 -0
- data/test/{test_BlockToSession.rb → util/test_BlockToSession.rb} +57 -9
- data/test/{test_CSV.rb → util/test_CSV.rb} +5 -5
- data/test/{test_SynchronizeInterceptor.rb → util/test_SynchronizeInterceptor.rb} +5 -3
- metadata +59 -26
- data/lib/jiji/single_click_client.rb +0 -95
- data/test/test_configuration.yaml +0 -16
- data/test/testutils.rb +0 -37
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.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masaya Yamauchi
|
@@ -440,10 +440,15 @@ files:
|
|
440
440
|
- lib/jiji/error.rb
|
441
441
|
- lib/jiji/migration/migrator.rb
|
442
442
|
- lib/jiji/migration/migrator1_0_3.rb
|
443
|
+
- lib/jiji/migration/migrator1_1_0.rb
|
443
444
|
- lib/jiji/models.rb
|
444
445
|
- lib/jiji/observer.rb
|
445
446
|
- lib/jiji/operator.rb
|
446
447
|
- lib/jiji/output.rb
|
448
|
+
- lib/jiji/plugin/embedded/click_securities_demo_plugin.rb
|
449
|
+
- lib/jiji/plugin/embedded/single_click_client.rb
|
450
|
+
- lib/jiji/plugin/plugin_loader.rb
|
451
|
+
- lib/jiji/plugin/securities_plugin.rb
|
447
452
|
- lib/jiji/process.rb
|
448
453
|
- lib/jiji/process_manager.rb
|
449
454
|
- lib/jiji/registry.rb
|
@@ -455,7 +460,6 @@ files:
|
|
455
460
|
- lib/jiji/service/rate_service.rb
|
456
461
|
- lib/jiji/service/system_service.rb
|
457
462
|
- lib/jiji/service/trade_result_service.rb
|
458
|
-
- lib/jiji/single_click_client.rb
|
459
463
|
- lib/jiji/util/block_to_session.rb
|
460
464
|
- lib/jiji/util/cache.rb
|
461
465
|
- lib/jiji/util/csv_append_support.rb
|
@@ -467,6 +471,7 @@ files:
|
|
467
471
|
- lib/jiji/util/synchronize_interceptor.rb
|
468
472
|
- lib/jiji/util/thread_use_generator.rb
|
469
473
|
- lib/jiji/util/util.rb
|
474
|
+
- lib/jiji_plugin.rb
|
470
475
|
- swf/build.xml
|
471
476
|
- swf/chart/fx/chart/Chart.as
|
472
477
|
- swf/chart/fx/chart/ctrl/AutoUpdate.as
|
@@ -569,6 +574,10 @@ files:
|
|
569
574
|
- swf/chart/FxChart.mxml
|
570
575
|
- swf/chart/log.as
|
571
576
|
- swf/lib/corelib.swc
|
577
|
+
- test/agent/test_AgentManager.rb
|
578
|
+
- test/agent/test_AgentRegistry.rb
|
579
|
+
- test/agent/test_PeriodicallyAgent.rb
|
580
|
+
- test/agent/test_Permitter.rb
|
572
581
|
- test/all_tests.rb
|
573
582
|
- test/BackCollectorTest/basic/2008-08-04/AUDJPY.csv
|
574
583
|
- test/BackCollectorTest/basic/2008-08-04/USDJPY.csv
|
@@ -612,11 +621,29 @@ files:
|
|
612
621
|
- test/BackCollectorTest/lack/ZARJPY/raw/2008-08-04.csv
|
613
622
|
- test/BackCollectorTest/lack/ZARJPY/raw/2008-08-06.csv
|
614
623
|
- test/BackCollectorTest/lack/ZARJPY/raw/2008-08-07.csv
|
624
|
+
- test/dao/test_RateDao.rb
|
625
|
+
- test/dao/test_TradeResultDao.rb
|
626
|
+
- test/jiji_plugin.rb
|
615
627
|
- test/migration/migrator1_0_3test_data/rmt/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml
|
616
628
|
- test/migration/migrator1_0_3test_data/rmt/out/NjM5YWFhZmQtNDFjNy00NjUxLWIwYmItNTc3ZjAyZTg5ODA5/56e75Yuasdwqdd/meta.yaml
|
617
629
|
- test/migration/migrator1_0_3test_data/rmt/out/NjM5YWFhZmQtNDFjNy00NjUxLWIwYmItNTc3ZjAyZTg5ODA5/56e75YuV5bmz5Z2H57ea/meta.yaml
|
630
|
+
- test/migration/migrator1_1_0test_data/configuration.yaml
|
618
631
|
- test/migration/test_Migrator.rb
|
619
632
|
- test/migration/test_Migrator1_0_3.rb
|
633
|
+
- test/migration/test_Migrator1_1_0.rb
|
634
|
+
- test/OutputregistryTest/conf/configuration.yaml
|
635
|
+
- test/plugin/embedded/test_SingleClickClient.rb
|
636
|
+
- test/plugin/error_test/jiji_plugin.rb
|
637
|
+
- test/plugin/test/foo_plugin.rb
|
638
|
+
- test/plugin/test/jiji_plugin.rb
|
639
|
+
- test/plugin/test_gem/a/jiji_plugin_test_gem_a-1.0.0.gem
|
640
|
+
- test/plugin/test_gem/a/jiji_plugin_test_gem_a.gemspec
|
641
|
+
- test/plugin/test_gem/a/lib/jiji_plugin.rb
|
642
|
+
- test/plugin/test_gem/a/lib/jiji_plugin_test.rb
|
643
|
+
- test/plugin/test_gem/b/jiji_plugin_test_gem_b-1.0.0.gem
|
644
|
+
- test/plugin/test_gem/b/jiji_plugin_test_gem_b.gemspec
|
645
|
+
- test/plugin/test_gem/b/lib/jiji_plugin.rb
|
646
|
+
- test/plugin/test_Loader.rb
|
620
647
|
- test/ProcessManagerTest/agents/moving_average.rb
|
621
648
|
- test/ProcessManagerTest/conf/configuration.yaml
|
622
649
|
- test/ProcessManagerTest/rate_datas/EURJPY/raw/2008-08-21.csv
|
@@ -633,27 +660,19 @@ files:
|
|
633
660
|
- test/service/test_AgentService.rb
|
634
661
|
- test/service/test_OutputService.rb
|
635
662
|
- test/service/test_RateService.rb
|
636
|
-
- test/testutils.rb
|
637
|
-
- test/test_AgentManager.rb
|
638
|
-
- test/test_AgentRegistry.rb
|
639
663
|
- test/test_BackTestCollector.rb
|
640
|
-
- test/test_BlockToSession.rb
|
641
664
|
- test/test_Collector.rb
|
642
665
|
- test/test_Configuration.rb
|
643
|
-
- test/test_configuration.yaml
|
644
666
|
- test/test_Configuration_a.yaml
|
645
|
-
- test/test_CSV.rb
|
646
667
|
- test/test_Operator.rb
|
647
668
|
- test/test_Output.rb
|
648
669
|
- test/test_Output_registry.rb
|
649
|
-
- test/test_PeriodicallyAgent.rb
|
650
|
-
- test/test_Permitter.rb
|
651
670
|
- test/test_Process.rb
|
652
671
|
- test/test_ProcessManager.rb
|
653
|
-
- test/
|
654
|
-
- test/
|
655
|
-
- test/
|
656
|
-
- test/
|
672
|
+
- test/test_utils.rb
|
673
|
+
- test/util/test_BlockToSession.rb
|
674
|
+
- test/util/test_CSV.rb
|
675
|
+
- test/util/test_SynchronizeInterceptor.rb
|
657
676
|
has_rdoc: true
|
658
677
|
homepage: http://github.com/unageanu/jiji/tree/master
|
659
678
|
post_install_message:
|
@@ -681,6 +700,10 @@ signing_key:
|
|
681
700
|
specification_version: 2
|
682
701
|
summary: open and free fx auto trade system.
|
683
702
|
test_files:
|
703
|
+
- test/agent/test_AgentManager.rb
|
704
|
+
- test/agent/test_AgentRegistry.rb
|
705
|
+
- test/agent/test_PeriodicallyAgent.rb
|
706
|
+
- test/agent/test_Permitter.rb
|
684
707
|
- test/all_tests.rb
|
685
708
|
- test/BackCollectorTest/basic/2008-08-04/AUDJPY.csv
|
686
709
|
- test/BackCollectorTest/basic/2008-08-04/USDJPY.csv
|
@@ -724,11 +747,29 @@ test_files:
|
|
724
747
|
- test/BackCollectorTest/lack/ZARJPY/raw/2008-08-04.csv
|
725
748
|
- test/BackCollectorTest/lack/ZARJPY/raw/2008-08-06.csv
|
726
749
|
- test/BackCollectorTest/lack/ZARJPY/raw/2008-08-07.csv
|
750
|
+
- test/dao/test_RateDao.rb
|
751
|
+
- test/dao/test_TradeResultDao.rb
|
752
|
+
- test/jiji_plugin.rb
|
727
753
|
- test/migration/migrator1_0_3test_data/rmt/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml
|
728
754
|
- test/migration/migrator1_0_3test_data/rmt/out/NjM5YWFhZmQtNDFjNy00NjUxLWIwYmItNTc3ZjAyZTg5ODA5/56e75Yuasdwqdd/meta.yaml
|
729
755
|
- test/migration/migrator1_0_3test_data/rmt/out/NjM5YWFhZmQtNDFjNy00NjUxLWIwYmItNTc3ZjAyZTg5ODA5/56e75YuV5bmz5Z2H57ea/meta.yaml
|
756
|
+
- test/migration/migrator1_1_0test_data/configuration.yaml
|
730
757
|
- test/migration/test_Migrator.rb
|
731
758
|
- test/migration/test_Migrator1_0_3.rb
|
759
|
+
- test/migration/test_Migrator1_1_0.rb
|
760
|
+
- test/OutputregistryTest/conf/configuration.yaml
|
761
|
+
- test/plugin/embedded/test_SingleClickClient.rb
|
762
|
+
- test/plugin/error_test/jiji_plugin.rb
|
763
|
+
- test/plugin/test/foo_plugin.rb
|
764
|
+
- test/plugin/test/jiji_plugin.rb
|
765
|
+
- test/plugin/test_gem/a/jiji_plugin_test_gem_a-1.0.0.gem
|
766
|
+
- test/plugin/test_gem/a/jiji_plugin_test_gem_a.gemspec
|
767
|
+
- test/plugin/test_gem/a/lib/jiji_plugin.rb
|
768
|
+
- test/plugin/test_gem/a/lib/jiji_plugin_test.rb
|
769
|
+
- test/plugin/test_gem/b/jiji_plugin_test_gem_b-1.0.0.gem
|
770
|
+
- test/plugin/test_gem/b/jiji_plugin_test_gem_b.gemspec
|
771
|
+
- test/plugin/test_gem/b/lib/jiji_plugin.rb
|
772
|
+
- test/plugin/test_Loader.rb
|
732
773
|
- test/ProcessManagerTest/agents/moving_average.rb
|
733
774
|
- test/ProcessManagerTest/conf/configuration.yaml
|
734
775
|
- test/ProcessManagerTest/rate_datas/EURJPY/raw/2008-08-21.csv
|
@@ -745,24 +786,16 @@ test_files:
|
|
745
786
|
- test/service/test_AgentService.rb
|
746
787
|
- test/service/test_OutputService.rb
|
747
788
|
- test/service/test_RateService.rb
|
748
|
-
- test/testutils.rb
|
749
|
-
- test/test_AgentManager.rb
|
750
|
-
- test/test_AgentRegistry.rb
|
751
789
|
- test/test_BackTestCollector.rb
|
752
|
-
- test/test_BlockToSession.rb
|
753
790
|
- test/test_Collector.rb
|
754
791
|
- test/test_Configuration.rb
|
755
|
-
- test/test_configuration.yaml
|
756
792
|
- test/test_Configuration_a.yaml
|
757
|
-
- test/test_CSV.rb
|
758
793
|
- test/test_Operator.rb
|
759
794
|
- test/test_Output.rb
|
760
795
|
- test/test_Output_registry.rb
|
761
|
-
- test/test_PeriodicallyAgent.rb
|
762
|
-
- test/test_Permitter.rb
|
763
796
|
- test/test_Process.rb
|
764
797
|
- test/test_ProcessManager.rb
|
765
|
-
- test/
|
766
|
-
- test/
|
767
|
-
- test/
|
768
|
-
- test/
|
798
|
+
- test/test_utils.rb
|
799
|
+
- test/util/test_BlockToSession.rb
|
800
|
+
- test/util/test_CSV.rb
|
801
|
+
- test/util/test_SynchronizeInterceptor.rb
|
@@ -1,95 +0,0 @@
|
|
1
|
-
|
2
|
-
require "rubygems"
|
3
|
-
require "clickclient"
|
4
|
-
require 'jiji/util/block_to_session'
|
5
|
-
require 'jiji/util/util'
|
6
|
-
require 'jiji/error'
|
7
|
-
|
8
|
-
# エラー発生時に実行時例外になる場合があるので修正。
|
9
|
-
module ClickClient
|
10
|
-
def self.parse( content )
|
11
|
-
doc = REXML::Document.new( content )
|
12
|
-
unless ( doc.text( "./*/responseStatus" ) =~ /OK/ )
|
13
|
-
error = doc.text( "./*/message" )
|
14
|
-
raise "fail. #{error ? error : content }"
|
15
|
-
end
|
16
|
-
return doc
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
|
21
|
-
module JIJI
|
22
|
-
|
23
|
-
#
|
24
|
-
#==クリック証券へのアクセスを集約するためのサービス
|
25
|
-
#
|
26
|
-
class SingleClickClient
|
27
|
-
|
28
|
-
|
29
|
-
def initialize( account, conf, logger )
|
30
|
-
@conf = conf
|
31
|
-
@logger = logger
|
32
|
-
@account = account
|
33
|
-
@session = create_session
|
34
|
-
end
|
35
|
-
|
36
|
-
#リクエストを送付する。
|
37
|
-
#ブロックの第1引数としてセッションが渡される。
|
38
|
-
def request( &block )
|
39
|
-
begin
|
40
|
-
@session.request( &block )
|
41
|
-
rescue
|
42
|
-
# セッション切れの場合、再作成して再実行。
|
43
|
-
if $!.to_s =~ /Out Of Session\./
|
44
|
-
@logger.info "restart single click client."
|
45
|
-
@session.close
|
46
|
-
@session = create_session
|
47
|
-
@session.request( &block )
|
48
|
-
else
|
49
|
-
raise $!
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
#サービスを破棄する。
|
55
|
-
#不要になった場合、必ず実行すること。
|
56
|
-
def close
|
57
|
-
@session.close
|
58
|
-
@logger.info "close single click client."
|
59
|
-
end
|
60
|
-
attr :conf, true
|
61
|
-
attr :logger, true
|
62
|
-
|
63
|
-
private
|
64
|
-
def create_session
|
65
|
-
return Session.new { |wait|
|
66
|
-
logger.info "start single click client."
|
67
|
-
begin
|
68
|
-
JIJI::Util.log_if_error_and_throw( @logger ) {
|
69
|
-
client = ClickClient::Client.new
|
70
|
-
client.host_name = @conf.get([:securities,:host], "https://fx-demo.click-sec.com" )
|
71
|
-
@logger.info "connect host=#{client.host_name}, user=#{@account.user}"
|
72
|
-
client.fx_session(@account.user, @account.password){|fx|
|
73
|
-
wait.call( fx )
|
74
|
-
}
|
75
|
-
}
|
76
|
-
rescue Exception
|
77
|
-
@logger.info "connect failed."
|
78
|
-
e = JIJI::FatalError.new( JIJI::ERROR_NOT_CONNECTED, $!.to_s )
|
79
|
-
wait.call( ErrorSession.new( e ) )
|
80
|
-
end
|
81
|
-
}
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
# 接続エラー時に使用するセッション
|
86
|
-
#常にエラーをスローする。
|
87
|
-
class ErrorSession
|
88
|
-
def initialize(error)
|
89
|
-
@error = error
|
90
|
-
end
|
91
|
-
def method_missing(name, *args, &block)
|
92
|
-
raise @error
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
data/test/testutils.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
|
2
|
-
$: << "../lib"
|
3
|
-
|
4
|
-
|
5
|
-
require "rubygems"
|
6
|
-
require "runit/testcase"
|
7
|
-
require "runit/cui/testrunner"
|
8
|
-
require "jiji/configuration"
|
9
|
-
require "fileutils"
|
10
|
-
require "logger"
|
11
|
-
require 'jiji/util/json_rpc_requestor'
|
12
|
-
|
13
|
-
# テスト用ユーティリティなど。
|
14
|
-
module Test
|
15
|
-
module Constants
|
16
|
-
|
17
|
-
# テスト用設定値
|
18
|
-
CONF = JIJI::Configuration.new File.dirname(__FILE__) + "/test_configuration.yaml"
|
19
|
-
|
20
|
-
ACCOUNT = Struct.new(:user,:password).new(
|
21
|
-
CONF.get([:securities, :account, :user], ""),
|
22
|
-
CONF.get([:securities, :account, :password], "") )
|
23
|
-
|
24
|
-
Info = Struct.new( :trade_unit )
|
25
|
-
Rate = Struct.new( :bid, :ask, :sell_swap, :buy_swap, :date )
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
# サービスのテストの抽象基底クラス
|
30
|
-
class AbstractServiceTest < RUNIT::TestCase
|
31
|
-
def setup
|
32
|
-
end
|
33
|
-
def teardown
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|