forked from leishman/kraken_ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
67 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
spec/kraken_key.rb | ||
.project | ||
Gemfile.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ source 'https://rubygems.org' | |
gemspec | ||
gem 'httparty' | ||
gem 'hashie' | ||
gem 'addressable' |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
require 'kraken_ruby' | ||
require 'kraken_key' | ||
|
||
describe Kraken::Client do | ||
|
||
before :each do | ||
# FIXME: perhaps it would be wiser or make more sense to implement | ||
# this sleep within the actual library -- just not sure if that is | ||
# a desired default behavior or if it's something that maybe should | ||
# be left up to the developer using the library | ||
|
||
sleep 0.3 # to prevent rapidly pinging the Kraken server | ||
end | ||
|
||
let(:kraken){ Kraken::Client.new(API_KEY, API_SECRET) } | ||
|
||
context "public data" do | ||
it "gets the proper server time" do | ||
kraken_time = DateTime.parse(kraken.server_time.rfc1123) | ||
utc_time = Time.now.getutc | ||
expect(kraken_time.day).to eq utc_time.day | ||
expect(kraken_time.hour).to eq utc_time.hour | ||
end | ||
|
||
it "gets list of tradeable assets" do | ||
expect(kraken.assets).to respond_to :XLTC | ||
end | ||
|
||
it "gets list of asset pairs" do | ||
expect(kraken.asset_pairs).to respond_to :XLTCXXDG | ||
end | ||
|
||
it "gets public ticker data for given asset pairs" do | ||
result = kraken.ticker('XLTCXXDG, ZEURXXDG') | ||
expect(result).to respond_to :XLTCXXDG | ||
expect(result).to respond_to :ZEURXXDG | ||
end | ||
|
||
it "gets order book data for a given asset pair" do | ||
order_book = kraken.order_book('XLTCXXDG') | ||
expect(order_book.XLTCXXDG).to respond_to :asks | ||
end | ||
|
||
it "gets an array of trades data for a given asset pair" do | ||
trades = kraken.trades('XLTCXXDG') | ||
expect(trades.XLTCXXDG).to be_instance_of(Array) | ||
end | ||
|
||
it "gets an array of spread data for a given asset pair" do | ||
spread = kraken.spread('XLTCXXDG') | ||
expect(spread.XLTCXXDG).to be_instance_of(Array) | ||
end | ||
end | ||
|
||
context "private data" do # More tests to come | ||
it "gets the user's balance" do | ||
expect(kraken.balance).to be_instance_of(Hash) | ||
end | ||
end | ||
|
||
end |