create account

How to Find Hidden Gems with Ruby by inertia

View this thread on: hive.blogpeakd.comecency.com
· @inertia ·
$0.47
How to Find Hidden Gems with Ruby
If you're playing the curation game, there are certain strategies to make your vote worth the most.

> A human has a better chance of predicting the success of a random post with no votes than a computer algorithm. At best a computer algorithm could use historic performance of the poster to guess. If an algorithm is used, it will have to be a sophisticated algorithm that actually does add some value. After all, the algorithm isn’t able to vote on everything and gets exponentially weaker more it dilutes its vote.

*Source: [Curation Rewards - steem.io](https://steem.io/getinvolved/paid-to-curate/)*

The blockchain uses some logic create a reverse auction to make voting a little bit bot resistant.

#### Vote After 30 Minutes

This is not an exact science.  Sometimes it's better to vote under 30 minutes if you think a large stakeholder will vote before you.  But all things being equal, it's better to wait until 30 minutes have passed.

---

In addition to the 30 minute timing, I've added a rule to this script: be within the first 10 votes cast.

Often, these two rules are at odds.  So ideally, you would want to search for posts that have less than 10 votes but are older than 30 minutes.  Below is a script that does just that.

However, if you're not into the command line, I've also updated my [Ganymede](https://steemit.com/radiator/@inertia/ganymede-a-growing-collection-of-steem-web-tools) project and added this functionality.  To try this logic out yourself, browse to one of these ...

* [steem-ganymede.herokuapp.com/discussions](https://steem-ganymede.herokuapp.com/discussions)
* [golos-ganymede.herokuapp.com/discussions](https://golos-ganymede.herokuapp.com/discussions)

... then click the `Vote Ready` button.

---

As always, we use [Radiator](https://steemit.com/steem/@inertia/radiator-steem-ruby-api-client) with `bundler`.  You can get `bundler` with this command:

```bash
$ gem install bundler
```

I've tested it on various versions of ruby.  The oldest one I got it to work was:

`ruby 2.0.0p645 (2015-04-13 revision 50299) [x86_64-darwin14.4.0]`

First, make a project folder:

```bash
$ mkdir radiator
$ cd radiator
```

Create a file named `Gemfile` containing:

```ruby
source 'https://rubygems.org'
gem 'radiator', github: 'inertia186/radiator'
```

Then run the command:

```bash
$ bundle install
```

Create a file named `vote_ready.rb` containing:

```ruby
require 'rubygems'
require 'bundler/setup'

Bundler.require

api = Radiator::Api.new

options = {
  limit: 100
}

options[:tag] = @ARGV if ARGV.any?

response = api.get_discussions_by_created(options)

response.result.each do |comment|
  next if comment.active_votes.size > 9
  next if (created = (Time.now - Time.parse(comment.created + ' UTC')).to_i / 60) < 30

  puts "#{created} minutes ago, votes: #{comment.active_votes.size}: http://steemit.com#{comment.url}"
end
```

Then run it:

```bash
$ ruby vote_ready.rb
```

The expected output will be something like this:

```
34 minutes ago, votes: 9: http://steemit.com/pizzagate/@abortionburger/victim-comes-forward-i-was-sexually-assaulted-by-james-alefantis
38 minutes ago, votes: 9: http://steemit.com/food/@lucki9/various-forms-of-cake-home-industri-2
45 minutes ago, votes: 9: http://steemit.com/sports/@vidsmash/wwe-paige-vs-summer-rae-or-wwe-main-event-15-01-2017
46 minutes ago, votes: 9: http://steemit.com/spanish/@steemalf/si-no-tienes-dinero-para-el-surf-siempre-podras-andorrear
48 minutes ago, votes: 9: http://steemit.com/china/@giova/china-wants-to-build-a-200km-long-undersea-tunnel-to-america
49 minutes ago, votes: 9: http://steemit.com/travel/@johnthmouse/i-would-like-to-say-hi-to-every-one-im-new-to-steemit
53 minutes ago, votes: 8: http://steemit.com/cricket/@vidsmash/cricket-funny-moments-2017
57 minutes ago, votes: 8: http://steemit.com/trump/@chahredine/trump-and-the-titanic-effect
57 minutes ago, votes: 8: http://steemit.com/test/@literature/test
58 minutes ago, votes: 9: http://steemit.com/art/@mariashabbir/clouds-from-the-top-of-sky-plane-view
59 minutes ago, votes: 8: http://steemit.com/offers/@pignol/2svvzz-very-serious-and-good-liver-donation
66 minutes ago, votes: 7: http://steemit.com/philosophy/@panopticalvia/pan-op-update
74 minutes ago, votes: 6: http://steemit.com/fox/@talhaansary/rd-3-fox-ama-supercross-2017-live-stream
75 minutes ago, votes: 9: http://steemit.com/steem/@cata22/alt-coin-market-caps-on-january-20
77 minutes ago, votes: 8: http://steemit.com/technology/@stabilitas/how-security-professionals-can-beat-information-overload
```

![ruby](http://www.steemimg.com/images/2016/08/24/1024px-Ruby_logo.svgdcc20.png)

See my previous Ruby How To posts in: [#radiator](https://steemit.com/created/radiator) [#ruby](https://steemit.com/created/ruby)
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 24 others
properties (23)
authorinertia
permlinkhow-to-find-hidden-gems-with-ruby
categoryradiator
json_metadata{"tags":["radiator","ruby","steem","howto","curation"],"image":["http://www.steemimg.com/images/2016/08/24/1024px-Ruby_logo.svgdcc20.png"],"links":["https://steem.io/getinvolved/paid-to-curate/","https://steemit.com/radiator/@inertia/ganymede-a-growing-collection-of-steem-web-tools","https://steem-ganymede.herokuapp.com/discussions","https://golos-ganymede.herokuapp.com/discussions","https://steemit.com/steem/@inertia/radiator-steem-ruby-api-client","https://steemit.com/created/radiator","https://steemit.com/created/ruby"],"app":"steemit/0.1","format":"markdown"}
created2017-01-20 20:12:30
last_update2017-01-20 20:12:30
depth0
children8
last_payout2017-02-20 20:37:39
cashout_time1969-12-31 23:59:59
total_payout_value0.429 HBD
curator_payout_value0.044 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4,765
author_reputation346,568,901,399,561
root_title"How to Find Hidden Gems with Ruby"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd0
post_id2,299,565
net_rshares6,075,059,871,764
author_curate_reward""
vote details (88)
@cardboard ·
Instead of counting votes you can calculate your vote weight before voting:)
Here's the algorithm:
https://steemit.com/steemit/@burnin/reward-shares-understanding-how-your-votes-affect-a-post
properties (22)
authorcardboard
permlinkre-inertia-how-to-find-hidden-gems-with-ruby-20170121t235310589z
categoryradiator
json_metadata{"tags":["radiator"],"links":["https://steemit.com/steemit/@burnin/reward-shares-understanding-how-your-votes-affect-a-post"],"app":"steemit/0.1"}
created2017-01-21 23:53:09
last_update2017-01-21 23:53:09
depth1
children0
last_payout2017-02-20 20:37:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length191
author_reputation31,522,757,177,122
root_title"How to Find Hidden Gems with Ruby"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,309,008
net_rshares0
@deradministrator ·
$8.33
Hey mate, sorry for gravedigging.
I have followed your tutorial and got rid of some errors (ffi make was buggy and so on). Now its seems to work, but after 3-5 sec i wont get a result and no error. Any idea?
πŸ‘  
properties (23)
authorderadministrator
permlinkre-inertia-how-to-find-hidden-gems-with-ruby-20180218t210649989z
categoryradiator
json_metadata{"tags":["radiator"],"app":"steemit/0.1"}
created2018-02-18 21:06:48
last_update2018-02-18 21:06:48
depth1
children4
last_payout2018-02-25 21:06:48
cashout_time1969-12-31 23:59:59
total_payout_value6.252 HBD
curator_payout_value2.082 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length207
author_reputation1,084,361,388,464
root_title"How to Find Hidden Gems with Ruby"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,612,244
net_rshares1,495,275,591,969
author_curate_reward""
vote details (1)
@inertia ·
Yep, I think there's a mistake in that script that nobody ever noticed.

```ruby
  next if (created = (Time.now - Time.parse(comment.created + ' UTC')).to_i / 60) < 30
```

Should be:

```ruby
  next if (created = (Time.now - Time.parse(comment.created + ' UTC')).to_i / 60) > 30
```

You can use this to do the same thing instead:

http://steem-ganymede.herokuapp.com/discussions?vote_ready=true

The code for that is here, which is correct:

https://github.com/steem-third-party/ganymede/blob/master/app/controllers/discussions_controller.rb#L176
πŸ‘  
properties (23)
authorinertia
permlinkre-deradministrator-re-inertia-how-to-find-hidden-gems-with-ruby-20180218t214944488z
categoryradiator
json_metadata{"tags":["radiator"],"links":["http://steem-ganymede.herokuapp.com/discussions?vote_ready=true","https://github.com/steem-third-party/ganymede/blob/master/app/controllers/discussions_controller.rb#L176"],"app":"steemit/0.1"}
created2018-02-18 21:49:45
last_update2018-02-18 21:49:45
depth2
children3
last_payout2018-02-25 21:49:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length548
author_reputation346,568,901,399,561
root_title"How to Find Hidden Gems with Ruby"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,619,521
net_rshares3,940,570,684
author_curate_reward""
vote details (1)
@deradministrator ·
Worked flawless now =) Thank you, couldnt find the error.  Alright, seems like my customizing works somehow. Can you explain me this part with the argv?:
 options[:tag] = @ARGV if ARGV.any? 

I m trying to wrap my head around ruby as a begginer, buts its kinda hard. Thank you for all your effort with your tutorials. They help me a lot :D
properties (22)
authorderadministrator
permlinkre-inertia-re-deradministrator-re-inertia-how-to-find-hidden-gems-with-ruby-20180218t224627108z
categoryradiator
json_metadata{"tags":["radiator"],"users":["argv"],"app":"steemit/0.1"}
created2018-02-18 22:46:27
last_update2018-02-18 22:46:27
depth3
children2
last_payout2018-02-25 22:46:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length339
author_reputation1,084,361,388,464
root_title"How to Find Hidden Gems with Ruby"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,628,897
net_rshares0
@ervin-lemark ·
Your post has been added to [Steem Data Resources - Collection Of Posts About Steem Bots, Data And Mining, Issue No. 3](https://steemit.com/steem/@ervin-lemark/steem-data-resources-collection-of-posts-about-steem-bots-data-and-mining-issue-no-3).

Thank you very much for your work and contribution!
πŸ‘  ,
properties (23)
authorervin-lemark
permlinkre-inertia-how-to-find-hidden-gems-with-ruby-20170125t232702715z
categoryradiator
json_metadata{"tags":["radiator"],"links":["https://steemit.com/steem/@ervin-lemark/steem-data-resources-collection-of-posts-about-steem-bots-data-and-mining-issue-no-3"],"app":"steemit/0.1"}
created2017-01-25 23:27:24
last_update2017-01-25 23:27:24
depth1
children0
last_payout2017-02-20 20:37:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length299
author_reputation469,847,679,370,493
root_title"How to Find Hidden Gems with Ruby"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,343,819
net_rshares226,283,703,077
author_curate_reward""
vote details (2)
@screenname ·
Re: How to Find Hidden Gems with Ruby
<p>This post has been ranked within the top 80 most undervalued posts in the second half of Jan 20. We estimate that this post is undervalued by $5.50 as compared to a scenario in which every voter had an equal say.</p> 
<p>See the full rankings and details in <a href="https://steemit.com/curation/@screenname/the-daily-tribune-most-undervalued-posts-of-jan-20---part-ii">The Daily Tribune: Jan 20 - Part II</a>. You can also read about some of our methodology, data analysis and technical details in <a href="https://steemit.com/curation/@screenname/introducing-the-daily-tribune-most-undervalued-posts-of-nov-04---part-i">our initial post</a>.</p>
<p>If you are the author and would prefer not to receive these comments, simply reply "Stop" to this comment.</p>
πŸ‘  
properties (23)
authorscreenname
permlinkre-how-to-find-hidden-gems-with-ruby-20170121t013051
categoryradiator
json_metadata"{"replyto": "@inertia/how-to-find-hidden-gems-with-ruby"}"
created2017-01-21 01:30:51
last_update2017-01-21 01:30:51
depth1
children0
last_payout2017-02-20 20:37:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length765
author_reputation46,276,338,038,330
root_title"How to Find Hidden Gems with Ruby"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,301,545
net_rshares191,055,643
author_curate_reward""
vote details (1)