tickerpicker 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 00f099b7d1bf241107b8f190bd1ac33035bbcac6
4
+ data.tar.gz: c1814d7cb4f770092de723acd7942daa4bdcb2b7
5
+ SHA512:
6
+ metadata.gz: 8038240dd655305453a7b15edc3fac7ad46fc2bcfe9f4ab0975490de8610da6c8df6753ac1f88dd7ac5bf7a4ed5831228eb94bca1d544f87be085ffe3f5e6efc
7
+ data.tar.gz: 02d521026b877b8363488b6538c7a7001f960fcc323361e32c25ffa12523fc84e54da7a5b96bd772e0c2452e13ebf2db4e3b5d807a2163b6fb86211cfe3ff781
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in tickerpicker.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Mustafa Turan
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,92 @@
1
+ # TickerPicker
2
+
3
+ [![Build Status](https://travis-ci.org/mustafaturan/tickerpicker.png)](https://travis-ci.org/mustafaturan/tickerpicker) [![Code Climate](https://codeclimate.com/github/mustafaturan/tickerpicker.png)](https://codeclimate.com/github/mustafaturan/tickerpicker)
4
+
5
+ A generalized ticker picker for crypto currency stock exchanges.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'tickerpicker'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install tickerpicker
20
+
21
+ ## Usage
22
+ Register stocks from avaliable stock list
23
+ TickerPicker::Ticker.register "mtgox"
24
+ Or register multiple stocks:
25
+ TickerPicker::Ticker.register_list ["mtgox", "btce", "bitstamp"]
26
+
27
+ Get prices from the stock's specific market:
28
+ prices = TickerPicker::Ticker.get_prices 'mtgox', 'btc_usd'
29
+
30
+ Print all prices as hash:
31
+ puts prices.to_dh
32
+
33
+ Print specific info from prices:
34
+ puts prices.ask
35
+ puts prices.bid
36
+ puts prices.last
37
+ puts prices.timestamp
38
+ puts prices.currency
39
+
40
+ Get prices from the stock
41
+ mtgox_markets = TickerPicker::Ticker.get_all_stock_prices 'mtgox'
42
+
43
+ Get prices from all avaliable stock-markets
44
+ all_stock_markets = TickerPicker::Ticker.get_all_stock_market_prices
45
+
46
+ ## Configuration (optional & advanced)
47
+ Set your stocks.yml file path if you need to modify default
48
+ TickerPicker.configure do |config|
49
+ config.stock_configuration_file = "#{File.dirname(__FILE__)}/stocks.yml" # your stocks.yml path
50
+ end
51
+
52
+ Add new markets to the stocks(sample: your stocks.yml)
53
+ bitstamp:
54
+ btc_usd:
55
+ url: 'https://www.bitstamp.net/api/ticker/'
56
+ currency: 'USD'
57
+ btce:
58
+ btc_usd:
59
+ url: 'https://btc-e.com/api/2/btc_usd/ticker'
60
+ currency: 'USD'
61
+ btc_eur:
62
+ url: 'https://btc-e.com/api/2/btc_eur/ticker'
63
+ currency: 'EUR'
64
+ btc_rub:
65
+ url: 'https://btc-e.com/api/2/btc_rub/ticker'
66
+ currency: 'RUB'
67
+ btcturk:
68
+ btc_try:
69
+ url: 'https://btcturk.com/api/ticker/'
70
+ currency: 'TRY'
71
+ mtgox:
72
+ btc_usd:
73
+ url: 'http://data.mtgox.com/api/2/BTCUSD/money/ticker_fast'
74
+ currency: 'USD'
75
+ btc_eur:
76
+ url: 'http://data.mtgox.com/api/2/BTCEUR/money/ticker_fast'
77
+ currency: 'EUR'
78
+
79
+
80
+ ## Available Stocks
81
+ MTGOX
82
+ BTC-E
83
+ BITSTAMP
84
+ BTCTURK
85
+
86
+ ## Contributing
87
+
88
+ 1. Fork it
89
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
90
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
91
+ 4. Push to the branch (`git push origin my-new-feature`)
92
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+
5
+ desc 'Default Task'
6
+ task :default => [ :test ]
7
+
8
+ # Run the unit tests
9
+ desc 'Run all unit tests'
10
+ Rake::TestTask.new do |t|
11
+ t.libs << 'lib'
12
+ t.test_files = FileList['test/unit/*_test.rb']
13
+ t.verbose = true
14
+ end
15
+
16
+ # Make a console for testing purposes
17
+ desc 'Generate a test console'
18
+ task :console do
19
+ verbose( false ) { sh 'irb -I lib/ -r "tickerpicker"' }
20
+ end
@@ -0,0 +1,38 @@
1
+ require 'singleton'
2
+ require 'logger'
3
+ require 'yaml'
4
+
5
+ module TickerPicker
6
+ class Configuration
7
+ include Singleton
8
+ attr_accessor :logger
9
+ attr_accessor :stock_configuration_file
10
+
11
+
12
+ class << self
13
+ def default_logger
14
+ logger = Logger.new(STDOUT)
15
+ logger.progname = 'tickerpicker'
16
+ logger
17
+ end
18
+
19
+ def defaults
20
+ @@defaults
21
+ end
22
+
23
+ def avaliable_stocks
24
+ @avaliable_stocks ||= YAML.load_file(TickerPicker.config.stock_configuration_file)
25
+ end
26
+ end
27
+
28
+ def initialize
29
+ @@defaults.each_pair{ |k,v| self.send("#{k}=",v) }
30
+ end
31
+
32
+ @@defaults = {
33
+ logger: default_logger,
34
+ stock_configuration_file: "#{File.dirname(__FILE__)}/stocks.yml"
35
+ }
36
+
37
+ end
38
+ end
@@ -0,0 +1,30 @@
1
+ module TickerPicker
2
+ module Factory
3
+ class Bitstamp < TickerPicker::Price
4
+ class << self
5
+ # Get prices for the market
6
+ #
7
+ # === Returns
8
+ #
9
+ # * Hash of markets
10
+ #
11
+ def markets
12
+ TickerPicker::Configuration.avaliable_stocks['bitstamp']
13
+ end
14
+
15
+ private
16
+
17
+ # nodoc
18
+ def instance_mapping(res_hash, currency)
19
+ new({
20
+ ask: ("%f" % res_hash['ask']).to_f,
21
+ bid: ("%f" % res_hash['bid']).to_f,
22
+ currency: currency,
23
+ last: ("%f" % res_hash['last']).to_f,
24
+ timestamp: res_hash['timestamp']
25
+ })
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,30 @@
1
+ module TickerPicker
2
+ module Factory
3
+ class Btce < TickerPicker::Price
4
+ class << self
5
+ # Get prices for the market
6
+ #
7
+ # === Returns
8
+ #
9
+ # * Hash of markets
10
+ #
11
+ def markets
12
+ TickerPicker::Configuration.avaliable_stocks['btce']
13
+ end
14
+
15
+ private
16
+
17
+ # nodoc
18
+ def instance_mapping(res_hash, currency)
19
+ new({
20
+ ask: ("%f" % res_hash['ticker']['sell']).to_f,
21
+ bid: ("%f" % res_hash['ticker']['buy']).to_f,
22
+ currency: currency,
23
+ last: ("%f" % res_hash['ticker']['last']).to_f,
24
+ timestamp: res_hash['ticker']['updated']
25
+ })
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,30 @@
1
+ module TickerPicker
2
+ module Factory
3
+ class Btcturk < TickerPicker::Price
4
+ class << self
5
+ # Get prices for the market
6
+ #
7
+ # === Returns
8
+ #
9
+ # * Hash of markets
10
+ #
11
+ def markets
12
+ TickerPicker::Configuration.avaliable_stocks['btcturk']
13
+ end
14
+
15
+ private
16
+
17
+ # nodoc
18
+ def instance_mapping(res_hash, currency)
19
+ new({
20
+ ask: ("%f" % res_hash['ask']).to_f,
21
+ bid: ("%f" % res_hash['bid']).to_f,
22
+ currency: currency,
23
+ last: ("%f" % res_hash['last']).to_f,
24
+ timestamp: res_hash['timestamp']
25
+ })
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,30 @@
1
+ module TickerPicker
2
+ module Factory
3
+ class Mtgox < TickerPicker::Price
4
+ class << self
5
+ # Get prices for the market
6
+ #
7
+ # === Returns
8
+ #
9
+ # * Hash of markets
10
+ #
11
+ def markets
12
+ TickerPicker::Configuration.avaliable_stocks['mtgox']
13
+ end
14
+
15
+ private
16
+
17
+ # nodoc
18
+ def instance_mapping(res_hash, currency)
19
+ new({
20
+ ask: ("%f" % res_hash['data']['sell']['value']).to_f,
21
+ bid: ("%f" % res_hash['data']['buy']['value']).to_f,
22
+ currency: currency,
23
+ last: ("%f" % res_hash['data']['last']['value']).to_f,
24
+ timestamp: res_hash['data']['now'].to_f / 1000000
25
+ })
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,67 @@
1
+ module TickerPicker
2
+ class Price
3
+ include Hashable
4
+
5
+ attr_accessor :ask
6
+ attr_accessor :bid
7
+ attr_accessor :currency
8
+ attr_accessor :last
9
+ attr_accessor :timestamp
10
+
11
+ def initialize(price_hash = {})
12
+ @ask = price_hash[:ask] || 0.0
13
+ @bid = price_hash[:bid] || 0.0
14
+ @currency = price_hash[:currency] || ''
15
+ @last = price_hash[:last] || 0.0
16
+ @timestamp = price_hash[:timestamp].to_f || Time.now.to_f
17
+ end
18
+
19
+ class << self
20
+ # Get prices for the market
21
+ #
22
+ # ==== Parameters
23
+ #
24
+ # * +market+ - string
25
+ #
26
+ # === Returns
27
+ #
28
+ # * +TickerPicker::Price+ - TickerPicker::Price instance object
29
+ #
30
+ def get_prices(market)
31
+ instance_mapping gather_info(markets[market]['url']), markets[market]['currency']
32
+ end
33
+
34
+ # Abstact method for list of markets in the stock
35
+ #
36
+ def markets
37
+ raise NotImplementedError.new("#{self.class.name}##{__callee__} method is not implemented!")
38
+ end
39
+
40
+ # Abstact method for mapping foreign data with local instance
41
+ #
42
+ def instance_mapping
43
+ raise NotImplementedError.new("#{self.class.name}##{__callee__} method is not implemented!")
44
+ end
45
+
46
+ # Get information from stock-market uri and convert it into Hash
47
+ #
48
+ # ==== Parameters
49
+ #
50
+ # * +url+ - Stock market URI
51
+ #
52
+ # === Returns
53
+ #
54
+ # * +Hash+ - Hash of information for given stock-market uri
55
+ #
56
+ def gather_info(url)
57
+ response = open(url, 'User-Agent' => user_agent, read_timeout: 2).read
58
+ JSON.parse(response)
59
+ end
60
+
61
+ # nodoc
62
+ def user_agent
63
+ "TickerPicker Bot v#{TickerPicker::VERSION}"
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,26 @@
1
+ bitstamp:
2
+ btc_usd:
3
+ url: 'https://www.bitstamp.net/api/ticker/'
4
+ currency: 'USD'
5
+ btce:
6
+ btc_usd:
7
+ url: 'https://btc-e.com/api/2/btc_usd/ticker'
8
+ currency: 'USD'
9
+ btc_eur:
10
+ url: 'https://btc-e.com/api/2/btc_eur/ticker'
11
+ currency: 'EUR'
12
+ btc_rub:
13
+ url: 'https://btc-e.com/api/2/btc_rub/ticker'
14
+ currency: 'RUB'
15
+ btcturk:
16
+ btc_try:
17
+ url: 'https://btcturk.com/api/ticker/'
18
+ currency: 'TRY'
19
+ mtgox:
20
+ btc_usd:
21
+ url: 'http://data.mtgox.com/api/2/BTCUSD/money/ticker_fast'
22
+ currency: 'USD'
23
+ btc_eur:
24
+ url: 'http://data.mtgox.com/api/2/BTCEUR/money/ticker_fast'
25
+ currency: 'EUR'
26
+
@@ -0,0 +1,123 @@
1
+ module TickerPicker
2
+ class Ticker
3
+ @@factories = {}
4
+
5
+ class << self
6
+ # Get factories hash
7
+ #
8
+ # === Returns
9
+ #
10
+ # * +factories+ - Hash
11
+ #
12
+ def factories
13
+ @@factories
14
+ end
15
+
16
+ # Register a ticker factory
17
+ #
18
+ # ==== Parameters
19
+ #
20
+ # * +stock+ - Factory object name
21
+ # * +file_path+ - Optional load path for stock handler factory for new dev purposes
22
+ #
23
+ # === Returns
24
+ #
25
+ # * +true+ - Boolean
26
+ #
27
+ def register(stock, file_path = nil)
28
+ require (file_path || "#{File.dirname(__FILE__)}/factory/#{stock}")
29
+ factories[stock] = eval("TickerPicker::Factory::#{stock.capitalize}.markets")
30
+ true
31
+ end
32
+
33
+ # Register multiple ticker factories
34
+ #
35
+ # ==== Parameters
36
+ #
37
+ # * +stocks+ - Factory object name list
38
+ #
39
+ # === Returns
40
+ #
41
+ # * +true+ - Boolean
42
+ #
43
+ def register_list(stocks)
44
+ stocks.each { |stock| register(stock) }
45
+ true
46
+ end
47
+
48
+ # Get prices for market in stock
49
+ #
50
+ # ==== Parameters
51
+ #
52
+ # * +stock+ - String which must be a valid stock name
53
+ # * +market+ - String which should include valid market name
54
+ #
55
+ # === Returns
56
+ #
57
+ # * +TickerPicker::Price+ - Extended version of TickerPicker::Price with factory key
58
+ #
59
+ def get_prices(stock, market)
60
+ return stock_market_does_not_exists unless (factories[stock] || {}).has_key?(market)
61
+ get_price_without_check(stock, market)
62
+ end
63
+
64
+ # Get all market prices in a stock
65
+ #
66
+ # ==== Parameters
67
+ #
68
+ # * +stock+ - String which must be a valid stock name
69
+ #
70
+ # === Returns
71
+ #
72
+ # * +Hash+ - Hash of TickerPicker::Price
73
+ #
74
+ def get_all_stock_prices(stock)
75
+ return stock_does_not_exists unless factories.has_key?(stock)
76
+ get_all_stock_prices_without_check(stock)
77
+ end
78
+
79
+ # Get all market prices in avaliable stocks
80
+ #
81
+ # ==== Parameters
82
+ #
83
+ # * +stock+ - String which must be a valid stock name
84
+ #
85
+ # === Returns
86
+ #
87
+ # * +Hash+ - Hash of TickerPicker::Price
88
+ #
89
+ def get_all_stock_market_prices
90
+ stock_market_prices = {}
91
+ factories.each do |stock_key, _|
92
+ stock_market_prices.merge!({ stock_key => get_all_stock_prices_without_check(stock_key) })
93
+ end
94
+ stock_market_prices
95
+ end
96
+
97
+ private
98
+ # nodoc
99
+ def get_price_without_check(stock, market)
100
+ eval("TickerPicker::Factory::#{stock.capitalize}.get_prices(market)")
101
+ end
102
+
103
+ # nodoc
104
+ def get_all_stock_prices_without_check(stock)
105
+ stock_prices = {}
106
+ factories[stock].each do |key, _|
107
+ stock_prices[key] = get_price_without_check(stock, key)
108
+ end
109
+ stock_prices
110
+ end
111
+
112
+ # nodoc
113
+ def stock_does_not_exists
114
+ raise StandardError, 'Stock does not exists!'
115
+ end
116
+
117
+ # nodoc
118
+ def stock_market_does_not_exists
119
+ raise StandardError, 'Stock-market does not exists!'
120
+ end
121
+ end
122
+ end
123
+ end
@@ -0,0 +1,3 @@
1
+ module TickerPicker
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,20 @@
1
+ require 'open-uri'
2
+ require 'json'
3
+ require 'hashable'
4
+ require 'tickerpicker/version'
5
+ require 'tickerpicker/configuration'
6
+ require 'tickerpicker/price'
7
+ require 'tickerpicker/ticker'
8
+ module TickerPicker
9
+ def self.config
10
+ TickerPicker::Configuration.instance
11
+ end
12
+
13
+ def self.configure
14
+ yield config
15
+ end
16
+
17
+ def self.logger
18
+ config.logger
19
+ end
20
+ end
@@ -0,0 +1,2 @@
1
+ require 'test/unit'
2
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'tickerpicker'))
@@ -0,0 +1,30 @@
1
+ module TickerPicker
2
+ module Factory
3
+ class Developer < TickerPicker::Price
4
+ class << self
5
+ # Get prices for the market
6
+ #
7
+ # === Returns
8
+ #
9
+ # * Hash of markets
10
+ #
11
+ def markets
12
+ TickerPicker::Configuration.avaliable_stocks['developer']
13
+ end
14
+
15
+ private
16
+
17
+ # nodoc
18
+ def instance_mapping(res_hash, currency)
19
+ new({
20
+ ask: ("%f" % res_hash['ask']).to_f,
21
+ bid: ("%f" % res_hash['bid']).to_f,
22
+ currency: currency,
23
+ last: ("%f" % res_hash['last']).to_f,
24
+ timestamp: res_hash['timestamp']
25
+ })
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,32 @@
1
+ module TickerPicker
2
+ module Factory
3
+ class Tester < TickerPicker::Price
4
+ class << self
5
+
6
+
7
+ # Get prices for the market
8
+ #
9
+ # === Returns
10
+ #
11
+ # * Hash of markets
12
+ #
13
+ def markets
14
+ TickerPicker::Configuration.avaliable_stocks['tester']
15
+ end
16
+
17
+ private
18
+
19
+ # nodoc
20
+ def instance_mapping(res_hash, currency)
21
+ new({
22
+ ask: ("%f" % res_hash['ask']).to_f,
23
+ bid: ("%f" % res_hash['bid']).to_f,
24
+ currency: currency,
25
+ last: ("%f" % res_hash['last']).to_f,
26
+ timestamp: res_hash['timestamp']
27
+ })
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1 @@
1
+ {"high": "757.99", "last": "744.90", "timestamp": "1388595315", "bid": "742.58", "volume": "8262.66376093", "low": "726.62", "ask": "744.90"}
@@ -0,0 +1 @@
1
+ {"high": "757.99", "last": "744.90", "timestamp": "1388595315", "bid": "742.58", "volume": "8262.66376093", "low": "726.62", "ask": "744.94"}
@@ -0,0 +1,9 @@
1
+ developer:
2
+ btc_xxx:
3
+ url: 'developer.json'
4
+ currency: 'XXX'
5
+ tester:
6
+ btc_xyz:
7
+ url: 'tester.json'
8
+ currency: 'XYZ'
9
+
@@ -0,0 +1,77 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper'))
2
+
3
+
4
+ class TickerTest < Test::Unit::TestCase
5
+ def setup
6
+ TickerPicker.configure do |config|
7
+ config.stock_configuration_file = "#{File.dirname(__FILE__)}/stocks.yml"
8
+ end
9
+ end
10
+
11
+ def test_register
12
+ register_developer
13
+ assert_equal(
14
+ true,
15
+ TickerPicker::Ticker.factories.has_key?('developer')
16
+ )
17
+ end
18
+
19
+ def test_register_list
20
+ assert_equal(
21
+ true,
22
+ true
23
+ )
24
+ end
25
+
26
+ def test_get_prices
27
+ register_developer
28
+ prices = TickerPicker::Ticker.get_prices('developer', 'btc_xxx')
29
+ assert_equal(
30
+ 744.90,
31
+ prices.ask
32
+ )
33
+ assert_equal(
34
+ 1388595315.0,
35
+ prices.timestamp
36
+ )
37
+ end
38
+
39
+ def test_get_all_stock_prices
40
+ register_all
41
+ stock_prices = TickerPicker::Ticker.get_all_stock_prices('developer')
42
+ assert_equal(
43
+ 744.90,
44
+ stock_prices['btc_xxx'].ask
45
+ )
46
+ end
47
+
48
+ def test_get_all_stock_market_prices
49
+ register_all
50
+ stock_market_prices = TickerPicker::Ticker.get_all_stock_market_prices
51
+ assert_equal(
52
+ 742.58,
53
+ stock_market_prices['developer']['btc_xxx'].bid
54
+ )
55
+ assert_equal(
56
+ 744.94,
57
+ stock_market_prices['tester']['btc_xyz'].ask
58
+ )
59
+ end
60
+
61
+ private
62
+ def register_developer
63
+ TickerPicker::Ticker.register('developer', File.expand_path(File.join(File.dirname(__FILE__), 'factory', 'developer')))
64
+ TickerPicker::Ticker.factories['developer']['btc_xxx']['url'] = "#{File.dirname(__FILE__)}/json/developer.json"
65
+ end
66
+
67
+ def register_tester
68
+ TickerPicker::Ticker.register('tester', File.expand_path(File.join(File.dirname(__FILE__), 'factory', 'tester')))
69
+ TickerPicker::Ticker.factories['tester']['btc_xyz']['url'] = "#{File.dirname(__FILE__)}/json/tester.json"
70
+ end
71
+
72
+ def register_all
73
+ register_developer
74
+ register_tester
75
+ end
76
+ end
77
+
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'tickerpicker/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "tickerpicker"
8
+ spec.version = TickerPicker::VERSION
9
+ spec.authors = ["Mustafa Turan"]
10
+ spec.email = ["mustafaturan.net@gmail.com"]
11
+ spec.description = %q{Ticker Picker for cryto currencies like BTC, LTC in world stocks}
12
+ spec.summary = %q{Ticker Picker for cryto currencies like BTC, LTC}
13
+ spec.homepage = "https://github.com/mustafaturan/tickerpicker"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_dependency "hashable", "~> 0.1.2"
24
+ end
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tickerpicker
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Mustafa Turan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: hashable
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 0.1.2
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 0.1.2
55
+ description: Ticker Picker for cryto currencies like BTC, LTC in world stocks
56
+ email:
57
+ - mustafaturan.net@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - lib/tickerpicker.rb
68
+ - lib/tickerpicker/configuration.rb
69
+ - lib/tickerpicker/factory/bitstamp.rb
70
+ - lib/tickerpicker/factory/btce.rb
71
+ - lib/tickerpicker/factory/btcturk.rb
72
+ - lib/tickerpicker/factory/mtgox.rb
73
+ - lib/tickerpicker/price.rb
74
+ - lib/tickerpicker/stocks.yml
75
+ - lib/tickerpicker/ticker.rb
76
+ - lib/tickerpicker/version.rb
77
+ - test/test_helper.rb
78
+ - test/unit/factory/developer.rb
79
+ - test/unit/factory/tester.rb
80
+ - test/unit/json/developer.json
81
+ - test/unit/json/tester.json
82
+ - test/unit/stocks.yml
83
+ - test/unit/ticker_test.rb
84
+ - tickerpicker.gemspec
85
+ homepage: https://github.com/mustafaturan/tickerpicker
86
+ licenses:
87
+ - MIT
88
+ metadata: {}
89
+ post_install_message:
90
+ rdoc_options: []
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubyforge_project:
105
+ rubygems_version: 2.0.3
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: Ticker Picker for cryto currencies like BTC, LTC
109
+ test_files:
110
+ - test/test_helper.rb
111
+ - test/unit/factory/developer.rb
112
+ - test/unit/factory/tester.rb
113
+ - test/unit/json/developer.json
114
+ - test/unit/json/tester.json
115
+ - test/unit/stocks.yml
116
+ - test/unit/ticker_test.rb