btcturk 0.0.1

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: 652b49dc17ab8a7fe06e956821d26f4ae18dff3a
4
+ data.tar.gz: 4b6942e4865a21ccd0f2eb90774f020dffb8aad1
5
+ SHA512:
6
+ metadata.gz: 205740325e03f3e2bbb280b33b9e82e15cb1b8fd4b4187bb4d08cd3bdb958ee05ce1880ddb6a89f2ba239bdc2649be217ad66b72015b3d508325ea40397dc014
7
+ data.tar.gz: 3d116c3d7cce88386ddb869f4f9a90f99e2ac2bcb0b541e8baaa97c5f1070408652f5145fa38a0ee653e288fbb315f1d4d421f000299f5c3db03c84df1ab10ad
data/.gitignore ADDED
@@ -0,0 +1,18 @@
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
18
+ .idea/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'awesome_print'
4
+
5
+ # Specify your gem's dependencies in btcturk.gemspec
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Kerem Bozdas
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,75 @@
1
+ # BTCTurk
2
+
3
+ A simple ruby library to interface with BTCTurk API.
4
+
5
+ Also includes an executable for easy commandline access.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'btcturk'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install btcturk
20
+
21
+
22
+ ## Usage
23
+
24
+ ### Commandline
25
+
26
+ ![btcturk](http://i.imgur.com/VJ860cK.png)
27
+
28
+ ### As a Ruby Module
29
+
30
+ ```rb
31
+ require 'btcturk'
32
+ ```
33
+
34
+ ```rb
35
+ BTCTurk::ticker
36
+
37
+ => {"high"=>1290.0,
38
+ "last"=>1275.0,
39
+ "timestamp"=>1395551544.0,
40
+ "bid"=>1275.0,
41
+ "volume"=>20.81,
42
+ "low"=>1253.03,
43
+ "ask"=>1279.98}
44
+ ```
45
+
46
+ #### List all open orders:
47
+
48
+ BTCTurk::orderbook
49
+
50
+ #### List all trades:
51
+
52
+ BTCTurk::trades
53
+
54
+ #### List all trades after a specific trade-id:
55
+ ```rb
56
+ BTCTurk::trades_since('532ded923ab47520bc5841d9')
57
+
58
+ => [{"date"=>1395518866.0,
59
+ "tid"=>"532ded923ab47520bc5841da",
60
+ "price"=>1255.98,
61
+ "amount"=>0.15},
62
+
63
+ {"date"=>1395542633.0,
64
+ "tid"=>"532e4a693ab47520bc5841e1",
65
+ "price"=>1275.0,
66
+ "amount"=>0.31497106}]
67
+ ```
68
+
69
+ ## Contributing
70
+
71
+ 1. Fork it ( http://github.com/krmbzds/btcturk/fork )
72
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
73
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
74
+ 4. Push to the branch (`git push origin my-new-feature`)
75
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/btcturk ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
5
+ $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
6
+
7
+ require 'btcturk'
8
+ require 'awesome_print'
9
+
10
+ ap BTCTurk::ticker, options = {:color => {:hash => :green}}
data/btcturk.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'btcturk/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'btcturk'
8
+ spec.version = Btcturk::VERSION
9
+ spec.authors = ['Kerem Bozdas']
10
+ spec.email = ['krmbzds.github@gmail.com']
11
+ spec.summary = %q{A simple ruby library to interface with BTCTurk API.}
12
+ spec.description = %q{Also includes an executable for easy commandline access.}
13
+ spec.homepage = 'https://github.com/krmbzds/btcturk'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = ['btcturk']
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.5'
22
+ spec.add_development_dependency 'rake'
23
+ end
data/lib/btcturk.rb ADDED
@@ -0,0 +1,30 @@
1
+ require 'json'
2
+ require 'open-uri'
3
+ require 'btcturk/version'
4
+
5
+ module BTCTurk
6
+
7
+ BASE_URL = 'https://www.btcturk.com/api/'
8
+
9
+ def self.ticker
10
+ fetch 'ticker'
11
+ end
12
+
13
+ def self.orderbook
14
+ fetch 'orderbook'
15
+ end
16
+
17
+ def self.trades
18
+ fetch 'trades'
19
+ end
20
+
21
+ def self.trades_since(id)
22
+ fetch "trades?sinceid=#{id}"
23
+
24
+ end
25
+
26
+ def self.fetch(request)
27
+ JSON.parse(open(BASE_URL + request).read)
28
+ end
29
+
30
+ end
@@ -0,0 +1,3 @@
1
+ module Btcturk
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: btcturk
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Kerem Bozdas
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-23 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.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
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
+ description: Also includes an executable for easy commandline access.
42
+ email:
43
+ - krmbzds.github@gmail.com
44
+ executables:
45
+ - btcturk
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - bin/btcturk
55
+ - btcturk.gemspec
56
+ - lib/btcturk.rb
57
+ - lib/btcturk/version.rb
58
+ homepage: https://github.com/krmbzds/btcturk
59
+ licenses:
60
+ - MIT
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.1.10
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: A simple ruby library to interface with BTCTurk API.
82
+ test_files: []