btcmarkets 0.1.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 +7 -0
- data/.github/workflows/ruby.yml +20 -0
- data/.gitignore +11 -0
- data/.rspec +1 -0
- data/.travis.yml +7 -0
- data/CHANGELOG.md +0 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +55 -0
- data/LICENSE.txt +21 -0
- data/README.md +31 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/btcmarkets.gemspec +34 -0
- data/lib/btcmarkets.rb +16 -0
- data/lib/btcmarkets/account.rb +15 -0
- data/lib/btcmarkets/authentication.rb +25 -0
- data/lib/btcmarkets/client.rb +57 -0
- data/lib/btcmarkets/error.rb +19 -0
- data/lib/btcmarkets/fund.rb +11 -0
- data/lib/btcmarkets/market.rb +33 -0
- data/lib/btcmarkets/server.rb +11 -0
- data/lib/btcmarkets/trade.rb +15 -0
- data/lib/btcmarkets/version.rb +3 -0
- data/lib/helpers/time.rb +9 -0
- metadata +113 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 2ec99d718599233c0f796f3a963458b7854c314a534745a8e380632d83d2b225
|
|
4
|
+
data.tar.gz: 73c52c5651426fbce9bfea82a6b609d6ae75c4e205f69e1bbeb6e04aa33d891c
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: fe3560881334b4a1599b2702de9e2f7de2d118b6c4c492dee224a996e4ab25fc9a96c4123c8b275157a08e53877e52bd29de22fd1723ed83c7c26756dcce6945
|
|
7
|
+
data.tar.gz: 218b88ceeb20158f2e3309b3537e64e2339d0318a2a59a16005dfd126f8b7d51f2254eb2c14c62d4290631aa2a39d96e216f6e9512b1ac3e7fa301cbba5e5ede
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: Ruby
|
|
2
|
+
|
|
3
|
+
on: [push]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v1
|
|
12
|
+
- name: Set up Ruby 2.6
|
|
13
|
+
uses: actions/setup-ruby@v1
|
|
14
|
+
with:
|
|
15
|
+
ruby-version: 2.6.x
|
|
16
|
+
- name: Build and rspec test
|
|
17
|
+
run: |
|
|
18
|
+
gem install bundler
|
|
19
|
+
bundle install --jobs 4 --retry 3
|
|
20
|
+
bundle exec rspec
|
data/.gitignore
ADDED
data/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--require spec_helper
|
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
|
File without changes
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at liang.shi@protonmail.com. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: http://contributor-covenant.org
|
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
btcmarkets (0.1.0)
|
|
5
|
+
|
|
6
|
+
GEM
|
|
7
|
+
remote: https://rubygems.org/
|
|
8
|
+
specs:
|
|
9
|
+
addressable (2.7.0)
|
|
10
|
+
public_suffix (>= 2.0.2, < 5.0)
|
|
11
|
+
crack (0.4.3)
|
|
12
|
+
safe_yaml (~> 1.0.0)
|
|
13
|
+
diff-lcs (1.3)
|
|
14
|
+
hashdiff (1.0.0)
|
|
15
|
+
httparty (0.17.1)
|
|
16
|
+
mime-types (~> 3.0)
|
|
17
|
+
multi_xml (>= 0.5.2)
|
|
18
|
+
mime-types (3.3)
|
|
19
|
+
mime-types-data (~> 3.2015)
|
|
20
|
+
mime-types-data (3.2019.1009)
|
|
21
|
+
multi_xml (0.6.0)
|
|
22
|
+
public_suffix (4.0.1)
|
|
23
|
+
rake (10.5.0)
|
|
24
|
+
rspec (3.9.0)
|
|
25
|
+
rspec-core (~> 3.9.0)
|
|
26
|
+
rspec-expectations (~> 3.9.0)
|
|
27
|
+
rspec-mocks (~> 3.9.0)
|
|
28
|
+
rspec-core (3.9.0)
|
|
29
|
+
rspec-support (~> 3.9.0)
|
|
30
|
+
rspec-expectations (3.9.0)
|
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
32
|
+
rspec-support (~> 3.9.0)
|
|
33
|
+
rspec-mocks (3.9.0)
|
|
34
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
35
|
+
rspec-support (~> 3.9.0)
|
|
36
|
+
rspec-support (3.9.0)
|
|
37
|
+
safe_yaml (1.0.5)
|
|
38
|
+
webmock (3.7.6)
|
|
39
|
+
addressable (>= 2.3.6)
|
|
40
|
+
crack (>= 0.3.2)
|
|
41
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
|
42
|
+
|
|
43
|
+
PLATFORMS
|
|
44
|
+
ruby
|
|
45
|
+
|
|
46
|
+
DEPENDENCIES
|
|
47
|
+
btcmarkets!
|
|
48
|
+
bundler (~> 2.0)
|
|
49
|
+
httparty
|
|
50
|
+
rake (~> 10.0)
|
|
51
|
+
rspec
|
|
52
|
+
webmock
|
|
53
|
+
|
|
54
|
+
BUNDLED WITH
|
|
55
|
+
2.0.2
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Liang Shi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# BTCMarkets API wrapper
|
|
2
|
+
This is Ruby Wrapper for https://btcmarkets.net/
|
|
3
|
+
|
|
4
|
+
## Supported API
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
# public API
|
|
8
|
+
BTCMarkets::Market.markets
|
|
9
|
+
BTCMarkets::Market.tikers(%w[BTC-AUD LTC-AUD])
|
|
10
|
+
BTCMarkets::Server.time
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# private API
|
|
14
|
+
# Set up the BTCMakerts API key as environment variables:
|
|
15
|
+
|
|
16
|
+
ENV['BTCMARKETS_PUBLIC_KEY'] = ''
|
|
17
|
+
ENV['BTCMARKETS_PRIVATE_KEY'] = ''
|
|
18
|
+
|
|
19
|
+
BTCMarkets::Account.blance
|
|
20
|
+
|
|
21
|
+
BTCMarkets::Account.transactions({limit: 2, after: xxxxx, before: xxxx})
|
|
22
|
+
BTCMarkets::Account.transactions
|
|
23
|
+
|
|
24
|
+
BTCMarkets::Trade.trades
|
|
25
|
+
BTCMarkets::Trade.trade('xxxxxx')
|
|
26
|
+
|
|
27
|
+
BTCMarkets::Fund.deposit_address('BTC')
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Licence
|
|
31
|
+
MIT
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "btcmarkets"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/btcmarkets.gemspec
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
+
require "btcmarkets/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "btcmarkets"
|
|
7
|
+
spec.version = BTCMarkets::VERSION
|
|
8
|
+
spec.authors = ["Liang Shi"]
|
|
9
|
+
spec.email = ["liang.shi@protonmail.com"]
|
|
10
|
+
|
|
11
|
+
spec.summary = %q{A ruby wrapper for BTCMarkets public API}
|
|
12
|
+
# spec.description = %q{}
|
|
13
|
+
spec.homepage = "https://github.com/2pd/btcmarkets-ruby"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
|
17
|
+
|
|
18
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
19
|
+
spec.metadata["source_code_uri"] = "https://github.com/2pd/btcmarkets-ruby"
|
|
20
|
+
spec.metadata["changelog_uri"] = "https://github.com/2pd/btcmarkets-ruby/blob/master/CHANGELOG.md"
|
|
21
|
+
|
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
24
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
25
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
26
|
+
end
|
|
27
|
+
spec.bindir = "exe"
|
|
28
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
29
|
+
spec.require_paths = ["lib"]
|
|
30
|
+
|
|
31
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
|
32
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
33
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
34
|
+
end
|
data/lib/btcmarkets.rb
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'httparty'
|
|
4
|
+
require 'helpers/time'
|
|
5
|
+
require 'btcmarkets/version'
|
|
6
|
+
|
|
7
|
+
require 'btcmarkets/error'
|
|
8
|
+
require 'btcmarkets/client'
|
|
9
|
+
|
|
10
|
+
require 'btcmarkets/market'
|
|
11
|
+
require 'btcmarkets/server'
|
|
12
|
+
|
|
13
|
+
require 'btcmarkets/authentication'
|
|
14
|
+
require 'btcmarkets/account'
|
|
15
|
+
require 'btcmarkets/trade'
|
|
16
|
+
require 'btcmarkets/fund'
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module BTCMarkets
|
|
4
|
+
class Account
|
|
5
|
+
class << self
|
|
6
|
+
def balance
|
|
7
|
+
Client.private_send(:get, '/v3/accounts/me/balances')
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def transactions(params = {})
|
|
11
|
+
Client.private_send(:get, '/v3/accounts/me/transactions', params: params)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'base64'
|
|
4
|
+
|
|
5
|
+
module BTCMarkets
|
|
6
|
+
class Authentication
|
|
7
|
+
class << self
|
|
8
|
+
def api_public_key
|
|
9
|
+
ENV['BTCMARKETS_PUBLIC_KEY']
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def api_private_key
|
|
13
|
+
ENV['BTCMARKETS_PRIVATE_KEY']
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def signature(payload)
|
|
17
|
+
Base64.strict_encode64(OpenSSL::HMAC.digest('sha512', base64_encrypted_key, payload))
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def base64_encrypted_key
|
|
21
|
+
Base64.decode64(api_private_key)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module BTCMarkets
|
|
4
|
+
class Client
|
|
5
|
+
include HTTParty
|
|
6
|
+
|
|
7
|
+
base_uri 'https://api.btcmarkets.net'
|
|
8
|
+
|
|
9
|
+
class << self
|
|
10
|
+
def public_send(path: '/', params: {})
|
|
11
|
+
response = get(path, query: params)
|
|
12
|
+
process(response)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def private_send(method, path, params: {})
|
|
16
|
+
case method
|
|
17
|
+
when :get
|
|
18
|
+
response = send(method, path, headers: build_headers(method.to_s, path), query: params)
|
|
19
|
+
else
|
|
20
|
+
response = send(method, path, headers: build_headers(method.to_s, path, params), body: params)
|
|
21
|
+
end
|
|
22
|
+
process(response)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def build_headers(method, path, params = {})
|
|
28
|
+
timestamp = Helpers::Time.timestamp.to_s
|
|
29
|
+
|
|
30
|
+
{
|
|
31
|
+
"Accept": 'application/json',
|
|
32
|
+
"Accept-Charset": 'UTF-8',
|
|
33
|
+
"Content-Type": 'application/json',
|
|
34
|
+
"BM-AUTH-APIKEY": Authentication.api_public_key,
|
|
35
|
+
"BM-AUTH-TIMESTAMP": timestamp,
|
|
36
|
+
"BM-AUTH-SIGNATURE": Authentication.signature(payload(method, path, timestamp, params))
|
|
37
|
+
}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def payload(method, path, timestamp, params)
|
|
41
|
+
method = method.upcase
|
|
42
|
+
unless params.empty?
|
|
43
|
+
return "#{method}#{path}#{timestamp}#{params.to_json}"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
"#{method}#{path}#{timestamp}"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def process(response)
|
|
50
|
+
data = JSON.parse(response.body, symbolize_names: true)
|
|
51
|
+
raise Error.new(response.code, data) if Error.error_response?(response)
|
|
52
|
+
|
|
53
|
+
data
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module BTCMarkets
|
|
4
|
+
class Error < StandardError
|
|
5
|
+
attr_reader :status, :message, :data
|
|
6
|
+
|
|
7
|
+
class << self
|
|
8
|
+
def error_response?(response)
|
|
9
|
+
response.code >= 400
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def initialize(status, data = {})
|
|
14
|
+
@status = status
|
|
15
|
+
@message = data[:message]
|
|
16
|
+
@data = data
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module BTCMarkets
|
|
4
|
+
class Market
|
|
5
|
+
class << self
|
|
6
|
+
def markets
|
|
7
|
+
Client.public_send(path: '/v3/markets')
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def ticker(market_id)
|
|
11
|
+
Client.public_send(path: "/v3/markets/#{market_id}/ticker")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def tickers(market_ids = [])
|
|
15
|
+
params = { 'marketId': market_ids } unless market_ids.empty?
|
|
16
|
+
Client.public_send(path: '/v3/markets/tickers', params: params)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def trades(market_id, params = {})
|
|
20
|
+
Client.public_send(path: "/v3/markets/#{market_id}/trades", params: params)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def orderbook(market_id, params = {})
|
|
24
|
+
Client.public_send(path: "/v3/markets/#{market_id}/orderbook", params: params)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def orderbooks(market_ids = [])
|
|
28
|
+
params = { 'marketId': market_ids } unless market_ids.empty?
|
|
29
|
+
Client.public_send(path: '/v3/markets/orderbooks', params: params)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module BTCMarkets
|
|
4
|
+
class Trade
|
|
5
|
+
class << self
|
|
6
|
+
def trades(params = {})
|
|
7
|
+
Client.private_send(:get, '/v3/trades', params: params)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def trade(id)
|
|
11
|
+
Client.private_send(:get, "/v3/trades/#{id}")
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
data/lib/helpers/time.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: btcmarkets
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Liang Shi
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2019-11-08 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: '2.0'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '2.0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '3.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '3.0'
|
|
55
|
+
description:
|
|
56
|
+
email:
|
|
57
|
+
- liang.shi@protonmail.com
|
|
58
|
+
executables: []
|
|
59
|
+
extensions: []
|
|
60
|
+
extra_rdoc_files: []
|
|
61
|
+
files:
|
|
62
|
+
- ".github/workflows/ruby.yml"
|
|
63
|
+
- ".gitignore"
|
|
64
|
+
- ".rspec"
|
|
65
|
+
- ".travis.yml"
|
|
66
|
+
- CHANGELOG.md
|
|
67
|
+
- CODE_OF_CONDUCT.md
|
|
68
|
+
- Gemfile
|
|
69
|
+
- Gemfile.lock
|
|
70
|
+
- LICENSE.txt
|
|
71
|
+
- README.md
|
|
72
|
+
- Rakefile
|
|
73
|
+
- bin/console
|
|
74
|
+
- bin/setup
|
|
75
|
+
- btcmarkets.gemspec
|
|
76
|
+
- lib/btcmarkets.rb
|
|
77
|
+
- lib/btcmarkets/account.rb
|
|
78
|
+
- lib/btcmarkets/authentication.rb
|
|
79
|
+
- lib/btcmarkets/client.rb
|
|
80
|
+
- lib/btcmarkets/error.rb
|
|
81
|
+
- lib/btcmarkets/fund.rb
|
|
82
|
+
- lib/btcmarkets/market.rb
|
|
83
|
+
- lib/btcmarkets/server.rb
|
|
84
|
+
- lib/btcmarkets/trade.rb
|
|
85
|
+
- lib/btcmarkets/version.rb
|
|
86
|
+
- lib/helpers/time.rb
|
|
87
|
+
homepage: https://github.com/2pd/btcmarkets-ruby
|
|
88
|
+
licenses:
|
|
89
|
+
- MIT
|
|
90
|
+
metadata:
|
|
91
|
+
homepage_uri: https://github.com/2pd/btcmarkets-ruby
|
|
92
|
+
source_code_uri: https://github.com/2pd/btcmarkets-ruby
|
|
93
|
+
changelog_uri: https://github.com/2pd/btcmarkets-ruby/blob/master/CHANGELOG.md
|
|
94
|
+
post_install_message:
|
|
95
|
+
rdoc_options: []
|
|
96
|
+
require_paths:
|
|
97
|
+
- lib
|
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - ">="
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '0'
|
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
|
+
requirements:
|
|
105
|
+
- - ">="
|
|
106
|
+
- !ruby/object:Gem::Version
|
|
107
|
+
version: '0'
|
|
108
|
+
requirements: []
|
|
109
|
+
rubygems_version: 3.0.3
|
|
110
|
+
signing_key:
|
|
111
|
+
specification_version: 4
|
|
112
|
+
summary: A ruby wrapper for BTCMarkets public API
|
|
113
|
+
test_files: []
|