Module: Coinbot::OrderBook

Defined in:
lib/coinbot/order_book.rb,
lib/coinbot/order_book/ema.rb,
lib/coinbot/order_book/rsi.rb,
lib/coinbot/order_book/sma.rb,
lib/coinbot/order_book/macd.rb,
lib/coinbot/order_book/wrap_up.rb,
lib/coinbot/order_book/generate.rb,
lib/coinbot/order_book/ema_cross.rb,
lib/coinbot/order_book/indicator.rb,
lib/coinbot/order_book/order_trend.rb,
lib/coinbot/order_book/synchronize.rb,
lib/coinbot/order_book/weighted_avg.rb,
lib/coinbot/order_book/profit_margin.rb,
lib/coinbot/order_book/indicator_history.rb,
lib/coinbot/order_book/stuck_in_position.rb

Overview

This plugin is used to indicate if a 24 hour low was triggered

Defined Under Namespace

Modules: EMA, EMACross, Generate, MACD, OrderTrend, ProfitMargin, RSI, SMA, StuckInPosition, Synchronize, WeightedAvg, WrapUp Classes: Indicator, IndicatorHistory

Class Method Summary collapse

Class Method Details

.analyze(opts = {}) ⇒ Object

Supported Method Parameters

Coinbot::OrderBook.analyze(

order_book_file: 'required - path to order book file'

)



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/coinbot/order_book.rb', line 159

public_class_method def self.analyze(opts = {})
  order_book_file = opts[:order_book_file]
  # TODO: Handle File that exists
  # w/ Zero size...N number of
  # attempts?  Timeout may be better.
  JSON.parse(
    File.read(order_book_file),
    symbolize_names: true
  )
rescue JSON::ParserError => e
  File.open('/tmp/coinbot-errors.txt', 'a') do |f|
    f.puts Time.now.strftime('%Y-%m-%d %H:%M:%S.%N %z')
    f.puts "#{self}\n#{e}\n\n\n"
  end

  retry
rescue StandardError => e
  raise e
end

.base_currency_overridesObject

Supported Method Parameters

base_currency_overrides = Coinbot::OrderBook.base_currency_overrides



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/coinbot/order_book.rb', line 93

public_class_method def self.base_currency_overrides
  %i[
    1inch
    aave
    ada
    amp
    ankr
    bal
    band
    bat
    bnt
    bond
    cgld
    chz
    clv
    comp
    crv
    ctsi
    dot
    enj
    farm
    fet
    fil
    forth
    grt
    gtc
    icp
    keep
    lpt
    lrc
    mana
    mask
    matic
    mir
    mkr
    mln
    nkn
    nmr
    nu
    ogn
    poly
    qnt
    ren
    rly
    shib
    skl
    snx
    sol
    storj
    sushi
    trb
    tribe
    uma
    uni
    wbtc
    yfi
    zrx
  ]
rescue StandardError => e
  raise e
end

.get_populated_indicators(opts = {}) ⇒ Object

Supported Method Parameters

Coinbot::OrderBook.get_populated_indicators(

indicator_status: 'required - indicator_status object instantiated via Coinbot::OrderBook::Indicators'

)



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
# File 'lib/coinbot/order_book.rb', line 28

public_class_method def self.get_populated_indicators(opts = {})
  indicator_status = opts[:indicator_status]

  indicator_type_hash = {}
  indicator_type_hash[:trend_indicator_arr] = []
  trend_indicator_arr = indicator_type_hash[:trend_indicator_arr]

  indicator_type_hash[:health_indicator_arr] = []
  health_indicator_arr = indicator_type_hash[:health_indicator_arr]

  if indicator_status.twenty_four_hr_high_low
    trend_indicator_arr.push(
      indicator_status.twenty_four_hr_high_low
    )
  end

  if indicator_status.order_trend
    trend_indicator_arr.push(
      indicator_status.order_trend
    )
  end

  if indicator_status.ema_cross
    trend_indicator_arr.push(
      indicator_status.ema_cross
    )
  end

  if indicator_status.macd
    trend_indicator_arr.push(
      indicator_status.macd
    )
  end

  if indicator_status.rsi
    trend_indicator_arr.push(
      indicator_status.rsi
    )
  end

  if indicator_status.stuck_in_position
    trend_indicator_arr.push(
      indicator_status.stuck_in_position
    )
  end

  if indicator_status.weighted_avg
    health_indicator_arr.push(
      indicator_status.weighted_avg
    )
  end

  if indicator_status.profit_margin
    health_indicator_arr.push(
      indicator_status.profit_margin
    )
  end

  indicator_type_hash
rescue StandardError => e
  raise e
end

.helpObject

Display Usage for this Module



180
181
182
# File 'lib/coinbot/order_book.rb', line 180

public_class_method def self.help
  constants.sort
end