How to Find Hidden Gems with Ruby

in #radiator7 years ago

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

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 project and added this functionality. To try this logic out yourself, browse to one of these ...

... then click the Vote Ready button.


As always, we use Radiator with bundler. You can get bundler with this command:

$ 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:

$ mkdir radiator
$ cd radiator

Create a file named Gemfile containing:

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

Then run the command:

$ bundle install

Create a file named vote_ready.rb containing:

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:

$ 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

See my previous Ruby How To posts in: #radiator #ruby

Sort:  

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?

Yep, I think there's a mistake in that script that nobody ever noticed.

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

Should be:

  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

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

There's a typo too. It should be:

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

The ARGV constant is created by the ruby interpreter and just gives you access to the parameters passed when you launch. So, once you apply that fix, this command will work:

ruby vote_ready.rb dmania

And that will narrow down the query to the dmania tag.

Got that, makes sense now.
Will try it at home. You received a quest reward via memo ;)

Edit: WORKED!

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.

See the full rankings and details in The Daily Tribune: Jan 20 - Part II. You can also read about some of our methodology, data analysis and technical details in our initial post.

If you are the author and would prefer not to receive these comments, simply reply "Stop" to this comment.

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