trades 0.1.3 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/trades.rb +1 -18
  2. metadata +12 -1
data/lib/trades.rb CHANGED
@@ -1,10 +1,10 @@
1
1
  require 'rubygems'
2
2
  require 'socket'
3
3
  require 'json'
4
+ require 'colored'
4
5
 
5
6
  class Trades
6
7
  def initialize(args = [])
7
- <<<<<<< HEAD
8
8
  begin
9
9
  puts "Connecting..."
10
10
  @socket = TCPSocket.open("bitcoincharts.com", 27007)
@@ -25,18 +25,6 @@ class Trades
25
25
  end
26
26
 
27
27
  def loop
28
- =======
29
- @socket = TCPSocket.open("bitcoincharts.com", 27007)
30
-
31
- # Convert the exchange names to lowercase
32
- args.collect do |exchange|
33
- exchange.downcase
34
- end
35
-
36
- # thUSD | 2011-06-27 23:00:55 | USD | 17.05 | 0.5 |
37
- puts "Exchange | Date and time | Currency | Price | Volume |"
38
-
39
- >>>>>>> parent of b9f8509... Added colors to the output
40
28
  while data = @socket.gets do
41
29
  if data.length > 0
42
30
  j = JSON.parse(data.strip.tr("\x00", '')) # Delete all \x00 weirdness
@@ -46,7 +34,6 @@ class Trades
46
34
  line += Time.at(j['timestamp']).strftime("%Y-%m-%d %H:%M:%S").\
47
35
  ljust(20)
48
36
  line += "| " + j['currency'].ljust(9) + "| "
49
- <<<<<<< HEAD
50
37
 
51
38
  # Coloring: Compare the current price and the last price
52
39
  current_price = j['price'].round(2)
@@ -64,10 +51,6 @@ class Trades
64
51
 
65
52
 
66
53
  line += "| " + j['volume'].round(2).to_s.ljust(7) + "|"
67
- =======
68
- line += j['price'].round(2).to_s.ljust(7) + "| "
69
- line += j['volume'].round(2).to_s.ljust(7) + "|"
70
- >>>>>>> parent of b9f8509... Added colors to the output
71
54
 
72
55
  puts line
73
56
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: trades
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.3
5
+ version: "0.2"
6
6
  platform: ruby
7
7
  authors:
8
8
  - Waxjar
@@ -24,6 +24,17 @@ dependencies:
24
24
  version: 1.5.3
25
25
  type: :runtime
26
26
  version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: colored
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ~>
34
+ - !ruby/object:Gem::Version
35
+ version: "1.2"
36
+ type: :runtime
37
+ version_requirements: *id002
27
38
  description: Displays the trades that Bitcoincharts monitors nicely
28
39
  email:
29
40
  executables: