Module: Finexclub::Fabrication
- Defined in:
- lib/finexclub/fabrication.rb
Instance Method Summary collapse
- #alpha_factory(options = {}) ⇒ Object
- #chart_factory(options = {}) ⇒ Object
- #clear_signals ⇒ Object
- #raw_alpha_hash(options = {}) ⇒ Object
- #raw_zeta_hash(options = {}) ⇒ Object
- #zeta_factory(options = {}) ⇒ Object
Instance Method Details
#alpha_factory(options = {}) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/finexclub/fabrication.rb', line 30 def alpha_factory( = {}) time = [:time] || Time.now { :direction => 1, :index => 30 + rand(70), :time => time.respond_to?(:strftime) ? time.strftime('%H:%M') : time }.merge() end |
#chart_factory(options = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/finexclub/fabrication.rb', line 19 def chart_factory( = {}) date = .delete(:date) || Time.now { :symbol => "eurusd", :timeframe => "h1", :date => date.respond_to?(:strftime) ? date.strftime('%Y-%m-%d') : date, :alpha => (0..23).map {|h| self.alpha_factory(:time => Time.local(Time.now.year, Time.now.month, Time.now.day, h, 1))}, :zeta => (0..23).map {|h| self.zeta_factory(:time => Time.local(Time.now.year, Time.now.month, Time.now.day, h, 1))} }.merge() end |
#clear_signals ⇒ Object
50 51 52 |
# File 'lib/finexclub/fabrication.rb', line 50 def clear_signals Finexclub.signals.collection.remove end |
#raw_alpha_hash(options = {}) ⇒ Object
3 4 5 |
# File 'lib/finexclub/fabrication.rb', line 3 def raw_alpha_hash( = {}) {"symbol" => "EURUSD", "timeframe" => 'h1', "index"=>"2", "direction"=>"1"}.merge() end |
#raw_zeta_hash(options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/finexclub/fabrication.rb', line 7 def raw_zeta_hash(={}) { "symbol" => "EURUSD", "timeframe" => "h1", "up_support" => "1.124", "up_resist" => "1.123", "down_support" => "1.124", "down_resist" => "1.123", "screenshot_filename" => "egg.png" }.merge() end |
#zeta_factory(options = {}) ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/finexclub/fabrication.rb', line 39 def zeta_factory( = {}) time = [:time] || Time.now { :up_support => (1.1 + rand), :up_resist => 1.1 + rand, :down_support => 1.1 + rand, :down_resist => 1.2 + rand, :screenshot_uid => "ololo" }.merge() end |