finexclub 0.1.1 → 0.2.1
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/VERSION +1 -1
- data/bin/finexclub_updater +101 -40
- data/finexclub.gemspec +9 -3
- data/lib/finexclub/chart.rb +10 -16
- data/lib/finexclub/core.rb +7 -4
- data/lib/finexclub/fabrication.rb +0 -7
- data/lib/finexclub/images.rb +3 -2
- data/lib/finexclub/signals/octopus.rb +19 -0
- data/lib/finexclub/signals/prognosis.rb +16 -0
- data/spec/finexclub/alpha_spec.rb +12 -12
- data/spec/finexclub/chart_spec.rb +23 -13
- data/spec/finexclub/core_spec.rb +9 -1
- data/spec/finexclub/octopus_spec.rb +38 -0
- data/spec/finexclub/prognosis_spec.rb +32 -0
- metadata +9 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.1
|
data/bin/finexclub_updater
CHANGED
@@ -7,45 +7,94 @@ require "cgi"
|
|
7
7
|
require File.dirname(__FILE__) + "/../lib/finexclub"
|
8
8
|
require "optparse"
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
module Generator
|
11
|
+
class << self
|
12
|
+
def get(gen)
|
13
|
+
class_name = gen.to_s.gsub(/^(.)/) { $1.upcase }
|
14
|
+
const_get(class_name).new
|
15
|
+
end
|
16
|
+
|
17
|
+
def all
|
18
|
+
constants.map { |e| e.downcase }
|
19
|
+
end
|
20
|
+
|
21
|
+
def rand_price(n = nil)
|
22
|
+
n ||= 10000
|
23
|
+
rand(n)/n.to_f
|
24
|
+
end
|
25
|
+
|
26
|
+
def rand_index
|
27
|
+
rand(100)
|
17
28
|
end
|
18
29
|
end
|
19
|
-
end
|
20
30
|
|
21
|
-
|
22
|
-
|
23
|
-
|
31
|
+
|
32
|
+
class Alpha
|
33
|
+
def name
|
34
|
+
'alpha'
|
35
|
+
end
|
36
|
+
|
37
|
+
def generate(options = {})
|
38
|
+
Finexclub::Chart::SYMBOLS.inject([]) do |data, symbol|
|
39
|
+
data << ["alpha[][symbol]", symbol.upcase]
|
40
|
+
data << ["alpha[][index]", Generator.rand_index]
|
41
|
+
data << ["alpha[][direction]", rand > 0.5? 1 : 0]
|
42
|
+
end
|
43
|
+
end
|
24
44
|
end
|
25
45
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
46
|
+
class Zeta
|
47
|
+
def name
|
48
|
+
'zeta'
|
49
|
+
end
|
50
|
+
|
51
|
+
def generate(options = {})
|
52
|
+
symbol = options[:symbol] || raise("--symbol option is missing")
|
53
|
+
data = []
|
54
|
+
data << ["zeta[][symbol]", symbol.upcase]
|
55
|
+
data << ["zeta[][up_support]", Generator.rand_price]
|
56
|
+
data << ["zeta[][up_resist]", Generator.rand_price]
|
57
|
+
data << ["zeta[][down_support]", Generator.rand_price]
|
58
|
+
data << ["zeta[][down_resist]", Generator.rand_price]
|
59
|
+
data << ["zeta[][screenshot_filename]", "#{symbol.upcase}_ZETA.gif"]
|
31
60
|
end
|
32
61
|
end
|
33
|
-
end
|
34
62
|
|
35
|
-
class
|
36
|
-
|
37
|
-
|
63
|
+
class Prognosis
|
64
|
+
def name
|
65
|
+
'prognosis'
|
66
|
+
end
|
67
|
+
|
68
|
+
def generate(options = {})
|
69
|
+
symbol = options[:symbol] || raise("--symbol option is missing")
|
70
|
+
actions = %w(buy sell hold_sell hold_buy stop)
|
71
|
+
data = []
|
72
|
+
data << ["prognosis[][symbol]", symbol.upcase]
|
73
|
+
data << ["prognosis[][action]", actions[rand(actions.size)]]
|
74
|
+
data << ["prognosis[][take_profit]", Generator.rand_price]
|
75
|
+
data << ["prognosis[][profit]", Generator.rand_index]
|
76
|
+
data << ["prognosis[][screenshot_filename]", "PROGNOSIS.png"]
|
77
|
+
end
|
38
78
|
end
|
39
79
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
80
|
+
class Octopus
|
81
|
+
def name
|
82
|
+
'octopus'
|
83
|
+
end
|
84
|
+
|
85
|
+
def generate(options = {})
|
86
|
+
symbol = options[:symbol] || raise("--symbol option is missing")
|
87
|
+
actions = %w(buy sell hold_sell hold_buy stop)
|
88
|
+
data = []
|
89
|
+
data << ["octopus[][symbol]", symbol.upcase]
|
90
|
+
data << ["octopus[][action]", actions[rand(actions.size)]]
|
91
|
+
data << ["octopus[][take_profit]", Generator.rand_price]
|
92
|
+
data << ["octopus[][profit]", rand(100)]
|
93
|
+
data << ["octopus[][stop_loss]", Generator.rand_price]
|
94
|
+
data << ["octopus[][loss]", rand(100)]
|
95
|
+
data << ["octopus[][index]", Generator.rand_index]
|
96
|
+
data << ["octopus[][screenshot_filename]", "OCTOPUS.png"]
|
97
|
+
end
|
49
98
|
end
|
50
99
|
end
|
51
100
|
|
@@ -73,11 +122,13 @@ class FakeUpdater
|
|
73
122
|
end
|
74
123
|
end
|
75
124
|
|
125
|
+
STRATEGIES = %w(trends finexclub)
|
126
|
+
|
76
127
|
options = {}
|
77
128
|
options[:host] = 'localhost'
|
78
129
|
options[:port] = 9292
|
79
130
|
opts = OptionParser.new do |opts|
|
80
|
-
opts.banner = "Usage:
|
131
|
+
opts.banner = "Usage: finexclub_updater [options]"
|
81
132
|
|
82
133
|
opts.on("-a", "--address ADDRESS", "Host to send, default is #{options[:host]}") do |h|
|
83
134
|
options[:host] = h
|
@@ -96,25 +147,35 @@ opts = OptionParser.new do |opts|
|
|
96
147
|
exit
|
97
148
|
end
|
98
149
|
|
99
|
-
opts.on_tail("-g GENERATOR",
|
150
|
+
opts.on_tail("-g GENERATOR", Generator.all, "One of the generators to send (#{(Generator.all).join(', ')})") do |g|
|
100
151
|
options[:generator] = g
|
101
152
|
end
|
153
|
+
|
154
|
+
opts.on_tail("-r STRATEGY", STRATEGIES, "One of the strategies to use (#{STRATEGIES.join(', ')})") do |r|
|
155
|
+
options[:strategy] = r
|
156
|
+
end
|
102
157
|
end
|
103
158
|
opts.parse!
|
104
159
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
160
|
+
unless options[:generator].nil?
|
161
|
+
FakeUpdater.new(options[:host], options[:port]).send(Generator.get(options[:generator]), options)
|
162
|
+
exit
|
163
|
+
end
|
164
|
+
|
165
|
+
case options[:strategy]
|
166
|
+
when 'trends'
|
109
167
|
f = FakeUpdater.new(options[:host], options[:port])
|
110
|
-
|
111
|
-
z = ZetaGen.new
|
112
|
-
f.send(a)
|
168
|
+
f.send(Generator::Alpha.new)
|
113
169
|
Finexclub::Chart::SYMBOLS.each do |symbol|
|
114
|
-
f.send(
|
170
|
+
f.send(Generator::Zeta.new, :symbol => symbol)
|
171
|
+
end
|
172
|
+
when 'finexclub'
|
173
|
+
f = FakeUpdater.new(options[:host], options[:port])
|
174
|
+
Finexclub::Chart::SYMBOLS.each do |symbol|
|
175
|
+
f.send(Generator::Octopus.new, :symbol => symbol)
|
176
|
+
f.send(Generator::Prognosis.new, :symbol => symbol)
|
115
177
|
end
|
116
178
|
else
|
117
179
|
puts opts
|
118
180
|
end
|
119
181
|
|
120
|
-
|
data/finexclub.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{finexclub}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Alex Levin"]
|
12
|
-
s.date = %q{2010-10-
|
12
|
+
s.date = %q{2010-10-11}
|
13
13
|
s.default_executable = %q{finexclub_updater}
|
14
14
|
s.description = %q{Finexclub gem stores and retrieves Forex signals and screenshots. It is the heart of the http://trendsonforex.com and http://finexclub.net}
|
15
15
|
s.email = %q{clubfinex@gmail.com}
|
@@ -38,6 +38,8 @@ Gem::Specification.new do |s|
|
|
38
38
|
"lib/finexclub/manager.rb",
|
39
39
|
"lib/finexclub/signal.rb",
|
40
40
|
"lib/finexclub/signals/alpha.rb",
|
41
|
+
"lib/finexclub/signals/octopus.rb",
|
42
|
+
"lib/finexclub/signals/prognosis.rb",
|
41
43
|
"lib/finexclub/signals/zeta.rb",
|
42
44
|
"samples/egg.png",
|
43
45
|
"spec/finexclub/alpha_spec.rb",
|
@@ -47,6 +49,8 @@ Gem::Specification.new do |s|
|
|
47
49
|
"spec/finexclub/document_spec.rb",
|
48
50
|
"spec/finexclub/images_spec.rb",
|
49
51
|
"spec/finexclub/manager_spec.rb",
|
52
|
+
"spec/finexclub/octopus_spec.rb",
|
53
|
+
"spec/finexclub/prognosis_spec.rb",
|
50
54
|
"spec/finexclub/signal_spec.rb",
|
51
55
|
"spec/finexclub/zeta_spec.rb",
|
52
56
|
"spec/spec_helper.rb"
|
@@ -57,11 +61,13 @@ Gem::Specification.new do |s|
|
|
57
61
|
s.rubygems_version = %q{1.3.6}
|
58
62
|
s.summary = %q{Little helper to maintain Forex signals and screenshots}
|
59
63
|
s.test_files = [
|
60
|
-
"spec/finexclub/
|
64
|
+
"spec/finexclub/octopus_spec.rb",
|
65
|
+
"spec/finexclub/signal_spec.rb",
|
61
66
|
"spec/finexclub/manager_spec.rb",
|
62
67
|
"spec/finexclub/app_spec.rb",
|
63
68
|
"spec/finexclub/alpha_spec.rb",
|
64
69
|
"spec/finexclub/core_spec.rb",
|
70
|
+
"spec/finexclub/prognosis_spec.rb",
|
65
71
|
"spec/finexclub/images_spec.rb",
|
66
72
|
"spec/finexclub/chart_spec.rb",
|
67
73
|
"spec/finexclub/document_spec.rb",
|
data/lib/finexclub/chart.rb
CHANGED
@@ -15,26 +15,20 @@ module Finexclub
|
|
15
15
|
@signals = {}
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
[:alpha, :zeta, :octopus, :prognosis].each do |indicator|
|
19
|
+
define_method("#{indicator}=") do |arr|
|
20
|
+
@signals[indicator] = arr
|
21
|
+
end
|
22
|
+
|
23
|
+
define_method(indicator) do
|
24
|
+
Signal.build(core, indicator, signals(indicator).last)
|
25
|
+
end
|
20
26
|
end
|
21
27
|
|
22
|
-
def
|
23
|
-
@signals[
|
24
|
-
end
|
25
|
-
|
26
|
-
def signals(type)
|
27
|
-
@signals[type]
|
28
|
-
end
|
29
|
-
|
30
|
-
def alpha
|
31
|
-
Signal.build(core, :alpha, signals(:alpha).last)
|
28
|
+
def signals(indicator)
|
29
|
+
@signals[indicator]
|
32
30
|
end
|
33
31
|
|
34
|
-
def zeta
|
35
|
-
Signal.build(core, :zeta, signals(:zeta).last)
|
36
|
-
end
|
37
|
-
|
38
32
|
def to_doc
|
39
33
|
{:symbol => symbol, :date => updated_date}
|
40
34
|
end
|
data/lib/finexclub/core.rb
CHANGED
@@ -24,11 +24,14 @@ module Finexclub
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
def find(
|
28
|
-
|
27
|
+
def find(symbol_or_array, date)
|
28
|
+
case symbol_or_array
|
29
|
+
when :all
|
29
30
|
signals.find(:date => date)
|
30
|
-
|
31
|
-
signals.
|
31
|
+
when Array
|
32
|
+
signals.find(:date => date, :symbol => {:$in => symbol_or_array})
|
33
|
+
when String
|
34
|
+
signals.find_one(:date => date, :symbol => symbol_or_array)
|
32
35
|
end
|
33
36
|
end
|
34
37
|
end
|
@@ -46,13 +46,6 @@ module Finexclub
|
|
46
46
|
}.merge(options)
|
47
47
|
end
|
48
48
|
|
49
|
-
def add_signals
|
50
|
-
Chart::SYMBOLS.each do |symbol|
|
51
|
-
Finexclub.store(:alpha, raw_alpha_hash("symbol"=>symbol.upcase))
|
52
|
-
Finexclub.store(:zeta, raw_zeta_hash("symbol"=>symbol.upcase))
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
49
|
def clear_signals
|
57
50
|
Finexclub.signals.collection.remove
|
58
51
|
end
|
data/lib/finexclub/images.rb
CHANGED
@@ -16,8 +16,9 @@ module Finexclub
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def store(filename)
|
19
|
-
path =
|
20
|
-
|
19
|
+
path = screenshot_path || ""
|
20
|
+
file = File.expand_path(File.join(path, filename))
|
21
|
+
app.store File.new(file)
|
21
22
|
end
|
22
23
|
|
23
24
|
def configure_endpoint(path_prefix = nil)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Finexclub
|
2
|
+
module Signals
|
3
|
+
|
4
|
+
class Octopus < Signal
|
5
|
+
field :symbol, :symbol
|
6
|
+
field :updated, :timestamp
|
7
|
+
field :action, :string
|
8
|
+
field :take_profit, :float
|
9
|
+
field :profit, :integer
|
10
|
+
field :stop_loss, :float
|
11
|
+
field :loss, :integer
|
12
|
+
field :index, :integer
|
13
|
+
field :screenshot, :image
|
14
|
+
|
15
|
+
doc_fields :updated, :action, :take_profit, :profit, :stop_loss, :loss, :index, :screenshot
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Finexclub
|
2
|
+
module Signals
|
3
|
+
|
4
|
+
class Prognosis < Signal
|
5
|
+
field :symbol, :symbol
|
6
|
+
field :updated, :timestamp
|
7
|
+
field :action, :string
|
8
|
+
field :take_profit, :float
|
9
|
+
field :profit, :integer
|
10
|
+
field :screenshot, :image
|
11
|
+
|
12
|
+
doc_fields :updated, :action, :take_profit, :profit, :screenshot
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -3,13 +3,13 @@ require File.dirname(__FILE__) + '/../spec_helper'
|
|
3
3
|
describe 'Finexclub::Signals::Alpha' do
|
4
4
|
before do
|
5
5
|
@core = mock_core
|
6
|
-
@
|
6
|
+
@signal = Finexclub::Signals::Alpha.new(@core)
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'should provide attribute accessors' do
|
10
|
-
@
|
11
|
-
@
|
12
|
-
@
|
10
|
+
@signal.build("direction" => 1, "index" => 100)
|
11
|
+
@signal.direction.should == 1
|
12
|
+
@signal.index.should == 100
|
13
13
|
end
|
14
14
|
|
15
15
|
{
|
@@ -18,8 +18,8 @@ describe 'Finexclub::Signals::Alpha' do
|
|
18
18
|
0 => :bearish
|
19
19
|
}.each do |direction, trend|
|
20
20
|
it "should return #{trend} trend when direction is #{direction}" do
|
21
|
-
@
|
22
|
-
@
|
21
|
+
@signal.direction = direction
|
22
|
+
@signal.trend.should == trend
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -31,17 +31,17 @@ describe 'Finexclub::Signals::Alpha' do
|
|
31
31
|
:unstable => 0..60
|
32
32
|
}.each do |stability, range|
|
33
33
|
it "should return #{stability} stability when index within #{range}" do
|
34
|
-
@
|
35
|
-
@
|
34
|
+
@signal.index = range.first
|
35
|
+
@signal.stability.should == stability
|
36
36
|
|
37
|
-
@
|
38
|
-
@
|
37
|
+
@signal.index = range.last
|
38
|
+
@signal.stability.should == stability
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'should export valid doc' do
|
43
|
-
@
|
44
|
-
@
|
43
|
+
@signal.build("direction" => 1, "index" => 100, "updated" => 123)
|
44
|
+
@signal.to_doc.should == {:updated => 123, :index => 100, :direction => 1}
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -27,19 +27,6 @@ describe 'Finexclub::Chart' do
|
|
27
27
|
@chart.date.should == '2010-09-08'
|
28
28
|
@chart.updated.should == @ts
|
29
29
|
end
|
30
|
-
|
31
|
-
it 'should return all alpha signals' do
|
32
|
-
@chart.signals(:alpha).should.equal [@a1, @a2]
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'should return all zeta signals' do
|
36
|
-
@chart.signals(:zeta).should.equal [@z1, @z2]
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'should return latest alpha signal as Alpha' do
|
40
|
-
Finexclub::Signal.should.receive(:build).with(@core, :alpha, @a2).and_return(a = mock('alpha'))
|
41
|
-
@chart.alpha.should == a
|
42
|
-
end
|
43
30
|
|
44
31
|
it 'should return latest zeta signals as Zeta' do
|
45
32
|
Finexclub::Signal.should.receive(:build).with(@core, :zeta, @z2).and_return(z = mock('zeta'))
|
@@ -47,5 +34,28 @@ describe 'Finexclub::Chart' do
|
|
47
34
|
end
|
48
35
|
end
|
49
36
|
|
37
|
+
[
|
38
|
+
:alpha,
|
39
|
+
:zeta,
|
40
|
+
:octopus,
|
41
|
+
:prognosis
|
42
|
+
].each do |indicator|
|
43
|
+
describe "#{indicator} signals" do
|
44
|
+
before do
|
45
|
+
@s1, @s2 = mock("signal_#{indicator}_1"), mock("signal_#{indicator}_2")
|
46
|
+
@chart.build(indicator => [@s1, @s2])
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should provide :#{indicator} signals" do
|
50
|
+
@chart.signals(indicator).should == [@s1, @s2]
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should return latest :#{indicator} wrapped as Signal" do
|
54
|
+
Finexclub::Signal.should.receive(:build).with(@core, indicator, @s2).and_return(a = mock('signal'))
|
55
|
+
@chart.send(indicator).should == a
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
50
60
|
end
|
51
61
|
|
data/spec/finexclub/core_spec.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
Finexclub.configure do |f|
|
4
|
+
f.signals.db = Mongo::Connection.new.db("finexclub_test")
|
5
|
+
end
|
4
6
|
|
7
|
+
describe 'Finexclub::Core' do
|
5
8
|
describe '.instance' do
|
6
9
|
it 'should create instance if it does not already exists' do
|
7
10
|
app = Finexclub::Core.instance
|
@@ -66,6 +69,11 @@ describe 'Finexclub::Core' do
|
|
66
69
|
@core.find(:all, "2010-10-01").should == c
|
67
70
|
end
|
68
71
|
|
72
|
+
it 'should fetch an array of charts for given date' do
|
73
|
+
@core.signals.should.receive(:find).with({:symbol => {:$in => ["eurusd", "usdjpy"]}, :date => "2010-10-01"}).and_return(c = mock('cursor'))
|
74
|
+
@core.find(["eurusd", "usdjpy"], "2010-10-01").should == c
|
75
|
+
end
|
76
|
+
|
69
77
|
it 'should allow fetching signals by date and symbol' do
|
70
78
|
@core.signals.should.receive(:find_one).with({:date => "2010-10-01", :symbol => "eurusd"}).and_return(chart = mock('chart'))
|
71
79
|
@core.find("eurusd", "2010-10-01").should == chart
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe 'Finexclub::Signals::Octopus' do
|
4
|
+
before do
|
5
|
+
@core = mock_core
|
6
|
+
@signal = Finexclub::Signals::Octopus.new(@core)
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should have meta' do
|
10
|
+
Finexclub::Signals::Octopus.meta.should == {
|
11
|
+
:updated => :timestamp,
|
12
|
+
:symbol => :symbol,
|
13
|
+
:action => :string,
|
14
|
+
:take_profit => :float,
|
15
|
+
:profit => :integer,
|
16
|
+
:stop_loss => :float,
|
17
|
+
:loss => :integer,
|
18
|
+
:index => :integer,
|
19
|
+
:screenshot => :image
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should export valid doc' do
|
24
|
+
@core.images.stub!(:store).and_return('image_uid')
|
25
|
+
@signal.build("updated" => 123, "action" => "sell", "take_profit" => 1.5, "profit" => 10, "stop_loss" => 1.7, "loss"=>10, "index" => 50, "screenshot_filename"=>"whatever.png")
|
26
|
+
@signal.to_doc.should == {
|
27
|
+
:updated => 123,
|
28
|
+
:action => "sell",
|
29
|
+
:take_profit => 1.5,
|
30
|
+
:profit => 10,
|
31
|
+
:stop_loss => 1.7,
|
32
|
+
:loss => 10,
|
33
|
+
:index => 50,
|
34
|
+
:screenshot => "image_uid"
|
35
|
+
}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe 'Finexclub::Signals::Prognosis' do
|
4
|
+
before do
|
5
|
+
@core = mock_core
|
6
|
+
@prognosis = Finexclub::Signals::Prognosis.new(@core)
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should have meta' do
|
10
|
+
Finexclub::Signals::Prognosis.meta.should == {
|
11
|
+
:updated => :timestamp,
|
12
|
+
:symbol => :symbol,
|
13
|
+
:action => :string,
|
14
|
+
:take_profit => :float,
|
15
|
+
:profit => :integer,
|
16
|
+
:screenshot => :image
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should export valid doc' do
|
21
|
+
@core.images.stub!(:store).and_return('image_uid')
|
22
|
+
@prognosis.build("updated" => 123, "action" => "sell", "take_profit" => 1.5, "profit" => 10, "screenshot_filename"=>"whatever.png")
|
23
|
+
@prognosis.to_doc.should == {
|
24
|
+
:updated => 123,
|
25
|
+
:action => "sell",
|
26
|
+
:take_profit => 1.5,
|
27
|
+
:profit => 10,
|
28
|
+
:screenshot => "image_uid"
|
29
|
+
}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
+
- 2
|
7
8
|
- 1
|
8
|
-
|
9
|
-
version: 0.1.1
|
9
|
+
version: 0.2.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Alex Levin
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
17
|
+
date: 2010-10-11 00:00:00 +07:00
|
18
18
|
default_executable: finexclub_updater
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -130,6 +130,8 @@ files:
|
|
130
130
|
- lib/finexclub/manager.rb
|
131
131
|
- lib/finexclub/signal.rb
|
132
132
|
- lib/finexclub/signals/alpha.rb
|
133
|
+
- lib/finexclub/signals/octopus.rb
|
134
|
+
- lib/finexclub/signals/prognosis.rb
|
133
135
|
- lib/finexclub/signals/zeta.rb
|
134
136
|
- samples/egg.png
|
135
137
|
- spec/finexclub/alpha_spec.rb
|
@@ -139,6 +141,8 @@ files:
|
|
139
141
|
- spec/finexclub/document_spec.rb
|
140
142
|
- spec/finexclub/images_spec.rb
|
141
143
|
- spec/finexclub/manager_spec.rb
|
144
|
+
- spec/finexclub/octopus_spec.rb
|
145
|
+
- spec/finexclub/prognosis_spec.rb
|
142
146
|
- spec/finexclub/signal_spec.rb
|
143
147
|
- spec/finexclub/zeta_spec.rb
|
144
148
|
- spec/spec_helper.rb
|
@@ -173,11 +177,13 @@ signing_key:
|
|
173
177
|
specification_version: 3
|
174
178
|
summary: Little helper to maintain Forex signals and screenshots
|
175
179
|
test_files:
|
180
|
+
- spec/finexclub/octopus_spec.rb
|
176
181
|
- spec/finexclub/signal_spec.rb
|
177
182
|
- spec/finexclub/manager_spec.rb
|
178
183
|
- spec/finexclub/app_spec.rb
|
179
184
|
- spec/finexclub/alpha_spec.rb
|
180
185
|
- spec/finexclub/core_spec.rb
|
186
|
+
- spec/finexclub/prognosis_spec.rb
|
181
187
|
- spec/finexclub/images_spec.rb
|
182
188
|
- spec/finexclub/chart_spec.rb
|
183
189
|
- spec/finexclub/document_spec.rb
|