unageanu-jiji 1.0.3 → 1.1.0
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/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
@@ -0,0 +1,135 @@
|
|
1
|
+
|
2
|
+
require 'thread'
|
3
|
+
|
4
|
+
module JIJI
|
5
|
+
module Plugin
|
6
|
+
|
7
|
+
#
|
8
|
+
#===証券会社アクセスプラグイン
|
9
|
+
#
|
10
|
+
#証券会社へのアクセスを提供するプラグインのインターフェイスを示すモジュール。
|
11
|
+
#証券会社アクセスプラグインはこのモジュールが示すメソッドを実装する必要があります。
|
12
|
+
#
|
13
|
+
module SecuritiesPlugin
|
14
|
+
|
15
|
+
#プラグイン識別子
|
16
|
+
FUTURE_NAME = :securities
|
17
|
+
|
18
|
+
#プラグインの識別子を返します。
|
19
|
+
def plugin_id
|
20
|
+
end
|
21
|
+
|
22
|
+
#プラグインの表示名を返します。
|
23
|
+
#「jiji setting」での証券会社選択時に使用します。
|
24
|
+
def display_name
|
25
|
+
end
|
26
|
+
|
27
|
+
#「jiji setting」でユーザーに入力を要求するデータの情報を返します。
|
28
|
+
#return:: JIJI::Plugin::Securities::Inputの配列
|
29
|
+
def input_infos
|
30
|
+
end
|
31
|
+
|
32
|
+
#プラグインを初期化します。プラグインの利用が開始される前に1度だけ呼び出されます。
|
33
|
+
#引数として、ユーザーが入力したパラメータが渡されます。
|
34
|
+
#プラグインの利用開始前に一度だけ呼ばれます。
|
35
|
+
#props:: ユーザーが入力したパラメータ(JIJI::Plugin::Securities::Inputのkeyをキーとする設定値の配列)
|
36
|
+
#logger:: ロガー
|
37
|
+
def init_plugin( props, logger )
|
38
|
+
end
|
39
|
+
|
40
|
+
#プラグインを破棄します。jijiの停止時に1度だけ呼び出されます。
|
41
|
+
def destroy_plugin
|
42
|
+
end
|
43
|
+
|
44
|
+
#利用可能な通貨ペア一覧を取得します。
|
45
|
+
#return:: JIJI::Plugin::Securities::Pairの配列
|
46
|
+
def list_pairs
|
47
|
+
end
|
48
|
+
|
49
|
+
#現在のレートを取得します。
|
50
|
+
#return:: 通貨ペア名をキーとするJIJI::Plugin::Securities::Rateのハッシュ
|
51
|
+
def list_rates
|
52
|
+
end
|
53
|
+
|
54
|
+
#成り行きで発注を行います。
|
55
|
+
#pair:: 通貨ペア名
|
56
|
+
#sell_or_buy:: 売(:sell)または買い(:buy)
|
57
|
+
#count:: 取引数量
|
58
|
+
#return:: JIJI::Plugin::Securities::Position
|
59
|
+
def order( pair, sell_or_buy, count )
|
60
|
+
end
|
61
|
+
|
62
|
+
#建玉を決済します。
|
63
|
+
#position_id:: 建玉ID
|
64
|
+
#count:: 取引数量
|
65
|
+
def commit( position_id, count )
|
66
|
+
end
|
67
|
+
|
68
|
+
#===ユーザーに入力を要求するデータの情報
|
69
|
+
#key:: データのキー
|
70
|
+
#description:: 入力時に表示する説明
|
71
|
+
#secure:: UIでの入力値の表示を行うかどうか。trueにするとUI上では「*」で表示されます。
|
72
|
+
#validator:: UIでの入力値のチェックを行うProc。引数として文字列を受け取り、
|
73
|
+
# エラーがあった場合はエラーメッセージ、問題ない場合はnilを返すこと。
|
74
|
+
# nilを指定すると、入力値のチェックを行わない。
|
75
|
+
Input = Struct.new( :key, :description, :secure, :validator )
|
76
|
+
|
77
|
+
#===取引可能な通貨ペア
|
78
|
+
#name:: 通貨ペア名 例) :EURJPY
|
79
|
+
#tade_unit:: 取引単位
|
80
|
+
Pair = Struct.new( :name, :trade_unit )
|
81
|
+
|
82
|
+
#===レート
|
83
|
+
#bid:: bidレート
|
84
|
+
#ask:: askレート
|
85
|
+
#sell_swap:: 売りスワップ
|
86
|
+
#buy_swap:: 買いスワップ
|
87
|
+
Rate = Struct.new( :bid, :ask, :sell_swap, :buy_swap )
|
88
|
+
|
89
|
+
#===建玉
|
90
|
+
#position_id:: 建玉の識別子
|
91
|
+
Position = Struct.new( :position_id )
|
92
|
+
end
|
93
|
+
|
94
|
+
# 証券会社アクセスプラグインのマネージャ
|
95
|
+
class SecuritiesPluginManager
|
96
|
+
|
97
|
+
def initialize
|
98
|
+
@mutex = Mutex.new
|
99
|
+
@selected = nil
|
100
|
+
end
|
101
|
+
|
102
|
+
#登録済みプラグインの一覧を返す。
|
103
|
+
#return:: 登録済みプラグインの配列
|
104
|
+
def all
|
105
|
+
JIJI::Plugin.get( JIJI::Plugin::SecuritiesPlugin::FUTURE_NAME )
|
106
|
+
end
|
107
|
+
|
108
|
+
#選択されたプラグインインスタンスを取得する。
|
109
|
+
#return:: 選択されているプラグインインスタンス
|
110
|
+
def selected
|
111
|
+
return @mutex.synchronize {
|
112
|
+
unless @selected
|
113
|
+
id = conf.get([:securities, :type], "illegal" ).to_sym
|
114
|
+
@selected = all.find {|plugin|
|
115
|
+
id == plugin.plugin_id.to_sym
|
116
|
+
}
|
117
|
+
raise FatalError.new( JIJI::ERROR_NOT_FOUND, "Securities plugin isnot found. plugin_id=#{id}" ) unless @selected
|
118
|
+
@selected.init_plugin( conf.get( [:securities], {} ), @server_logger )
|
119
|
+
end
|
120
|
+
@selected
|
121
|
+
}
|
122
|
+
end
|
123
|
+
|
124
|
+
#プラグインを破棄する。
|
125
|
+
def close
|
126
|
+
@mutex.synchronize {
|
127
|
+
@selected.destroy_plugin if @selected
|
128
|
+
}
|
129
|
+
end
|
130
|
+
attr :server_logger, true
|
131
|
+
attr :conf, true
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
135
|
+
end
|
data/lib/jiji/registry.rb
CHANGED
@@ -15,7 +15,6 @@ require 'jiji/agent/permitter'
|
|
15
15
|
require 'jiji/agent/util'
|
16
16
|
require 'jiji/output'
|
17
17
|
require 'jiji/operator'
|
18
|
-
require 'jiji/single_click_client'
|
19
18
|
require "jiji/dao/rate_dao"
|
20
19
|
require "jiji/dao/trade_result_dao"
|
21
20
|
require 'logger'
|
@@ -32,6 +31,10 @@ require 'jiji/service/system_service'
|
|
32
31
|
|
33
32
|
require 'jiji/migration/migrator'
|
34
33
|
require 'jiji/migration/migrator1_0_3'
|
34
|
+
require 'jiji/migration/migrator1_1_0'
|
35
|
+
|
36
|
+
require 'jiji/plugin/plugin_loader'
|
37
|
+
require 'jiji/plugin/securities_plugin'
|
35
38
|
|
36
39
|
module JIJI
|
37
40
|
|
@@ -52,15 +55,6 @@ module JIJI
|
|
52
55
|
r.register( :conf ) {
|
53
56
|
JIJI::Configuration.new r.base_dir + "/conf/configuration.yaml"
|
54
57
|
}
|
55
|
-
# アカウント(とりあえず設定ファイルから読む)
|
56
|
-
r.register( :account ) {
|
57
|
-
conf = r.conf
|
58
|
-
accountClass = Struct.new(:user, :password)
|
59
|
-
accountClass.new(
|
60
|
-
conf.get([:securities,:account,:user], ""),
|
61
|
-
conf.get([:securities,:account,:password], ""))
|
62
|
-
}
|
63
|
-
|
64
58
|
# レート一覧置き場
|
65
59
|
r.register( :rate_dir ) {
|
66
60
|
dir = r.base_dir + "/" + r.conf.get([:dir,:rate_data], "rate_datas")
|
@@ -93,10 +87,6 @@ module JIJI
|
|
93
87
|
r.permitter.proxy( c, [/^(info|debug|warn|error|fatal|close)$/] )
|
94
88
|
}
|
95
89
|
|
96
|
-
# クライアント
|
97
|
-
r.register( :client ) {
|
98
|
-
JIJI::SingleClickClient.new( r.account, r.conf, r.server_logger )
|
99
|
-
}
|
100
90
|
# Permitter
|
101
91
|
r.register( :permitter ) {
|
102
92
|
JIJI::Permitter.new( 5, 0 )
|
@@ -138,7 +128,6 @@ module JIJI
|
|
138
128
|
r.register( :agent_manager, :model=>:multiton_initialize ) {|c,p,id,failsafe|
|
139
129
|
c = JIJI::AgentManager.new( id, r.agent_registry, r.process_logger(id), failsafe )
|
140
130
|
c.operator = r.operator(id, false, nil) # 作成段階では常に取引は行なわない。
|
141
|
-
c.client = r.client
|
142
131
|
c.registry = r
|
143
132
|
c.conf = r.conf
|
144
133
|
c.trade_result_dao = r.trade_result_dao(id)
|
@@ -162,7 +151,8 @@ module JIJI
|
|
162
151
|
|
163
152
|
# オペレーター
|
164
153
|
r.register( :operator, :model=>:multiton_initialize ) {|c,p,id,trade_enable,money|
|
165
|
-
c = JIJI::RmtOperator.new(r.
|
154
|
+
c = JIJI::RmtOperator.new(r.securities_plugin_manager.selected,
|
155
|
+
r.process_logger(id), r.trade_result_dao(id), trade_enable, money)
|
166
156
|
c.conf = r.conf
|
167
157
|
r.permitter.proxy( c, [/^(sell|buy|commit)$/], [/^(sell|buy)$/])
|
168
158
|
}
|
@@ -173,7 +163,7 @@ module JIJI
|
|
173
163
|
c.observer_manager = r.rmt_observer_manager
|
174
164
|
c.conf = r.conf
|
175
165
|
c.logger = r.process_logger("rmt")
|
176
|
-
c.client = r.
|
166
|
+
c.client = r.securities_plugin_manager.selected
|
177
167
|
c
|
178
168
|
}
|
179
169
|
r.register( :backtest_collector, :model=>:multiton_initialize ) {|c,p,id, start_date, end_date|
|
@@ -181,7 +171,7 @@ module JIJI
|
|
181
171
|
c.observer_manager = r.backtest_observer_manager(id)
|
182
172
|
c.conf = r.conf
|
183
173
|
c.logger = r.process_logger(id)
|
184
|
-
c.client = r.
|
174
|
+
c.client = r.securities_plugin_manager.selected
|
185
175
|
c
|
186
176
|
}
|
187
177
|
|
@@ -256,10 +246,25 @@ module JIJI
|
|
256
246
|
c.server_logger = r.server_logger
|
257
247
|
c.version_file = r.version_file
|
258
248
|
c.migrators = [
|
259
|
-
{ :version=>Gem::Version.new( "1.0.3" ), :migrator=>JIJI::Migration::Migrator1_0_3.new}
|
249
|
+
{ :version=>Gem::Version.new( "1.0.3" ), :migrator=>JIJI::Migration::Migrator1_0_3.new},
|
250
|
+
{ :version=>Gem::Version.new( "1.1.0" ), :migrator=>JIJI::Migration::Migrator1_1_0.new}
|
260
251
|
]
|
261
252
|
c
|
262
253
|
}
|
254
|
+
|
255
|
+
# プラグイン
|
256
|
+
r.register( :plugin_loader ) {
|
257
|
+
c = JIJI::Plugin::Loader.new
|
258
|
+
c.server_logger = r.server_logger
|
259
|
+
c
|
260
|
+
}
|
261
|
+
# Securitiesプラグイン
|
262
|
+
r.register( :securities_plugin_manager ) {
|
263
|
+
c = JIJI::Plugin::SecuritiesPluginManager.new
|
264
|
+
c.conf = r.conf
|
265
|
+
c.server_logger = r.server_logger
|
266
|
+
c
|
267
|
+
}
|
263
268
|
}
|
264
269
|
end
|
265
270
|
|
data/lib/jiji/server.rb
CHANGED
@@ -16,6 +16,8 @@ module JIJI
|
|
16
16
|
JIJI::Util.log_if_error_and_throw(registry.server_logger) {
|
17
17
|
registry.migrator.migrate
|
18
18
|
}
|
19
|
+
# プラグイン
|
20
|
+
registry.plugin_loader.load
|
19
21
|
|
20
22
|
conf = registry[:conf]
|
21
23
|
param[:Port] = conf.get([:server,:port], 7000).to_i
|
@@ -48,7 +50,7 @@ module JIJI
|
|
48
50
|
begin
|
49
51
|
registry.permitter.close
|
50
52
|
ensure
|
51
|
-
registry.
|
53
|
+
registry.securities_plugin_manager.close
|
52
54
|
end
|
53
55
|
end
|
54
56
|
stop_callback_org.call if stop_callback_org
|
@@ -11,6 +11,11 @@ module JIJI
|
|
11
11
|
}
|
12
12
|
return buff
|
13
13
|
end
|
14
|
+
|
15
|
+
# 利用可能な通貨ペアの一覧を取得する。
|
16
|
+
def pairs
|
17
|
+
@rate_dao.list_pairs
|
18
|
+
end
|
14
19
|
|
15
20
|
# 利用可能なレートの開始日時/終了日時を得る。
|
16
21
|
def range( pair )
|
@@ -22,8 +27,8 @@ module JIJI
|
|
22
27
|
# 指定した月で利用可能な日の一覧を得る。
|
23
28
|
def enable( pair, year, month )
|
24
29
|
dao = @rate_dao.dao( pair )
|
25
|
-
|
26
|
-
|
30
|
+
datas = dao.list_data_files( :raw, "#{year}-#{sprintf("%02d", month)}" )
|
31
|
+
datas.map {|d| d[-2,2] }
|
27
32
|
end
|
28
33
|
|
29
34
|
attr :rate_dao, true
|
@@ -43,13 +43,13 @@ class Session
|
|
43
43
|
@error = nil
|
44
44
|
@proc = proc {|*args|
|
45
45
|
begin
|
46
|
-
|
46
|
+
@value = block.call(*args)
|
47
47
|
rescue Exception
|
48
48
|
@error = $!
|
49
49
|
ensure
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
@mutex.synchronize{
|
51
|
+
@finished = true
|
52
|
+
@cv.signal
|
53
53
|
}
|
54
54
|
end
|
55
55
|
}
|
data/lib/jiji/util/util.rb
CHANGED
@@ -7,73 +7,6 @@ module JIJI
|
|
7
7
|
module Util
|
8
8
|
|
9
9
|
module_function
|
10
|
-
# 通貨ペアコードをシンボルに変換する
|
11
|
-
def convert_currency_pair_code(code)
|
12
|
-
case code
|
13
|
-
when ClickClient::FX::USDJPY
|
14
|
-
return :USDJPY
|
15
|
-
when ClickClient::FX::EURJPY
|
16
|
-
return :EURJPY
|
17
|
-
when ClickClient::FX::GBPJPY
|
18
|
-
return :GBPJPY
|
19
|
-
when ClickClient::FX::AUDJPY
|
20
|
-
return :AUDJPY
|
21
|
-
when ClickClient::FX::NZDJPY
|
22
|
-
return :NZDJPY
|
23
|
-
when ClickClient::FX::CADJPY
|
24
|
-
return :CADJPY
|
25
|
-
when ClickClient::FX::CHFJPY
|
26
|
-
return :CHFJPY
|
27
|
-
when ClickClient::FX::ZARJPY
|
28
|
-
return :ZARJPY
|
29
|
-
when ClickClient::FX::EURUSD
|
30
|
-
return :EURUSD
|
31
|
-
when ClickClient::FX::GBPUSD
|
32
|
-
return :GBPUSD
|
33
|
-
when ClickClient::FX::AUDUSD
|
34
|
-
return :AUDUSD
|
35
|
-
when ClickClient::FX::EURCHF
|
36
|
-
return :EURCHF
|
37
|
-
when ClickClient::FX::GBPCHF
|
38
|
-
return :GBPCHF
|
39
|
-
when ClickClient::FX::USDCHF
|
40
|
-
return :USDCHF
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
# シンボルを通貨ペアコードに変換する
|
45
|
-
def convert_currency_pair_code_r(code)
|
46
|
-
case code
|
47
|
-
when :USDJPY
|
48
|
-
return ClickClient::FX::USDJPY
|
49
|
-
when :EURJPY
|
50
|
-
return ClickClient::FX::EURJPY
|
51
|
-
when :GBPJPY
|
52
|
-
return ClickClient::FX::GBPJPY
|
53
|
-
when :AUDJPY
|
54
|
-
return ClickClient::FX::AUDJPY
|
55
|
-
when :NZDJPY
|
56
|
-
return ClickClient::FX::NZDJPY
|
57
|
-
when :CADJPY
|
58
|
-
return ClickClient::FX::CADJPY
|
59
|
-
when :CHFJPY
|
60
|
-
return ClickClient::FX::CHFJPY
|
61
|
-
when :ZARJPY
|
62
|
-
return ClickClient::FX::ZARJPY
|
63
|
-
when :EURUSD
|
64
|
-
return ClickClient::FX::EURUSD
|
65
|
-
when :GBPUSD
|
66
|
-
return ClickClient::FX::GBPUSD
|
67
|
-
when :AUDUSD
|
68
|
-
return ClickClient::FX::AUDUSD
|
69
|
-
when :EURCHF
|
70
|
-
return ClickClient::FX::EURCHF
|
71
|
-
when :GBPCHF
|
72
|
-
return ClickClient::FX::GBPCHF
|
73
|
-
when :USDCHF
|
74
|
-
return ClickClient::FX::USDCHF
|
75
|
-
end
|
76
|
-
end
|
77
10
|
|
78
11
|
#ブロック内で例外が発生したらログに出力する。
|
79
12
|
#発生した例外は内部で握る。
|
data/lib/jiji_plugin.rb
ADDED
data/swf/build.xml
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
<property name="dist.dir" value="../html/swf" />
|
5
5
|
|
6
|
-
<property name="FLEX_HOME" value="
|
6
|
+
<property name="FLEX_HOME" value="../../tool/flex_sdk" />
|
7
7
|
<taskdef resource="flexTasks.tasks" />
|
8
8
|
|
9
9
|
<target name="build.chart" depends="clean">
|
data/swf/chart/fx/chart/Chart.as
CHANGED
@@ -75,7 +75,6 @@ package fx.chart {
|
|
75
75
|
candleChart.onCandleDataChanged, candleChart);
|
76
76
|
|
77
77
|
pointer = new Pointer( model, ctrl, rc );
|
78
|
-
scaleSelector = new ScaleSelector( model, ctrl, rc );
|
79
78
|
|
80
79
|
scroll = new Scroll( model, ctrl, rc );
|
81
80
|
ctrl.addEventListener( fx.chart.ctrl.Event.RANGE_CHANGED,
|
@@ -89,9 +88,12 @@ package fx.chart {
|
|
89
88
|
ctrl.addEventListener( fx.chart.ctrl.Event.OUTPUT_LIST_CHANGED,
|
90
89
|
graphManager.onGraphListChanged, graphManager);
|
91
90
|
|
92
|
-
|
93
|
-
|
94
|
-
|
91
|
+
// 利用可能な通貨ペアの一覧を取得
|
92
|
+
ctrl.requestPairs( function(data:Array):void {
|
93
|
+
scaleSelector = new ScaleSelector( model, ctrl, rc, data );
|
94
|
+
registExternalInterface();
|
95
|
+
ExternalInterface.call( "onChartLoaded" );
|
96
|
+
});
|
95
97
|
|
96
98
|
} catch ( ex:Error ) {
|
97
99
|
//log(ex.message + ":" + ex.getStackTrace());
|
@@ -247,6 +247,18 @@ package fx.chart.ctrl {
|
|
247
247
|
log(error); // TODO
|
248
248
|
} );
|
249
249
|
}
|
250
|
+
/**
|
251
|
+
* 利用可能な通貨ペアの一覧を取得する
|
252
|
+
*/
|
253
|
+
public function requestPairs( callback:Function ):void {
|
254
|
+
rateService.pairs(
|
255
|
+
function( datas:Array ):void {
|
256
|
+
model.pairs = datas;
|
257
|
+
callback.call( null, datas );
|
258
|
+
}, function(error:*):void {
|
259
|
+
log(error); // TODO
|
260
|
+
} );
|
261
|
+
}
|
250
262
|
/**設定を記録する*/
|
251
263
|
public function save( name:String, value:Object ):void {
|
252
264
|
var so:SharedObject = SharedObject.getLocal("chartInfo");
|
@@ -23,6 +23,8 @@ package fx.chart.model {
|
|
23
23
|
/** プロセスID */
|
24
24
|
public var processId:String;
|
25
25
|
|
26
|
+
/** 利用可能な通貨ペア */
|
27
|
+
public var pairs:Array;
|
26
28
|
/** 現在表示している通貨ペア */
|
27
29
|
public var pair:String;
|
28
30
|
/** 現在のスケール */
|
@@ -35,7 +37,7 @@ package fx.chart.model {
|
|
35
37
|
private var _startDate:Date;
|
36
38
|
/** 表示終了日時 */
|
37
39
|
public var endDate:Date;
|
38
|
-
|
40
|
+
|
39
41
|
/**
|
40
42
|
* 全体の開始日時と終了日時
|
41
43
|
* rmtの場合、レートデータの存在期間
|
@@ -20,26 +20,15 @@ package fx.chart.ui {
|
|
20
20
|
private var scaleSelector:ComboBox;
|
21
21
|
|
22
22
|
public function ScaleSelector(model:Model,
|
23
|
-
controller:Controller, rc:RenderingContext ) {
|
23
|
+
controller:Controller, rc:RenderingContext, pairs:Array ) {
|
24
24
|
super( model,controller,rc );
|
25
25
|
|
26
26
|
pairSelector = new ComboBox();
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
{label:"CHF/JPY", data:"CHFJPY"},
|
33
|
-
{label:"AUD/JPY", data:"AUDJPY"},
|
34
|
-
{label:"NZD/JPY", data:"NZDJPY"},
|
35
|
-
{label:"ZAR/JPY", data:"ZARJPY"},
|
36
|
-
{label:"EUR/USD", data:"EURUSD"},
|
37
|
-
{label:"GBP/USD", data:"GBPUSD"},
|
38
|
-
{label:"AUD/USD", data:"AUDUSD"},
|
39
|
-
{label:"USD/CHF", data:"USDCHF"},
|
40
|
-
{label:"EUR/CHF", data:"EURCHF"},
|
41
|
-
{label:"GBP/CHF", data:"GBPCHF"},
|
42
|
-
]);
|
27
|
+
var tmp:Array = [];
|
28
|
+
for (var i:int=0;i<pairs.length;i++) {
|
29
|
+
tmp[i] = {label:pairs[i], data:pairs[i]};
|
30
|
+
}
|
31
|
+
pairSelector.dataProvider = new ArrayCollection(tmp);
|
43
32
|
pairSelector.width = 100;
|
44
33
|
pairSelector.x = rc.stage.ctrl.right - 200 - 5;
|
45
34
|
pairSelector.y = rc.stage.ctrl.top;
|
@@ -1,19 +1,6 @@
|
|
1
1
|
---
|
2
|
+
:securities:
|
3
|
+
:type: mock
|
2
4
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
securities:
|
7
|
-
account:
|
8
|
-
user: "<user-name>"
|
9
|
-
password: "<password>"
|
10
|
-
|
11
|
-
collector:
|
12
|
-
collect: false
|
13
|
-
wait_time: 10
|
14
|
-
|
15
|
-
dir:
|
16
|
-
rate_data: rate_datas
|
17
|
-
process_log: process_logs
|
18
|
-
log: logs
|
19
|
-
html: ../html
|
5
|
+
:collector:
|
6
|
+
collect: false
|