tickerpicker 0.1.1 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 221f4d7f779657003db135030cdcdb1e4a44978b
4
- data.tar.gz: ba2b13a4ee668be24424adcee5a6155dc07a8454
3
+ metadata.gz: b638d526fb246916ec78da5b23542a4386e0dd13
4
+ data.tar.gz: 0680592e3eb8c64d2004f2bb7df0046bcebe2384
5
5
  SHA512:
6
- metadata.gz: a22df07b851ff024d969b8c2a5dcea69689ff9057f98c6fc5f941c0053e455b828c3c0829c8f042be1406d454ccd82d663e9cb87fe641c33acc6e53dc87d5ed7
7
- data.tar.gz: 6e38487a6817c848cdb0c8c794a0faeb47d8d016263abce8c93448f31e2f3a0d7ec7f7b7e7dc7ca13be2cfb73151b5aa4cf7fd420f462d5bf43013f9c258c270
6
+ metadata.gz: 0a15b9b9426a5a071c1ac10b574a2a3350ca11a61dcf272a4f2ab780be8ddf6cb409dbd5188ebb95445a2a98513d889f0d4223b6f172e2890da15f10bd00228e
7
+ data.tar.gz: d57bcebec44e6ed0b0b6f7e622df5cb31b0072ea25ec90e9578cc99bdce505133bd1018058fd0d4aeea65bdc02972c989ac52316f276a576cac31bfbbc4e9ee8
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
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
4
 
5
- A generalized ticker picker for crypto currency stock exchanges.
5
+ A generalized ticker picker library for cryto currencies like #BTC(bitcoin), #LTC(litecoin) in world stock markets.
6
6
 
7
7
  ## Installation
8
8
 
@@ -19,19 +19,14 @@ Or install it yourself as:
19
19
  $ gem install tickerpicker
20
20
 
21
21
  ## Usage
22
- Register stocks from avaliable stock list
23
-
24
- TickerPicker::Ticker.register "mtgox"
25
- TickerPicker::Ticker.register "btce"
26
-
27
- Or register multiple stocks:
28
-
29
- TickerPicker::Ticker.register_list ["mtgox", "btce", "bitstamp"]
22
+ Register stock-market sources using stock.yml file.
30
23
 
31
24
  Get prices from the stock's specific market:
32
25
 
33
26
  prices_mtgox_usd = TickerPicker::Ticker.get_prices 'mtgox', 'btc_usd'
27
+ #<TickerPicker::Price:0x007f8f2482e758 @ask=1010.0, @bid=1003.671, @currency="USD", @last=1003.666, @timestamp=1389049160.512882>
34
28
  prices_bitstamp_usd = TickerPicker::Ticker.get_prices 'bitstamp', 'btc_usd'
29
+ #<TickerPicker::Price:0x007f8f24855218 @ask=915.74, @bid=915.24, @currency="USD", @last=915.24, @timestamp=1389049155.0>
35
30
 
36
31
  Print all prices as hash:
37
32
 
@@ -48,10 +43,17 @@ Print specific info from prices:
48
43
  Get prices from the stock
49
44
 
50
45
  mtgox_markets = TickerPicker::Ticker.get_all_stock_prices 'mtgox'
46
+ {"btc_usd"=>#<TickerPicker::Price:0x007f8f23b17a38 @ask=1009.945, @bid=1005.0, @currency="USD", @last=1009.995, @timestamp=1389049209.608274>, "btc_eur"=>#<TickerPicker::Price:0x007f8f23af7710 @ask=735.0, @bid=727.0, @currency="EUR", @last=727.0, @timestamp=1389049215.239725>}
51
47
 
52
48
  Get prices from all avaliable stock-markets
53
49
 
54
50
  all_stock_markets = TickerPicker::Ticker.get_all_stock_market_prices
51
+ {"bitstamp"=>{"btc_usd"=>#<TickerPicker::Price:0x007f8f23ace568 @ask=913.44, @bid=912.84, @currency="USD", @last=913.44, @timestamp=1389049226.0>}, "btce"=>{"btc_usd"=>#<TickerPicker::Price:0x007f8f23ab2f70 @ask=916.089, @bid=914.449, @currency="USD", @last=916.089, @timestamp=1389049239.0>, "btc_eur"=>#<TickerPicker::Price:0x007f8f23a98328 @ask=695.89199, @bid=692.02567, @currency="EUR", @last=692.03, @timestamp=1389049241.0>}, "btcturk"=>{"btc_try"=>#<TickerPicker::Price:0x007f8f23a69230 @ask=1909.94, @bid=1880.0, @currency="TRY", @last=1895.99, @timestamp=1389049245.0>}, "mtgox"=>{"btc_usd"=>#<TickerPicker::Price:0x007f8f23a511d0 @ask=1010.0, @bid=1005.005, @currency="USD", @last=1005.0, @timestamp=1389049229.681736>, "btc_eur"=>#<TickerPicker::Price:0x007f8f23a39dc8 @ask=735.0, @bid=727.0, @currency="EUR", @last=727.0, @timestamp=1389049241.310519>}}
52
+
53
+ To convert results to hash use *to_dh* method like:
54
+
55
+ all_stock_markets.to_dh
56
+ {"bitstamp"=>{"btc_usd"=>{:ask=>913.44, :bid=>912.84, :currency=>"USD", :last=>913.44, :timestamp=>1389049226.0}}, "btce"=>{"btc_usd"=>{:ask=>916.089, :bid=>914.449, :currency=>"USD", :last=>916.089, :timestamp=>1389049239.0}, "btc_eur"=>{:ask=>695.89199, :bid=>692.02567, :currency=>"EUR", :last=>692.03, :timestamp=>1389049241.0}}, "btcturk"=>{"btc_try"=>{:ask=>1909.94, :bid=>1880.0, :currency=>"TRY", :last=>1895.99, :timestamp=>1389049245.0}}, "mtgox"=>{"btc_usd"=>{:ask=>1010.0, :bid=>1005.005, :currency=>"USD", :last=>1005.0, :timestamp=>1389049229.681736}, "btc_eur"=>{:ask=>735.0, :bid=>727.0, :currency=>"EUR", :last=>727.0, :timestamp=>1389049241.310519}}}
55
57
 
56
58
  ## Configuration (optional & advanced)
57
59
  Set your stocks.yml file path if you need to modify default
@@ -60,33 +62,70 @@ Set your stocks.yml file path if you need to modify default
60
62
  config.stock_configuration_file = "#{File.dirname(__FILE__)}/stocks.yml" # your stocks.yml path
61
63
  end
62
64
 
63
- Add new markets to the stocks(sample: your stocks.yml)
65
+ Add new stock markets to your stocks.yml
64
66
 
65
67
  bitstamp:
66
68
  btc_usd:
67
69
  url: 'https://www.bitstamp.net/api/ticker/'
68
70
  currency: 'USD'
71
+ mappings:
72
+ ask: "['ask']"
73
+ bid: "['bid']"
74
+ last: "['last']"
75
+ timestamp: "['timestamp']"
76
+ timestamp_representation: 'milliseconds'
69
77
  btce:
70
78
  btc_usd:
71
79
  url: 'https://btc-e.com/api/2/btc_usd/ticker'
72
80
  currency: 'USD'
81
+ mappings:
82
+ ask: "['ticker']['buy']"
83
+ bid: "['ticker']['sell']"
84
+ last: "['ticker']['last']"
85
+ timestamp: "['ticker']['updated']"
86
+ timestamp_representation: 'milliseconds'
73
87
  btc_eur:
74
88
  url: 'https://btc-e.com/api/2/btc_eur/ticker'
75
89
  currency: 'EUR'
90
+ mappings:
91
+ ask: "['ticker']['buy']"
92
+ bid: "['ticker']['sell']"
93
+ last: "['ticker']['last']"
94
+ timestamp: "['ticker']['updated']"
95
+ timestamp_representation: 'milliseconds'
76
96
  btcturk:
77
97
  btc_try:
78
98
  url: 'https://btcturk.com/api/ticker/'
79
99
  currency: 'TRY'
100
+ mappings:
101
+ ask: "['ask']"
102
+ bid: "['bid']"
103
+ last: "['last']"
104
+ timestamp: "['timestamp']"
105
+ timestamp_representation: 'milliseconds'
80
106
  mtgox:
81
107
  btc_usd:
82
108
  url: 'http://data.mtgox.com/api/2/BTCUSD/money/ticker_fast'
83
109
  currency: 'USD'
110
+ mappings:
111
+ ask: "['data']['sell']['value']"
112
+ bid: "['data']['buy']['value']"
113
+ last: "['data']['last']['value']"
114
+ timestamp: "['data']['now']"
115
+ timestamp_representation: 'microseconds'
84
116
  btc_eur:
85
117
  url: 'http://data.mtgox.com/api/2/BTCEUR/money/ticker_fast'
86
118
  currency: 'EUR'
119
+ mappings:
120
+ ask: "['data']['sell']['value']"
121
+ bid: "['data']['buy']['value']"
122
+ last: "['data']['last']['value']"
123
+ timestamp: "['data']['now']"
124
+ timestamp_representation: 'microseconds'
125
+
87
126
 
88
127
 
89
- ## Available Stocks
128
+ ## Sample Stocks
90
129
 
91
130
  BTC-E (btce)
92
131
 
@@ -9,10 +9,10 @@ module TickerPicker
9
9
  attr_accessor :timestamp
10
10
 
11
11
  def initialize(price_hash = {})
12
- @ask = price_hash[:ask] || 0.0
13
- @bid = price_hash[:bid] || 0.0
12
+ @ask = price_hash[:ask].to_f || 0.0
13
+ @bid = price_hash[:bid].to_f || 0.0
14
14
  @currency = price_hash[:currency] || ''
15
- @last = price_hash[:last] || 0.0
15
+ @last = price_hash[:last].to_f || 0.0
16
16
  @timestamp = price_hash[:timestamp].to_f || Time.now.to_f
17
17
  end
18
18
 
@@ -21,26 +21,30 @@ module TickerPicker
21
21
  #
22
22
  # ==== Parameters
23
23
  #
24
+ # * +stock+ - string
24
25
  # * +market+ - string
25
26
  #
26
27
  # === Returns
27
28
  #
28
29
  # * +TickerPicker::Price+ - TickerPicker::Price instance object
29
30
  #
30
- def get_prices(market)
31
- instance_mapping gather_info(markets[market]['url']), markets[market]['currency']
31
+ def fetch(stock, market)
32
+ instance_mapping gather_info(markets(stock)[market]['url']), markets(stock)[market]
32
33
  end
33
34
 
34
- # Abstact method for list of markets in the stock
35
+ private
36
+ # Get prices for the market
35
37
  #
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
38
+ # ==== Parameters
39
+ #
40
+ # * +stock+ - string
41
+ #
42
+ # === Returns
43
+ #
44
+ # * Hash of markets
41
45
  #
42
- def instance_mapping
43
- raise NotImplementedError.new("#{self.class.name}##{__callee__} method is not implemented!")
46
+ def markets(stock)
47
+ TickerPicker::Configuration.avaliable_stocks[stock]
44
48
  end
45
49
 
46
50
  # Get information from stock-market uri and convert it into Hash
@@ -62,6 +66,19 @@ module TickerPicker
62
66
  def user_agent
63
67
  "TickerPicker Bot v#{TickerPicker::VERSION}"
64
68
  end
69
+
70
+ # nodoc
71
+ def instance_mapping(res_hash, stock_market)
72
+ timestamp = eval("res_hash#{stock_market['mappings']['timestamp']}").to_f
73
+ timestamp /= 1000000 if stock_market['mappings']['timestamp_representation'].eql?('microseconds')
74
+ new({
75
+ ask: ("%f" % eval("res_hash#{stock_market['mappings']['ask']}")),
76
+ bid: ("%f" % eval("res_hash#{stock_market['mappings']['bid']}")),
77
+ currency: stock_market['currency'],
78
+ last: ("%f" % eval("res_hash#{stock_market['mappings']['last']}")),
79
+ timestamp: timestamp
80
+ })
81
+ end
65
82
  end
66
83
  end
67
84
  end
@@ -2,22 +2,58 @@ bitstamp:
2
2
  btc_usd:
3
3
  url: 'https://www.bitstamp.net/api/ticker/'
4
4
  currency: 'USD'
5
+ mappings:
6
+ ask: "['ask']"
7
+ bid: "['bid']"
8
+ last: "['last']"
9
+ timestamp: "['timestamp']"
10
+ timestamp_representation: 'milliseconds'
5
11
  btce:
6
12
  btc_usd:
7
13
  url: 'https://btc-e.com/api/2/btc_usd/ticker'
8
14
  currency: 'USD'
15
+ mappings:
16
+ ask: "['ticker']['buy']"
17
+ bid: "['ticker']['sell']"
18
+ last: "['ticker']['last']"
19
+ timestamp: "['ticker']['updated']"
20
+ timestamp_representation: 'milliseconds'
9
21
  btc_eur:
10
22
  url: 'https://btc-e.com/api/2/btc_eur/ticker'
11
23
  currency: 'EUR'
24
+ mappings:
25
+ ask: "['ticker']['buy']"
26
+ bid: "['ticker']['sell']"
27
+ last: "['ticker']['last']"
28
+ timestamp: "['ticker']['updated']"
29
+ timestamp_representation: 'milliseconds'
12
30
  btcturk:
13
31
  btc_try:
14
32
  url: 'https://btcturk.com/api/ticker/'
15
33
  currency: 'TRY'
34
+ mappings:
35
+ ask: "['ask']"
36
+ bid: "['bid']"
37
+ last: "['last']"
38
+ timestamp: "['timestamp']"
39
+ timestamp_representation: 'milliseconds'
16
40
  mtgox:
17
41
  btc_usd:
18
42
  url: 'http://data.mtgox.com/api/2/BTCUSD/money/ticker_fast'
19
43
  currency: 'USD'
44
+ mappings:
45
+ ask: "['data']['sell']['value']"
46
+ bid: "['data']['buy']['value']"
47
+ last: "['data']['last']['value']"
48
+ timestamp: "['data']['now']"
49
+ timestamp_representation: 'microseconds'
20
50
  btc_eur:
21
51
  url: 'http://data.mtgox.com/api/2/BTCEUR/money/ticker_fast'
22
52
  currency: 'EUR'
53
+ mappings:
54
+ ask: "['data']['sell']['value']"
55
+ bid: "['data']['buy']['value']"
56
+ last: "['data']['last']['value']"
57
+ timestamp: "['data']['now']"
58
+ timestamp_representation: 'microseconds'
23
59
 
@@ -1,50 +1,6 @@
1
1
  module TickerPicker
2
2
  class Ticker
3
- @@factories = {}
4
-
5
3
  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
4
  # Get prices for market in stock
49
5
  #
50
6
  # ==== Parameters
@@ -54,10 +10,10 @@ module TickerPicker
54
10
  #
55
11
  # === Returns
56
12
  #
57
- # * +TickerPicker::Price+ - Extended version of TickerPicker::Price with factory key
13
+ # * +TickerPicker::Price+ - TickerPicker::Price instance
58
14
  #
59
15
  def get_prices(stock, market)
60
- return stock_market_does_not_exists unless (factories[stock] || {}).has_key?(market)
16
+ return stock_market_does_not_exists unless (stocks[stock] || {}).has_key?(market)
61
17
  get_price_without_check(stock, market)
62
18
  end
63
19
 
@@ -72,7 +28,7 @@ module TickerPicker
72
28
  # * +Hash+ - Hash of TickerPicker::Price
73
29
  #
74
30
  def get_all_stock_prices(stock)
75
- return stock_does_not_exists unless factories.has_key?(stock)
31
+ return stock_does_not_exists unless stocks.has_key?(stock)
76
32
  get_all_stock_prices_without_check(stock)
77
33
  end
78
34
 
@@ -88,22 +44,27 @@ module TickerPicker
88
44
  #
89
45
  def get_all_stock_market_prices
90
46
  stock_market_prices = {}
91
- factories.each do |stock_key, _|
47
+ stocks.each do |stock_key, _|
92
48
  stock_market_prices.merge!({ stock_key => get_all_stock_prices_without_check(stock_key) })
93
49
  end
94
50
  stock_market_prices
95
51
  end
96
52
 
97
53
  private
54
+ # nodoc
55
+ def stocks
56
+ TickerPicker::Configuration.avaliable_stocks
57
+ end
58
+
98
59
  # nodoc
99
60
  def get_price_without_check(stock, market)
100
- eval("TickerPicker::Factory::#{stock.capitalize}.get_prices(market)")
61
+ TickerPicker::Price.fetch(stock, market)
101
62
  end
102
63
 
103
64
  # nodoc
104
65
  def get_all_stock_prices_without_check(stock)
105
66
  stock_prices = {}
106
- factories[stock].each do |key, _|
67
+ stocks[stock].each do |key, _|
107
68
  stock_prices[key] = get_price_without_check(stock, key)
108
69
  end
109
70
  stock_prices
@@ -1,3 +1,3 @@
1
1
  module TickerPicker
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -1 +1 @@
1
- {"high": "757.99", "last": "744.90", "timestamp": "1388595315", "bid": "742.58", "volume": "8262.66376093", "low": "726.62", "ask": "744.90"}
1
+ {"btc_xxx": { "high": "757.99", "last": "744.90", "timestamp": "1388595315", "bid": "742.58", "volume": "8262.66376093", "low": "726.62", "ask": "744.90" } }
@@ -1 +1 @@
1
- {"high": "757.99", "last": "744.90", "timestamp": "1388595315", "bid": "742.58", "volume": "8262.66376093", "low": "726.62", "ask": "744.94"}
1
+ {"high": "757.99", "last": "744.90", "timestamp": "1388595315000000", "buy": "742.58", "volume": "8262.66376093", "low": "726.62", "sell": "744.94"}
data/test/unit/stocks.yml CHANGED
@@ -1,9 +1,21 @@
1
1
  developer:
2
2
  btc_xxx:
3
- url: 'developer.json'
3
+ url: 'test/unit/json/developer.json'
4
4
  currency: 'XXX'
5
+ mappings:
6
+ ask: "['btc_xxx']['ask']"
7
+ bid: "['btc_xxx']['bid']"
8
+ last: "['btc_xxx']['last']"
9
+ timestamp: "['btc_xxx']['timestamp']"
10
+ timestamp_representation: 'milliseconds'
5
11
  tester:
6
12
  btc_xyz:
7
- url: 'tester.json'
13
+ url: 'test/unit/json/tester.json'
8
14
  currency: 'XYZ'
15
+ mappings:
16
+ ask: "['sell']"
17
+ bid: "['buy']"
18
+ last: "['last']"
19
+ timestamp: "['timestamp']"
20
+ timestamp_representation: 'microseconds'
9
21
 
@@ -8,23 +8,7 @@ class TickerTest < Test::Unit::TestCase
8
8
  end
9
9
  end
10
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
11
  def test_get_prices
27
- register_developer
28
12
  prices = TickerPicker::Ticker.get_prices('developer', 'btc_xxx')
29
13
  assert_equal(
30
14
  744.90,
@@ -37,16 +21,14 @@ class TickerTest < Test::Unit::TestCase
37
21
  end
38
22
 
39
23
  def test_get_all_stock_prices
40
- register_all
41
24
  stock_prices = TickerPicker::Ticker.get_all_stock_prices('developer')
42
25
  assert_equal(
43
26
  744.90,
44
27
  stock_prices['btc_xxx'].ask
45
28
  )
46
29
  end
47
-
30
+
48
31
  def test_get_all_stock_market_prices
49
- register_all
50
32
  stock_market_prices = TickerPicker::Ticker.get_all_stock_market_prices
51
33
  assert_equal(
52
34
  742.58,
@@ -56,22 +38,10 @@ class TickerTest < Test::Unit::TestCase
56
38
  744.94,
57
39
  stock_market_prices['tester']['btc_xyz'].ask
58
40
  )
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
41
+ assert_equal(
42
+ 1388595315.0,
43
+ stock_market_prices['tester']['btc_xyz'].timestamp
44
+ )
75
45
  end
76
46
  end
77
47
 
data/tickerpicker.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = TickerPicker::VERSION
9
9
  spec.authors = ["Mustafa Turan"]
10
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}
11
+ spec.description = %q{A generalized ticker picker library for cryto currencies like #BTC(bitcoin), #LTC(litecoin) in world stock markets.}
12
+ spec.summary = spec.description
13
13
  spec.homepage = "https://github.com/mustafaturan/tickerpicker"
14
14
  spec.license = "MIT"
15
15
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tickerpicker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mustafa Turan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-01 00:00:00.000000000 Z
11
+ date: 2014-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,7 +52,8 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.1.2
55
- description: Ticker Picker for cryto currencies like BTC, LTC in world stocks
55
+ description: 'A generalized ticker picker library for cryto currencies like #BTC(bitcoin),
56
+ #LTC(litecoin) in world stock markets.'
56
57
  email:
57
58
  - mustafaturan.net@gmail.com
58
59
  executables: []
@@ -67,17 +68,11 @@ files:
67
68
  - Rakefile
68
69
  - lib/tickerpicker.rb
69
70
  - lib/tickerpicker/configuration.rb
70
- - lib/tickerpicker/factory/bitstamp.rb
71
- - lib/tickerpicker/factory/btce.rb
72
- - lib/tickerpicker/factory/btcturk.rb
73
- - lib/tickerpicker/factory/mtgox.rb
74
71
  - lib/tickerpicker/price.rb
75
72
  - lib/tickerpicker/stocks.yml
76
73
  - lib/tickerpicker/ticker.rb
77
74
  - lib/tickerpicker/version.rb
78
75
  - test/test_helper.rb
79
- - test/unit/factory/developer.rb
80
- - test/unit/factory/tester.rb
81
76
  - test/unit/json/developer.json
82
77
  - test/unit/json/tester.json
83
78
  - test/unit/stocks.yml
@@ -106,11 +101,10 @@ rubyforge_project:
106
101
  rubygems_version: 2.2.0
107
102
  signing_key:
108
103
  specification_version: 4
109
- summary: Ticker Picker for cryto currencies like BTC, LTC
104
+ summary: 'A generalized ticker picker library for cryto currencies like #BTC(bitcoin),
105
+ #LTC(litecoin) in world stock markets.'
110
106
  test_files:
111
107
  - test/test_helper.rb
112
- - test/unit/factory/developer.rb
113
- - test/unit/factory/tester.rb
114
108
  - test/unit/json/developer.json
115
109
  - test/unit/json/tester.json
116
110
  - test/unit/stocks.yml
@@ -1,30 +0,0 @@
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
@@ -1,30 +0,0 @@
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
@@ -1,30 +0,0 @@
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
@@ -1,30 +0,0 @@
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
@@ -1,30 +0,0 @@
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
@@ -1,32 +0,0 @@
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