Module: Coinbot::OrderBook::Synchronize
- Defined in:
- lib/coinbot/order_book/synchronize.rb
Class Method Summary collapse
-
.candles(opts = {}) ⇒ Object
- Supported Method Parameters
-
Coinbot::OrderBook::Synchronize.candle_history( ).
-
.help ⇒ Object
Display Usage for this Module.
Class Method Details
.candles(opts = {}) ⇒ Object
- Supported Method Parameters
-
Coinbot::OrderBook::Synchronize.candle_history( )
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/coinbot/order_book/synchronize.rb', line 12 public_class_method def self.candles(opts = {}) last_ticker_price = opts[:last_ticker_price] this_product = opts[:this_product] candles = opts[:candles] indicator_history = opts[:indicator_history] bot_conf = opts[:bot_conf] ema_low = bot_conf[:exponential_moving_avg][:low].to_i ema_high = bot_conf[:exponential_moving_avg][:high].to_i sma_nine = Coinbot::OrderBook::SMA.calculate( candle_tot: 9, candle_key: :candle_close, candles: candles, last_value: last_ticker_price, this_product: this_product ) candles.last[:sma_nine] = sma_nine sma_fifty = Coinbot::OrderBook::SMA.calculate( candle_tot: 50, candle_key: :candle_close, candles: candles, last_value: last_ticker_price, this_product: this_product ) candles.last[:sma_fifty] = sma_fifty sma_one_eighty = Coinbot::OrderBook::SMA.calculate( candle_tot: 180, candle_key: :candle_close, candles: candles, last_value: last_ticker_price, this_product: this_product ) candles.last[:sma_one_eighty] = sma_one_eighty ema_twelve = Coinbot::OrderBook::EMA.calculate( candle_tot: 12, candle_key: :candle_close, candles: candles, last_value: last_ticker_price, this_product: this_product ) candles.last[:ema_twelve] = ema_twelve ema_twenty_six = Coinbot::OrderBook::EMA.calculate( candle_tot: 26, candle_key: :candle_close, candles: candles, last_value: last_ticker_price, this_product: this_product ) candles.last[:ema_twenty_six] = ema_twenty_six ema_h_avg = Coinbot::OrderBook::EMA.calculate( candle_tot: ema_high, candle_key: :candle_close, candles: candles, last_value: last_ticker_price, this_product: this_product ) candles.last[:ema_high_avg] = ema_h_avg ema_l_avg = Coinbot::OrderBook::EMA.calculate( candle_tot: ema_low, candle_key: :candle_close, candles: candles, last_value: last_ticker_price, this_product: this_product ) candles.last[:ema_low_avg] = ema_l_avg ema_one_eighty = Coinbot::OrderBook::EMA.calculate( candle_tot: 180, candle_key: :candle_close, candles: candles, last_value: last_ticker_price, this_product: this_product ) candles.last[:ema_one_eighty] = ema_one_eighty indicator_history.macd = Coinbot::OrderBook::MACD.calculate( this_product: this_product, last_value: last_ticker_price, candles: candles, macd_history: indicator_history.macd ) candles.last[:macd_history] = indicator_history.macd indicator_history.rsi = Coinbot::OrderBook::RSI.calculate( last_ticker_price: last_ticker_price, candles: candles, rsi_history: indicator_history.rsi ) candles.last[:rsi_history] = indicator_history.macd candles rescue StandardError => e raise e end |
.help ⇒ Object
Display Usage for this Module
116 117 118 119 120 |
# File 'lib/coinbot/order_book/synchronize.rb', line 116 public_class_method def self.help puts "USAGE: ema_cross_indicator_hash = #{self}.status() " end |