Package not found. Please check the package name and try again.
bitmex-api 0.0.1
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/.gitignore +11 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/.travis.yml +21 -0
- data/CHANGELOG.md +10 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +70 -0
- data/README.md +51 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bin/whales-watching.rb +36 -0
- data/bitmex.gemspec +49 -0
- data/lib/bitmex-api.rb +1 -0
- data/lib/bitmex.rb +10 -0
- data/lib/bitmex/client.rb +85 -0
- data/lib/bitmex/version.rb +3 -0
- metadata +205 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 6c0ad3797a640e5d993633783c03c687188c1f5e1501da09b31e2e2fae1eec50
|
|
4
|
+
data.tar.gz: 550b4b07e4ff4a2db3521f5cdb7b0b4739fdfbdaa4f76298150325073e7af9cd
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 86357550081e44d06b37ec124b39389a491fa3811ae3a6dd6f9915f3d48ea4e989415f45dfb73c83ac30ba6ddd4ed6977b91dad967302c5171bd3366a9bccbeb
|
|
7
|
+
data.tar.gz: 548fcc1d6dbf5e2027a448f8440dde290659ff699ec1db22610cf9f537dfc08aeffae98dd93e0368d1f9988b0229a99e5ce3e35f129b16bdd44f96df53fab74c
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.5.3
|
data/.travis.yml
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
sudo: false
|
|
3
|
+
language: ruby
|
|
4
|
+
cache: bundler
|
|
5
|
+
rvm:
|
|
6
|
+
- 2.5.3
|
|
7
|
+
|
|
8
|
+
env:
|
|
9
|
+
global:
|
|
10
|
+
- CC_TEST_REPORTER_ID=62a2cea238cf89f14f968d9a91fe41af7a11f414f6cc9194df7abc7887e61f6e
|
|
11
|
+
|
|
12
|
+
before_install:
|
|
13
|
+
- gem install bundler -v 1.17.1
|
|
14
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
|
15
|
+
- chmod +x ./cc-test-reporter
|
|
16
|
+
|
|
17
|
+
before_script:
|
|
18
|
+
- ./cc-test-reporter before-build
|
|
19
|
+
|
|
20
|
+
after_script:
|
|
21
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.0.1] - 2019-01-03
|
|
9
|
+
### Added
|
|
10
|
+
- Public REST API support
|
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 iulian.costan@gmail.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,70 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
bitmex-api (0.0.1)
|
|
5
|
+
eventmachine
|
|
6
|
+
faye-websocket
|
|
7
|
+
hashie
|
|
8
|
+
httparty
|
|
9
|
+
|
|
10
|
+
GEM
|
|
11
|
+
remote: https://rubygems.org/
|
|
12
|
+
specs:
|
|
13
|
+
bump (0.7.0)
|
|
14
|
+
coderay (1.1.2)
|
|
15
|
+
diff-lcs (1.3)
|
|
16
|
+
docile (1.3.1)
|
|
17
|
+
eventmachine (1.2.7)
|
|
18
|
+
faye-websocket (0.10.7)
|
|
19
|
+
eventmachine (>= 0.12.0)
|
|
20
|
+
websocket-driver (>= 0.5.1)
|
|
21
|
+
hashie (3.6.0)
|
|
22
|
+
httparty (0.16.3)
|
|
23
|
+
mime-types (~> 3.0)
|
|
24
|
+
multi_xml (>= 0.5.2)
|
|
25
|
+
json (2.1.0)
|
|
26
|
+
method_source (0.9.2)
|
|
27
|
+
mime-types (3.2.2)
|
|
28
|
+
mime-types-data (~> 3.2015)
|
|
29
|
+
mime-types-data (3.2018.0812)
|
|
30
|
+
multi_xml (0.6.0)
|
|
31
|
+
pry (0.12.2)
|
|
32
|
+
coderay (~> 1.1.0)
|
|
33
|
+
method_source (~> 0.9.0)
|
|
34
|
+
rake (12.3.2)
|
|
35
|
+
rspec (3.8.0)
|
|
36
|
+
rspec-core (~> 3.8.0)
|
|
37
|
+
rspec-expectations (~> 3.8.0)
|
|
38
|
+
rspec-mocks (~> 3.8.0)
|
|
39
|
+
rspec-core (3.8.0)
|
|
40
|
+
rspec-support (~> 3.8.0)
|
|
41
|
+
rspec-expectations (3.8.2)
|
|
42
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
43
|
+
rspec-support (~> 3.8.0)
|
|
44
|
+
rspec-mocks (3.8.0)
|
|
45
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
46
|
+
rspec-support (~> 3.8.0)
|
|
47
|
+
rspec-support (3.8.0)
|
|
48
|
+
simplecov (0.16.1)
|
|
49
|
+
docile (~> 1.1)
|
|
50
|
+
json (>= 1.8, < 3)
|
|
51
|
+
simplecov-html (~> 0.10.0)
|
|
52
|
+
simplecov-html (0.10.2)
|
|
53
|
+
websocket-driver (0.7.0)
|
|
54
|
+
websocket-extensions (>= 0.1.0)
|
|
55
|
+
websocket-extensions (0.1.3)
|
|
56
|
+
|
|
57
|
+
PLATFORMS
|
|
58
|
+
ruby
|
|
59
|
+
|
|
60
|
+
DEPENDENCIES
|
|
61
|
+
bitmex-api!
|
|
62
|
+
bump
|
|
63
|
+
bundler
|
|
64
|
+
pry
|
|
65
|
+
rake
|
|
66
|
+
rspec
|
|
67
|
+
simplecov
|
|
68
|
+
|
|
69
|
+
BUNDLED WITH
|
|
70
|
+
1.17.1
|
data/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Bitmex
|
|
2
|
+
|
|
3
|
+
[](https://travis-ci.org/icostan/bitmex-api-ruby)
|
|
4
|
+
[](https://codeclimate.com/github/icostan/bitmex-api-ruby/maintainability)
|
|
5
|
+
[](https://codeclimate.com/github/icostan/bitmex-api-ruby/test_coverage)
|
|
6
|
+
[](https://badge.fury.io/rb/bitmex-api)
|
|
7
|
+
|
|
8
|
+
Ruby library for BitMEX [API](https://www.bitmex.com/app/apiOverview).
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
Add this line to your application's Gemfile:
|
|
13
|
+
|
|
14
|
+
```ruby
|
|
15
|
+
gem 'bitmex-api'
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
And then execute:
|
|
19
|
+
|
|
20
|
+
$ bundle
|
|
21
|
+
|
|
22
|
+
Or install it yourself as:
|
|
23
|
+
|
|
24
|
+
$ gem install bitmex-api
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```ruby
|
|
29
|
+
require 'bitmex'
|
|
30
|
+
|
|
31
|
+
client = Bitmex::Client.new
|
|
32
|
+
|
|
33
|
+
# first 10 trades after Jan 1st for XBTUSD product
|
|
34
|
+
trades = client.trade symbol: 'XBTUSD', count: 10, startTime: '2019-01-01'
|
|
35
|
+
trades.size
|
|
36
|
+
trades.first
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Development
|
|
40
|
+
|
|
41
|
+
After checking out the repo, run `bundle install` to install dependencies. Then, run `bundle exec rake` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
42
|
+
|
|
43
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
44
|
+
|
|
45
|
+
## Contributing
|
|
46
|
+
|
|
47
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/icostan/bitmex-api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
48
|
+
|
|
49
|
+
## Code of Conduct
|
|
50
|
+
|
|
51
|
+
Everyone interacting in the Bitmex project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/icostan/bitmex-api/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "bitmex"
|
|
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
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'json'
|
|
4
|
+
require 'faye/websocket'
|
|
5
|
+
require 'eventmachine'
|
|
6
|
+
|
|
7
|
+
product = (ARGV.first || 'BTCUSD')
|
|
8
|
+
limit = (ARGV[1] || 10).to_i
|
|
9
|
+
puts "==> Filter trades > #{limit} #{product}"
|
|
10
|
+
|
|
11
|
+
EM.run {
|
|
12
|
+
ws = Faye::WebSocket::Client.new('wss://www.bitmex.com/realtime')
|
|
13
|
+
|
|
14
|
+
ws.on :open do |event|
|
|
15
|
+
p [:open]
|
|
16
|
+
ws.send "{\"op\": \"subscribe\", \"args\": [\"trade:#{product}\"]}"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
ws.on :message do |event|
|
|
20
|
+
json = JSON.parse event.data
|
|
21
|
+
data = json['data']
|
|
22
|
+
|
|
23
|
+
data && data.select{ |trade| trade['homeNotional'].to_i > limit }.each do |trade|
|
|
24
|
+
p trade
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
ws.on :error do |event|
|
|
29
|
+
p [:error, event.data]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
ws.on :close do |event|
|
|
33
|
+
p [:close, event.code, event.reason]
|
|
34
|
+
ws = nil
|
|
35
|
+
end
|
|
36
|
+
}
|
data/bitmex.gemspec
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require "bitmex/version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = 'bitmex-api'
|
|
8
|
+
spec.version = Bitmex::VERSION
|
|
9
|
+
spec.authors = ['Iulian Costan']
|
|
10
|
+
spec.email = ['iulian.costan@gmail.com']
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{Ruby library for BitMEX API}
|
|
13
|
+
spec.description = %q{Ruby library for BitMEX API}
|
|
14
|
+
spec.homepage = 'https://github.com/icostan/bitmex-api-ruby'
|
|
15
|
+
|
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
|
18
|
+
if spec.respond_to?(:metadata)
|
|
19
|
+
spec.metadata["allowed_push_host"] = 'https://rubygems.org'
|
|
20
|
+
|
|
21
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
22
|
+
spec.metadata["source_code_uri"] = 'https://github.com/icostan/bitmex-api-ruby.git'
|
|
23
|
+
spec.metadata["changelog_uri"] = 'https://github.com/icostan/bitmex-api-ruby/blob/master/CHANGELOG.md'
|
|
24
|
+
else
|
|
25
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
|
26
|
+
"public gem pushes."
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Specify which files should be added to the gem when it is released.
|
|
30
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
31
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
32
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
33
|
+
end
|
|
34
|
+
spec.bindir = "exe"
|
|
35
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
36
|
+
spec.require_paths = ["lib"]
|
|
37
|
+
|
|
38
|
+
spec.add_dependency 'httparty'
|
|
39
|
+
spec.add_dependency 'hashie'
|
|
40
|
+
spec.add_dependency 'faye-websocket'
|
|
41
|
+
spec.add_dependency 'eventmachine'
|
|
42
|
+
|
|
43
|
+
spec.add_development_dependency 'bundler'
|
|
44
|
+
spec.add_development_dependency 'rake'
|
|
45
|
+
spec.add_development_dependency 'rspec'
|
|
46
|
+
spec.add_development_dependency 'bump'
|
|
47
|
+
spec.add_development_dependency 'pry'
|
|
48
|
+
spec.add_development_dependency 'simplecov'
|
|
49
|
+
end
|
data/lib/bitmex-api.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require_relative 'bitmex'
|
data/lib/bitmex.rb
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
module Bitmex
|
|
2
|
+
class Client
|
|
3
|
+
include HTTParty
|
|
4
|
+
|
|
5
|
+
ANNOUNCEMENT_ARGS = %w(urgent).freeze
|
|
6
|
+
EXECUTION_ARGS = %w(tradeHistory).freeze
|
|
7
|
+
FUNDING_ARGS = %w().freeze
|
|
8
|
+
GLOBALNOTIFICATION_ARGS = %w().freeze
|
|
9
|
+
INSTRUMENT_ARGS = %w(active activeAndIndices activeIntervals compositeIndex indices).freeze
|
|
10
|
+
INSURANCE_ARGS = %w().freeze
|
|
11
|
+
LEADERBOARD_ARGS = %w().freeze
|
|
12
|
+
LIQUIDATION_ARGS = %w().freeze
|
|
13
|
+
ORDER_ARGS = %w().freeze
|
|
14
|
+
ORDERBOOK_ARGS = %w(L2).freeze
|
|
15
|
+
QUOTE_ARGS = %w(bucketed).freeze
|
|
16
|
+
SCHEMA_ARGS = %w(websocketHelp).freeze
|
|
17
|
+
SETTLEMENT_ARGS = %w().freeze
|
|
18
|
+
STATS_ARGS = %w(history historyUSD).freeze
|
|
19
|
+
TRADE_ARGS = %w(bucketed).freeze
|
|
20
|
+
|
|
21
|
+
attr_reader :base_url
|
|
22
|
+
|
|
23
|
+
def initialize(testnet: false)
|
|
24
|
+
@base_url = testnet ? 'https://testnet.bitmex.com/api/v1' : 'https://www.bitmex.com/api/v1'
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def global_notification
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def leaderboard
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def order
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def order_book(symbol)
|
|
37
|
+
execute 'orderbook', 'L2', ORDERBOOK_ARGS, symbol: symbol do |response|
|
|
38
|
+
response.to_a.map do |s|
|
|
39
|
+
Hashie::Mash.new s
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def position
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def user
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def user_event
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
private
|
|
54
|
+
|
|
55
|
+
def method_missing(m, *args, &ablock)
|
|
56
|
+
name = m.to_s.gsub '_', ''
|
|
57
|
+
params = args.first || {}
|
|
58
|
+
type = params.delete :type
|
|
59
|
+
types = self.class.const_get "#{name.upcase}_ARGS"
|
|
60
|
+
execute name, type, types, params do |response|
|
|
61
|
+
if response.parsed_response.is_a? Array
|
|
62
|
+
response.to_a.map do |s|
|
|
63
|
+
Hashie::Mash.new s
|
|
64
|
+
end
|
|
65
|
+
else
|
|
66
|
+
Hashie::Mash.new response
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def execute(endpoint, type, types, params, &ablock)
|
|
72
|
+
check! type, types
|
|
73
|
+
|
|
74
|
+
url = "#{base_url}/#{endpoint}/#{type}"
|
|
75
|
+
response = self.class.get url, query: params
|
|
76
|
+
fail response.message unless response.success?
|
|
77
|
+
yield response
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def check!(type, types)
|
|
81
|
+
return true if type.nil? or type == ''
|
|
82
|
+
raise ArgumentError, "invalid argument #{type}, only #{types} are supported" if !types.include?(type.to_s)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: bitmex-api
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Iulian Costan
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2019-01-03 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: httparty
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: hashie
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :runtime
|
|
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: faye-websocket
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: eventmachine
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: bundler
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: rake
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: rspec
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: bump
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ">="
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '0'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - ">="
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '0'
|
|
125
|
+
- !ruby/object:Gem::Dependency
|
|
126
|
+
name: pry
|
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - ">="
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: '0'
|
|
132
|
+
type: :development
|
|
133
|
+
prerelease: false
|
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - ">="
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: '0'
|
|
139
|
+
- !ruby/object:Gem::Dependency
|
|
140
|
+
name: simplecov
|
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
|
142
|
+
requirements:
|
|
143
|
+
- - ">="
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: '0'
|
|
146
|
+
type: :development
|
|
147
|
+
prerelease: false
|
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - ">="
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '0'
|
|
153
|
+
description: Ruby library for BitMEX API
|
|
154
|
+
email:
|
|
155
|
+
- iulian.costan@gmail.com
|
|
156
|
+
executables: []
|
|
157
|
+
extensions: []
|
|
158
|
+
extra_rdoc_files: []
|
|
159
|
+
files:
|
|
160
|
+
- ".gitignore"
|
|
161
|
+
- ".rspec"
|
|
162
|
+
- ".ruby-version"
|
|
163
|
+
- ".travis.yml"
|
|
164
|
+
- CHANGELOG.md
|
|
165
|
+
- CODE_OF_CONDUCT.md
|
|
166
|
+
- Gemfile
|
|
167
|
+
- Gemfile.lock
|
|
168
|
+
- README.md
|
|
169
|
+
- Rakefile
|
|
170
|
+
- bin/console
|
|
171
|
+
- bin/setup
|
|
172
|
+
- bin/whales-watching.rb
|
|
173
|
+
- bitmex.gemspec
|
|
174
|
+
- lib/bitmex-api.rb
|
|
175
|
+
- lib/bitmex.rb
|
|
176
|
+
- lib/bitmex/client.rb
|
|
177
|
+
- lib/bitmex/version.rb
|
|
178
|
+
homepage: https://github.com/icostan/bitmex-api-ruby
|
|
179
|
+
licenses: []
|
|
180
|
+
metadata:
|
|
181
|
+
allowed_push_host: https://rubygems.org
|
|
182
|
+
homepage_uri: https://github.com/icostan/bitmex-api-ruby
|
|
183
|
+
source_code_uri: https://github.com/icostan/bitmex-api-ruby.git
|
|
184
|
+
changelog_uri: https://github.com/icostan/bitmex-api-ruby/blob/master/CHANGELOG.md
|
|
185
|
+
post_install_message:
|
|
186
|
+
rdoc_options: []
|
|
187
|
+
require_paths:
|
|
188
|
+
- lib
|
|
189
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
190
|
+
requirements:
|
|
191
|
+
- - ">="
|
|
192
|
+
- !ruby/object:Gem::Version
|
|
193
|
+
version: '0'
|
|
194
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
|
+
requirements:
|
|
196
|
+
- - ">="
|
|
197
|
+
- !ruby/object:Gem::Version
|
|
198
|
+
version: '0'
|
|
199
|
+
requirements: []
|
|
200
|
+
rubyforge_project:
|
|
201
|
+
rubygems_version: 2.7.6
|
|
202
|
+
signing_key:
|
|
203
|
+
specification_version: 4
|
|
204
|
+
summary: Ruby library for BitMEX API
|
|
205
|
+
test_files: []
|