cosgrove 0.0.1rc3 → 0.0.1rc4
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/Rakefile +4 -0
- data/lib/cosgrove/bot.rb +30 -0
- data/lib/cosgrove/market.rb +15 -2
- data/lib/cosgrove/utils.rb +1 -1
- data/lib/cosgrove/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e74c8020277e8316a984eae78b29dbf9923c32f5
|
4
|
+
data.tar.gz: 254b125746cb995e652235f4519da800701bb659
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e635bbd7aaf83d6e57ce0a0ede3725bfd44652a9174ca201ba5a595eb675e2b662d578d89e67e472ef398c39840b39e9ccd684d6543a5ec16ff7ae186dc48d7
|
7
|
+
data.tar.gz: 1ee7aa717a7df2e00c07c811b9567cbee0f4b89d84686fc318474e5e408998241b106ce5cf68f9c894246d59f802877d32a31bfb837f884f09b88df89ca3ad34
|
data/Gemfile.lock
CHANGED
@@ -17,7 +17,7 @@ GIT
|
|
17
17
|
PATH
|
18
18
|
remote: .
|
19
19
|
specs:
|
20
|
-
cosgrove (0.0.
|
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.
|
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
data/lib/cosgrove/bot.rb
CHANGED
@@ -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
|
data/lib/cosgrove/market.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/cosgrove/utils.rb
CHANGED
data/lib/cosgrove/version.rb
CHANGED
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.
|
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-
|
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.
|
616
|
+
rubygems_version: 2.6.12
|
617
617
|
signing_key:
|
618
618
|
specification_version: 4
|
619
619
|
summary: Cosgrove Discord Bo t
|