cosgrove 0.0.1rc3 → 0.0.1rc4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a35112fa8f737be48b28f0e8eabdb56f4f449cf0
4
- data.tar.gz: 821506ba2a2e772a54d4afea0a5bbea72f8b2e5e
3
+ metadata.gz: e74c8020277e8316a984eae78b29dbf9923c32f5
4
+ data.tar.gz: 254b125746cb995e652235f4519da800701bb659
5
5
  SHA512:
6
- metadata.gz: 70a414f368e2dbaded90e754004368d938ec44fd1130d22ddf8ba270e529ec286b06e84afb1cf2788faf4fb4d9447588ad8304aaf4d129744d382218420043ba
7
- data.tar.gz: abff66b69feaa2ba4e939e8398d2df74ba3a36a5b6d295ce8a514e5cb75726145ac3a6e0d73c93a2baab684808236c7b9b7f92df2f2929cf8ea020703c3efacd
6
+ metadata.gz: 9e635bbd7aaf83d6e57ce0a0ede3725bfd44652a9174ca201ba5a595eb675e2b662d578d89e67e472ef398c39840b39e9ccd684d6543a5ec16ff7ae186dc48d7
7
+ data.tar.gz: 1ee7aa717a7df2e00c07c811b9567cbee0f4b89d84686fc318474e5e408998241b106ce5cf68f9c894246d59f802877d32a31bfb837f884f09b88df89ca3ad34
@@ -17,7 +17,7 @@ GIT
17
17
  PATH
18
18
  remote: .
19
19
  specs:
20
- cosgrove (0.0.1rc3)
20
+ cosgrove (0.0.1rc4)
21
21
  activesupport (~> 5.1, >= 5.1.1)
22
22
  ai4r (~> 1.13, >= 1.13)
23
23
  discordrb (~> 3.2, >= 3.2.1)
@@ -79,7 +79,7 @@ GEM
79
79
  docile (1.1.5)
80
80
  domain_name (0.5.20170404)
81
81
  unf (>= 0.0.5, < 1.0.0)
82
- erubi (1.6.0)
82
+ erubi (1.6.1)
83
83
  ethon (0.10.1)
84
84
  ffi (>= 1.3.0)
85
85
  event_emitter (0.2.5)
data/Rakefile CHANGED
@@ -41,3 +41,7 @@ end
41
41
  # task :yank do
42
42
  # exec "gem yank cosgrove -v #{Cosgrove::VERSION}"
43
43
  # end
44
+
45
+ task :rebuild_accounts do
46
+ Cosgrove::Bot.new.rebuild_accounts
47
+ end
@@ -145,5 +145,35 @@ module Cosgrove
145
145
  Cosgrove::UpvoteJob.new(options).perform(event, slug)
146
146
  end
147
147
  end
148
+
149
+ def rebuild_accounts
150
+ chain = :steem
151
+ puts "Rebuilding #{Account::ACCOUNTS_FILE} ..."
152
+
153
+ self.run(:async)
154
+ discord_users = self.users
155
+ ops = SteemData::AccountOperation.where(account: steem_account, to: steem_account, memo: {'$regex' => /.*[a-z]*-[a-z]*-[a-z]*.*/})
156
+ memo_map = {}
157
+
158
+ puts "Discord users: #{discord_users.size}; memos to search: #{ops.count}"
159
+
160
+ ops.each do |op|
161
+ memo_map[op.from] = op.memo
162
+ end
163
+
164
+ discord_users.each do |discord_id, discord_user|
165
+ a = Account.find_by_discord_id(discord_id)
166
+ next if !!a
167
+
168
+ puts "Account not found: #{discord_user.username}"
169
+
170
+ memo_map.each do |from, memo|
171
+ a = Account.new(from, chain)
172
+ if memo == a.memo_key(discord_id)
173
+ puts "Found matching memo key: #{from}"
174
+ end
175
+ end
176
+ end
177
+ end
148
178
  end
149
179
  end
@@ -57,7 +57,17 @@ module Cosgrove
57
57
  btx_usdt_golos = btx_usdt_btc * btx_btc_golos
58
58
  # btx_gbg_golos = btx_usdt_gbg * ( btx_usdt_btc * btx_btc_golos )
59
59
 
60
- [pol_usdt_steem, pol_usdt_sbd, btx_usdt_golos, btx_usdt_gbg]
60
+ btx_btc_steem = JSON[open("https://bittrex.com/api/v1.1/public/getmarketsummary?market=btc-steem").read]
61
+ btx_btc_sbd = JSON[open("https://bittrex.com/api/v1.1/public/getmarketsummary?market=btc-sbd").read]
62
+
63
+ btx_btc_steem = btx_btc_steem['result'].first['Ask'].to_f
64
+ btx_btc_sbd = btx_btc_sbd['result'].first['Ask'].to_f
65
+
66
+ btx_usdt_sbd = btx_usdt_btc * btx_btc_sbd
67
+ btx_usdt_steem = btx_usdt_btc * btx_btc_steem
68
+ # btx_sbd = btx_usdt_sbd * ( btx_usdt_btc * btx_btc_steem )
69
+
70
+ [pol_usdt_steem, pol_usdt_sbd, btx_usdt_golos, btx_usdt_gbg, btx_usdt_steem, btx_usdt_sbd]
61
71
  end
62
72
 
63
73
  def mvests(chain = :steem, account_names = [])
@@ -224,15 +234,18 @@ module Cosgrove
224
234
  end
225
235
 
226
236
  def ticker
227
- pol_usdt_steem, pol_usdt_sbd, btx_usdt_golos, btx_usdt_gbg = market_data
237
+ pol_usdt_steem, pol_usdt_sbd, btx_usdt_golos, btx_usdt_gbg, btx_usdt_steem, btx_usdt_sbd = market_data
228
238
 
229
239
  pol_usdt_steem = number_to_currency(pol_usdt_steem, precision: 4)
230
240
  pol_usdt_sbd = number_to_currency(pol_usdt_sbd, precision: 4)
241
+ btx_usdt_steem = number_to_currency(btx_usdt_steem, precision: 4)
242
+ btx_usdt_sbd = number_to_currency(btx_usdt_sbd, precision: 4)
231
243
  btx_usdt_golos = number_to_currency(btx_usdt_golos, precision: 4)
232
244
  btx_usdt_gbg = number_to_currency(btx_usdt_gbg, precision: 4)
233
245
 
234
246
  ticker = []
235
247
  ticker << "`Poloniex: USD/STEEM: #{pol_usdt_steem}; USD/SBD: #{pol_usdt_sbd}`"
248
+ ticker << "`Bittrex: USD/STEEM: #{btx_usdt_steem}; USD/SBD: #{btx_usdt_sbd}`"
236
249
  ticker << "`Bittrex: USD/GOLOS: #{btx_usdt_golos}; USD/GBG: #{btx_usdt_gbg}`"
237
250
  ticker.join("\n")
238
251
  end
@@ -44,7 +44,7 @@ module Cosgrove
44
44
  end
45
45
 
46
46
  def steem_data_head_block_number
47
- SteemData::Setting.last.last_block
47
+ [SteemData::Setting.last.last_block, SteemData::AccountOperation.last.block].min
48
48
  end
49
49
 
50
50
  def properties(chain)
@@ -1,4 +1,4 @@
1
1
  module Cosgrove
2
- VERSION = '0.0.1rc3'
2
+ VERSION = '0.0.1rc4'
3
3
  AGENT_ID = "cosgrove/#{VERSION}"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cosgrove
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1rc3
4
+ version: 0.0.1rc4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Martin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-24 00:00:00.000000000 Z
11
+ date: 2017-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -613,7 +613,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
613
613
  version: 1.3.1
614
614
  requirements: []
615
615
  rubyforge_project:
616
- rubygems_version: 2.4.8
616
+ rubygems_version: 2.6.12
617
617
  signing_key:
618
618
  specification_version: 4
619
619
  summary: Cosgrove Discord Bo t