Created
September 2, 2009 10:02
-
-
Save burke/179638 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'date' | |
| # Shows the highest potential markup for items. Doesn't really filter out spam inputs. | |
| # top listed items | |
| # >> puts orders.keys.sort_by{|n|orders[n].map{|e|e[:vol_enter]||1}.inject(&:+)}.reverse[0..10] | |
| # >> orders[f].select{|e|e[:bid]==:buy}.map{|e|e[:price]} | |
| # => [201000, 200002, 200002, 200001, 199999, 65000, 51003, 51003, 51003, 51000, 30000, 5555] | |
| # >> orders[f].select{|e|e[:bid]==:sell}.map{|e|e[:price]} | |
| # => [927699, 927699, 929999, 958999, 999695] | |
| orders = Marshal.load(File.read('item_orders.marshal')) | |
| markups = {} | |
| orders.each do |name,olist| | |
| selling = olist.select{|e|e[:bid] == :sell} | |
| buying = olist.select{|e|e[:bid] == :buy} | |
| next if selling.size < 4 || buying.size < 2 | |
| top_buy = buying.map{|e|e[:price]}.sort.last | |
| expected_sell = selling.map{|e|e[:price]}.sort.first | |
| markups[name] = expected_sell.to_f / top_buy.to_f | |
| end | |
| markups.keys.sort_by{|e|markups[e]}.reverse[0..20].each do |e| | |
| puts "#{e} : #{markups[e]}" | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment