cointrader.net 0.8.0 → 0.9.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 +4 -4
- data/lib/cointrader.net/client.rb +1 -0
- data/lib/cointrader.net/client/error.rb +6 -0
- data/lib/cointrader.net/client/request.rb +30 -1
- data/lib/cointrader.net/version.rb +1 -1
- data/spec/client_spec.rb +49 -79
- data/spec/fixtures/vcr_cassettes/{balance.yml → Cointrader_Client/account/_balance/returns_a_balance.yml} +6 -6
- data/spec/fixtures/vcr_cassettes/{tradehistory.yml → Cointrader_Client/account/_tradehistory/returns_trade_history.yml} +6 -6
- data/spec/fixtures/vcr_cassettes/{cancel.yml → Cointrader_Client/order/_cancel/cancels_an_order.yml} +12 -12
- data/spec/fixtures/vcr_cassettes/Cointrader_Client/order/_limit_buy/returns_an_order.yml +66 -0
- data/spec/fixtures/vcr_cassettes/Cointrader_Client/order/_limit_buy/throws_an_error_when_there_are_insufficient_funds.yml +66 -0
- data/spec/fixtures/vcr_cassettes/Cointrader_Client/order/_limit_sell/returns_an_order.yml +66 -0
- data/spec/fixtures/vcr_cassettes/{list.yml → Cointrader_Client/order/_list/when_there_are_no_orders/throws_an_error.yml} +6 -6
- data/spec/fixtures/vcr_cassettes/Cointrader_Client/order/_list/when_there_are_orders/lists_open_limit_orders.yml +129 -0
- data/spec/fixtures/vcr_cassettes/Cointrader_Client/order/_market_buy/returns_an_order.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Cointrader_Client/order/_market_sell/returns_an_order.yml +66 -0
- data/spec/fixtures/vcr_cassettes/{trades.yml → Cointrader_Client/order/_trades/lists_recent_trades_executed.yml} +11 -9
- data/spec/fixtures/vcr_cassettes/{orders.yml → Cointrader_Client/stats/_orders/returns_open_orders.yml} +12 -12
- data/spec/fixtures/vcr_cassettes/{stats_24h.yml → Cointrader_Client/stats/_stats_24h/returns_24_hour_sliding_statistics.yml} +11 -11
- data/spec/fixtures/vcr_cassettes/{stats_7d.yml → Cointrader_Client/stats/_stats_7d/returns_7_day_sliding_statistics.yml} +10 -10
- data/spec/fixtures/vcr_cassettes/{symbol.yml → Cointrader_Client/stats/_symbol/returns_supported_currencies.yml} +6 -6
- data/spec/spec_helper.rb +1 -0
- metadata +33 -28
- data/spec/fixtures/vcr_cassettes/limit_buy.yml +0 -65
- data/spec/fixtures/vcr_cassettes/limit_sell.yml +0 -58
- data/spec/fixtures/vcr_cassettes/market_buy.yml +0 -71
- data/spec/fixtures/vcr_cassettes/market_sell.yml +0 -72
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 7ecad613ebfbea1bf2859dfc6a00029ef45610b6
         | 
| 4 | 
            +
              data.tar.gz: bdfbb95bb25cbabcc7ba0399734d6455f6562ace
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: ea34eb938fc6805bb1728a9ba78c3692760d2769e8f6f2b9e7732fd97ec1f8ce83a91469d27a499372abca87518f829d89f57fbfe9e4f892573bd048981f301b
         | 
| 7 | 
            +
              data.tar.gz: 79a0c0b1bb3bc3fbd72729dad7d6d607bc143b6b7904a3d56a10cdd44dfb085757ae6adbcaa5d3c3b6ebf908c1de47ce0b0787fb7aa1917ca7b4f15a1045b63c
         | 
| @@ -39,9 +39,11 @@ module Cointrader | |
| 39 39 | 
             
                end
         | 
| 40 40 |  | 
| 41 41 | 
             
                def request(method, path, body={})
         | 
| 42 | 
            -
                  JSON.parse(hmac_request(method, path, body))
         | 
| 42 | 
            +
                  check_errors(JSON.parse(hmac_request(method, path, body)))
         | 
| 43 43 | 
             
                end
         | 
| 44 44 |  | 
| 45 | 
            +
                private
         | 
| 46 | 
            +
             | 
| 45 47 | 
             
                def hmac_request method, path, body={}
         | 
| 46 48 | 
             
                  payload = {}
         | 
| 47 49 | 
             
                  headers = { :content_type => 'application/json' }
         | 
| @@ -77,5 +79,32 @@ module Cointrader | |
| 77 79 | 
             
                    headers: headers,
         | 
| 78 80 | 
             
                  )
         | 
| 79 81 | 
             
                end
         | 
| 82 | 
            +
             | 
| 83 | 
            +
                # Returns the error code from `response` or `nil` if there is none.
         | 
| 84 | 
            +
                def extract_error_code response
         | 
| 85 | 
            +
                  return unless response
         | 
| 86 | 
            +
                  return unless response['data'] && response['data'].class == Hash
         | 
| 87 | 
            +
                  return unless response['data']['errorCode']
         | 
| 88 | 
            +
             | 
| 89 | 
            +
                  response['data']['errorCode'].to_i
         | 
| 90 | 
            +
                end
         | 
| 91 | 
            +
             | 
| 92 | 
            +
                def check_errors response
         | 
| 93 | 
            +
                  code = extract_error_code(response)
         | 
| 94 | 
            +
             | 
| 95 | 
            +
                  if code
         | 
| 96 | 
            +
                    errorClass = 
         | 
| 97 | 
            +
                      case code
         | 
| 98 | 
            +
                      when 401      then Unauthorized
         | 
| 99 | 
            +
                      when 802, 803 then InsufficientFunds # Fiat, Crypto respectively.
         | 
| 100 | 
            +
                      when 801      then NoOpenOrders
         | 
| 101 | 
            +
                      else Error
         | 
| 102 | 
            +
                      end
         | 
| 103 | 
            +
             | 
| 104 | 
            +
                    raise errorClass.new(response['message'])
         | 
| 105 | 
            +
                  end
         | 
| 106 | 
            +
             | 
| 107 | 
            +
                  response
         | 
| 108 | 
            +
                end
         | 
| 80 109 | 
             
              end
         | 
| 81 110 | 
             
            end
         | 
    
        data/spec/client_spec.rb
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            require 'spec_helper'
         | 
| 2 2 |  | 
| 3 | 
            -
            describe Cointrader::Client do
         | 
| 3 | 
            +
            describe Cointrader::Client, vcr: true do
         | 
| 4 4 | 
             
              def limit_buy 
         | 
| 5 5 | 
             
                subject.limit_buy(total_quantity: 1, price: 10)
         | 
| 6 6 | 
             
              end
         | 
| @@ -17,57 +17,33 @@ describe Cointrader::Client do | |
| 17 17 | 
             
                subject.market_sell(total_amount: 1)
         | 
| 18 18 | 
             
              end
         | 
| 19 19 |  | 
| 20 | 
            -
              def safe_limit_buy
         | 
| 21 | 
            -
                VCR.use_cassette('limit_buy', &method(:limit_buy))
         | 
| 22 | 
            -
              end
         | 
| 23 | 
            -
             | 
| 24 | 
            -
              def safe_limit_sell
         | 
| 25 | 
            -
                VCR.use_cassette('limit_sell', &method(:limit_sell))
         | 
| 26 | 
            -
              end
         | 
| 27 | 
            -
             | 
| 28 | 
            -
              def safe_market_buy
         | 
| 29 | 
            -
                VCR.use_cassette('market_buy', &method(:market_buy))
         | 
| 30 | 
            -
              end
         | 
| 31 | 
            -
             | 
| 32 | 
            -
              def safe_market_sell
         | 
| 33 | 
            -
                VCR.use_cassette('market_sell', &method(:market_sell))
         | 
| 34 | 
            -
              end
         | 
| 35 | 
            -
             | 
| 36 20 | 
             
              describe 'stats' do
         | 
| 37 21 | 
             
                describe '#symbol' do
         | 
| 38 22 | 
             
                  it 'returns supported currencies' do
         | 
| 39 | 
            -
                     | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
                      expect(response['data'][0]['name']).to eq 'Bitcoin (BTC)'
         | 
| 43 | 
            -
                    end
         | 
| 23 | 
            +
                    response = subject.symbol
         | 
| 24 | 
            +
                    expect_success(response)
         | 
| 25 | 
            +
                    expect(response['data'][0]['name']).to eq 'Bitcoin (BTC)'
         | 
| 44 26 | 
             
                  end
         | 
| 45 27 | 
             
                end
         | 
| 46 28 |  | 
| 47 29 | 
             
                describe '#stats_24h' do
         | 
| 48 30 | 
             
                  it 'returns 24 hour sliding statistics' do
         | 
| 49 | 
            -
                     | 
| 50 | 
            -
             | 
| 51 | 
            -
                      expect_success(response)
         | 
| 52 | 
            -
                    end
         | 
| 31 | 
            +
                    response = subject.stats_24h
         | 
| 32 | 
            +
                    expect_success(response)
         | 
| 53 33 | 
             
                  end
         | 
| 54 34 | 
             
                end
         | 
| 55 35 |  | 
| 56 36 | 
             
                describe '#stats_7d' do
         | 
| 57 37 | 
             
                  it 'returns 7 day sliding statistics' do
         | 
| 58 | 
            -
                     | 
| 59 | 
            -
             | 
| 60 | 
            -
                      expect_success(response)
         | 
| 61 | 
            -
                    end
         | 
| 38 | 
            +
                    response = subject.stats_7d
         | 
| 39 | 
            +
                    expect_success(response)
         | 
| 62 40 | 
             
                  end
         | 
| 63 41 | 
             
                end
         | 
| 64 42 |  | 
| 65 43 | 
             
                describe '#orders' do
         | 
| 66 44 | 
             
                  it 'returns open orders' do
         | 
| 67 | 
            -
                     | 
| 68 | 
            -
             | 
| 69 | 
            -
                      expect_success(response)
         | 
| 70 | 
            -
                    end
         | 
| 45 | 
            +
                    response = subject.orders
         | 
| 46 | 
            +
                    expect_success(response)
         | 
| 71 47 | 
             
                  end
         | 
| 72 48 | 
             
                end
         | 
| 73 49 | 
             
              end
         | 
| @@ -75,21 +51,17 @@ describe Cointrader::Client do | |
| 75 51 | 
             
              describe 'account' do
         | 
| 76 52 | 
             
                describe '#balance' do
         | 
| 77 53 | 
             
                  it 'returns a balance' do
         | 
| 78 | 
            -
                     | 
| 79 | 
            -
                      response = subject.balance
         | 
| 54 | 
            +
                    response = subject.balance
         | 
| 80 55 |  | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 83 | 
            -
                    end
         | 
| 56 | 
            +
                    expect_success(response)
         | 
| 57 | 
            +
                    expect(response['data']['BTC']['available']).not_to be_nil
         | 
| 84 58 | 
             
                  end
         | 
| 85 59 | 
             
                end
         | 
| 86 60 |  | 
| 87 61 | 
             
                describe '#tradehistory' do
         | 
| 88 62 | 
             
                  it 'returns trade history' do
         | 
| 89 | 
            -
                     | 
| 90 | 
            -
             | 
| 91 | 
            -
                      expect_success(response)
         | 
| 92 | 
            -
                    end
         | 
| 63 | 
            +
                    response = subject.tradehistory
         | 
| 64 | 
            +
                    expect_success(response)
         | 
| 93 65 | 
             
                  end
         | 
| 94 66 | 
             
                end
         | 
| 95 67 | 
             
              end
         | 
| @@ -97,74 +69,72 @@ describe Cointrader::Client do | |
| 97 69 | 
             
              describe 'order' do
         | 
| 98 70 | 
             
                describe '#limit_buy' do
         | 
| 99 71 | 
             
                  it 'returns an order' do
         | 
| 100 | 
            -
                     | 
| 101 | 
            -
             | 
| 102 | 
            -
             | 
| 103 | 
            -
             | 
| 104 | 
            -
             | 
| 72 | 
            +
                    response = limit_buy
         | 
| 73 | 
            +
                    expect_success(response)
         | 
| 74 | 
            +
                    expect(response['data']['id']).not_to be_nil
         | 
| 75 | 
            +
                  end
         | 
| 76 | 
            +
             | 
| 77 | 
            +
                  it 'throws an error when there are insufficient funds' do
         | 
| 78 | 
            +
                    expect { subject.limit_buy(price: 1_000_000, total_quantity: 1) }.to raise_error(Cointrader::InsufficientFunds)
         | 
| 105 79 | 
             
                  end
         | 
| 106 80 | 
             
                end
         | 
| 107 81 |  | 
| 108 82 | 
             
                describe '#limit_sell' do
         | 
| 109 83 | 
             
                  it 'returns an order' do
         | 
| 110 | 
            -
                     | 
| 111 | 
            -
             | 
| 112 | 
            -
             | 
| 113 | 
            -
                      expect(response['data']['id']).not_to be_nil
         | 
| 114 | 
            -
                    end
         | 
| 84 | 
            +
                    response = limit_sell
         | 
| 85 | 
            +
                    expect_success(response)
         | 
| 86 | 
            +
                    expect(response['data']['id']).not_to be_nil
         | 
| 115 87 | 
             
                  end
         | 
| 116 88 | 
             
                end
         | 
| 117 89 |  | 
| 118 90 | 
             
                describe '#cancel' do
         | 
| 119 | 
            -
                  let(:order) {  | 
| 91 | 
            +
                  let(:order) { limit_buy }
         | 
| 120 92 |  | 
| 121 | 
            -
                  it 'cancels  | 
| 122 | 
            -
                     | 
| 123 | 
            -
             | 
| 124 | 
            -
                      expect_success(response)
         | 
| 125 | 
            -
                      # expect(response['data']['id']).not_to be_nil
         | 
| 126 | 
            -
                      # expect(response['data']['currency_pair']).not_to be_nil
         | 
| 127 | 
            -
                    end
         | 
| 93 | 
            +
                  it 'cancels an order' do
         | 
| 94 | 
            +
                    response = subject.cancel(order_id: order['data']['id'])
         | 
| 95 | 
            +
                    expect_success(response)
         | 
| 128 96 | 
             
                  end
         | 
| 129 97 | 
             
                end
         | 
| 130 98 |  | 
| 131 99 | 
             
                describe '#list' do
         | 
| 132 | 
            -
                   | 
| 133 | 
            -
                     | 
| 100 | 
            +
                  context 'when there are orders' do
         | 
| 101 | 
            +
                    let(:order) { limit_buy }
         | 
| 102 | 
            +
                    after { subject.cancel(order_id: order['data']['id'] )}
         | 
| 103 | 
            +
             | 
| 104 | 
            +
                    it 'lists open limit orders' do
         | 
| 105 | 
            +
                      order
         | 
| 134 106 | 
             
                      response = subject.list
         | 
| 135 107 | 
             
                      expect_success(response)
         | 
| 136 | 
            -
             | 
| 108 | 
            +
                    end
         | 
| 109 | 
            +
                  end
         | 
| 110 | 
            +
             | 
| 111 | 
            +
                  context 'when there are no orders' do
         | 
| 112 | 
            +
                    it 'throws an error' do
         | 
| 113 | 
            +
                      expect { subject.list }.to raise_error(Cointrader::NoOpenOrders)
         | 
| 137 114 | 
             
                    end
         | 
| 138 115 | 
             
                  end
         | 
| 139 116 | 
             
                end
         | 
| 140 117 |  | 
| 141 118 | 
             
                describe '#market_buy' do
         | 
| 142 119 | 
             
                  it 'returns an order' do
         | 
| 143 | 
            -
                     | 
| 144 | 
            -
             | 
| 145 | 
            -
             | 
| 146 | 
            -
                      expect(response['message']).not_to eq('Unauthorized')
         | 
| 147 | 
            -
                    end
         | 
| 120 | 
            +
                    response = market_buy
         | 
| 121 | 
            +
                    expect_success(response)
         | 
| 122 | 
            +
                    expect(response['message']).not_to eq('Unauthorized')
         | 
| 148 123 | 
             
                  end
         | 
| 149 124 | 
             
                end
         | 
| 150 125 |  | 
| 151 126 | 
             
                describe '#market_sell' do
         | 
| 152 127 | 
             
                  it 'returns an order' do
         | 
| 153 | 
            -
                     | 
| 154 | 
            -
             | 
| 155 | 
            -
             | 
| 156 | 
            -
                      expect(response['message']).not_to eq('Unauthorized')
         | 
| 157 | 
            -
                    end
         | 
| 128 | 
            +
                    response = market_sell
         | 
| 129 | 
            +
                    expect_success(response)
         | 
| 130 | 
            +
                    expect(response['message']).not_to eq('Unauthorized')
         | 
| 158 131 | 
             
                  end
         | 
| 159 132 | 
             
                end
         | 
| 160 133 |  | 
| 161 134 | 
             
                describe '#trades' do
         | 
| 162 135 | 
             
                  it 'lists recent trades executed' do
         | 
| 163 | 
            -
                     | 
| 164 | 
            -
             | 
| 165 | 
            -
                      expect_success(response)
         | 
| 166 | 
            -
                      # expect(response['data'][0]['price'])
         | 
| 167 | 
            -
                    end
         | 
| 136 | 
            +
                    response = subject.trades
         | 
| 137 | 
            +
                    expect_success(response)
         | 
| 168 138 | 
             
                  end
         | 
| 169 139 | 
             
                end
         | 
| 170 140 | 
             
              end
         | 
| @@ -5,8 +5,8 @@ http_interactions: | |
| 5 5 | 
             
                uri: https://sandbox.cointrader.net/api4/account/balance
         | 
| 6 6 | 
             
                body:
         | 
| 7 7 | 
             
                  encoding: UTF-8
         | 
| 8 | 
            -
                  string: '{"secret":"2MlxW8mUU9MG4bvq7C6M4PSd5J8SaauW4H2dXnyJyAcN","t":"2015-06 | 
| 9 | 
            -
                     | 
| 8 | 
            +
                  string: '{"secret":"2MlxW8mUU9MG4bvq7C6M4PSd5J8SaauW4H2dXnyJyAcN","t":"2015-07-06
         | 
| 9 | 
            +
                    00:33:09 UTC"}'
         | 
| 10 10 | 
             
                headers:
         | 
| 11 11 | 
             
                  Accept:
         | 
| 12 12 | 
             
                  - "*/*; q=0.5, application/xml"
         | 
| @@ -17,7 +17,7 @@ http_interactions: | |
| 17 17 | 
             
                  X-Auth:
         | 
| 18 18 | 
             
                  - nCsNvmrxTpYFnJQyU16gq6R9ncOUA6UhF4wZnuf7IqkL
         | 
| 19 19 | 
             
                  X-Auth-Hash:
         | 
| 20 | 
            -
                  -  | 
| 20 | 
            +
                  - e6bb80adc0eaaa0c1b6de259208d310034606062bc0c6e9d27a892364d08c6e8
         | 
| 21 21 | 
             
                  Content-Length:
         | 
| 22 22 | 
             
                  - '87'
         | 
| 23 23 | 
             
                  User-Agent:
         | 
| @@ -28,7 +28,7 @@ http_interactions: | |
| 28 28 | 
             
                  message: OK
         | 
| 29 29 | 
             
                headers:
         | 
| 30 30 | 
             
                  Date:
         | 
| 31 | 
            -
                  -  | 
| 31 | 
            +
                  - Mon, 06 Jul 2015 00:33:10 GMT
         | 
| 32 32 | 
             
                  Server:
         | 
| 33 33 | 
             
                  - Apache
         | 
| 34 34 | 
             
                  X-Frame-Options:
         | 
| @@ -40,7 +40,7 @@ http_interactions: | |
| 40 40 | 
             
                  X-Powered-By:
         | 
| 41 41 | 
             
                  - ''
         | 
| 42 42 | 
             
                  Set-Cookie:
         | 
| 43 | 
            -
                  - CTXIDSCK= | 
| 43 | 
            +
                  - CTXIDSCK=4f9kvstmt2ff4r5i4i42ssv4q0; path=/; HttpOnly
         | 
| 44 44 | 
             
                  Expires:
         | 
| 45 45 | 
             
                  - Thu, 19 Nov 1981 08:52:00 GMT
         | 
| 46 46 | 
             
                  Cache-Control:
         | 
| @@ -62,5 +62,5 @@ http_interactions: | |
| 62 62 | 
             
                    EnMS84BKlHSUUhJLEpWsqpWcQpxBVGJZYmZOYlIOSLWBngEUANXl58Vn5Oek
         | 
| 63 63 | 
             
                    oAuX5Jck5qAK1uoohQa7YDMMwxg0A0BanR3J1FpbywUAkRGfN/oAAAA=
         | 
| 64 64 | 
             
                http_version: 
         | 
| 65 | 
            -
              recorded_at:  | 
| 65 | 
            +
              recorded_at: Mon, 06 Jul 2015 00:33:11 GMT
         | 
| 66 66 | 
             
            recorded_with: VCR 2.9.3
         | 
| @@ -5,8 +5,8 @@ http_interactions: | |
| 5 5 | 
             
                uri: https://sandbox.cointrader.net/api4/account/tradehistory/BTCUSD
         | 
| 6 6 | 
             
                body:
         | 
| 7 7 | 
             
                  encoding: UTF-8
         | 
| 8 | 
            -
                  string: '{"secret":"2MlxW8mUU9MG4bvq7C6M4PSd5J8SaauW4H2dXnyJyAcN","t":"2015-06 | 
| 9 | 
            -
                     | 
| 8 | 
            +
                  string: '{"secret":"2MlxW8mUU9MG4bvq7C6M4PSd5J8SaauW4H2dXnyJyAcN","t":"2015-07-06
         | 
| 9 | 
            +
                    00:33:11 UTC"}'
         | 
| 10 10 | 
             
                headers:
         | 
| 11 11 | 
             
                  Accept:
         | 
| 12 12 | 
             
                  - "*/*; q=0.5, application/xml"
         | 
| @@ -17,7 +17,7 @@ http_interactions: | |
| 17 17 | 
             
                  X-Auth:
         | 
| 18 18 | 
             
                  - nCsNvmrxTpYFnJQyU16gq6R9ncOUA6UhF4wZnuf7IqkL
         | 
| 19 19 | 
             
                  X-Auth-Hash:
         | 
| 20 | 
            -
                  -  | 
| 20 | 
            +
                  - 70b3415aa79e305dd4bbc7035576a776fc19e79f78a19bb11f3348b0d3286774
         | 
| 21 21 | 
             
                  Content-Length:
         | 
| 22 22 | 
             
                  - '87'
         | 
| 23 23 | 
             
                  User-Agent:
         | 
| @@ -28,7 +28,7 @@ http_interactions: | |
| 28 28 | 
             
                  message: OK
         | 
| 29 29 | 
             
                headers:
         | 
| 30 30 | 
             
                  Date:
         | 
| 31 | 
            -
                  -  | 
| 31 | 
            +
                  - Mon, 06 Jul 2015 00:33:13 GMT
         | 
| 32 32 | 
             
                  Server:
         | 
| 33 33 | 
             
                  - Apache
         | 
| 34 34 | 
             
                  X-Frame-Options:
         | 
| @@ -40,7 +40,7 @@ http_interactions: | |
| 40 40 | 
             
                  X-Powered-By:
         | 
| 41 41 | 
             
                  - ''
         | 
| 42 42 | 
             
                  Set-Cookie:
         | 
| 43 | 
            -
                  - CTXIDSCK= | 
| 43 | 
            +
                  - CTXIDSCK=vdddf8frh65pplqpfcakv5lfg4; path=/; HttpOnly
         | 
| 44 44 | 
             
                  Expires:
         | 
| 45 45 | 
             
                  - Thu, 19 Nov 1981 08:52:00 GMT
         | 
| 46 46 | 
             
                  Cache-Control:
         | 
| @@ -62,5 +62,5 @@ http_interactions: | |
| 62 62 | 
             
                    yiWmpypZKfnlKwQkFpcohBQlpqQWK7gBlaQo6SilJJYkKllFx9ZyAQBQ0dFf
         | 
| 63 63 | 
             
                    TAAAAA==
         | 
| 64 64 | 
             
                http_version: 
         | 
| 65 | 
            -
              recorded_at:  | 
| 65 | 
            +
              recorded_at: Mon, 06 Jul 2015 00:33:14 GMT
         | 
| 66 66 | 
             
            recorded_with: VCR 2.9.3
         | 
    
        data/spec/fixtures/vcr_cassettes/{cancel.yml → Cointrader_Client/order/_cancel/cancels_an_order.yml}
    RENAMED
    
    | @@ -2,11 +2,11 @@ | |
| 2 2 | 
             
            http_interactions:
         | 
| 3 3 | 
             
            - request:
         | 
| 4 4 | 
             
                method: post
         | 
| 5 | 
            -
                uri: https://sandbox.cointrader.net/api4/order/BTCUSD/ | 
| 5 | 
            +
                uri: https://sandbox.cointrader.net/api4/order/BTCUSD/buy
         | 
| 6 6 | 
             
                body:
         | 
| 7 7 | 
             
                  encoding: UTF-8
         | 
| 8 | 
            -
                  string: '{" | 
| 9 | 
            -
                     | 
| 8 | 
            +
                  string: '{"total_quantity":"1.00000000","price":"10.00","secret":"2MlxW8mUU9MG4bvq7C6M4PSd5J8SaauW4H2dXnyJyAcN","t":"2015-07-06
         | 
| 9 | 
            +
                    00:33:24 UTC"}'
         | 
| 10 10 | 
             
                headers:
         | 
| 11 11 | 
             
                  Accept:
         | 
| 12 12 | 
             
                  - "*/*; q=0.5, application/xml"
         | 
| @@ -17,9 +17,9 @@ http_interactions: | |
| 17 17 | 
             
                  X-Auth:
         | 
| 18 18 | 
             
                  - nCsNvmrxTpYFnJQyU16gq6R9ncOUA6UhF4wZnuf7IqkL
         | 
| 19 19 | 
             
                  X-Auth-Hash:
         | 
| 20 | 
            -
                  -  | 
| 20 | 
            +
                  - 6bdad317ad5711f68b05097d42aa897691ef2d9a72a4e5eab3658d00ddc703d5
         | 
| 21 21 | 
             
                  Content-Length:
         | 
| 22 | 
            -
                  - ' | 
| 22 | 
            +
                  - '133'
         | 
| 23 23 | 
             
                  User-Agent:
         | 
| 24 24 | 
             
                  - Ruby
         | 
| 25 25 | 
             
              response:
         | 
| @@ -28,7 +28,7 @@ http_interactions: | |
| 28 28 | 
             
                  message: OK
         | 
| 29 29 | 
             
                headers:
         | 
| 30 30 | 
             
                  Date:
         | 
| 31 | 
            -
                  -  | 
| 31 | 
            +
                  - Mon, 06 Jul 2015 00:33:26 GMT
         | 
| 32 32 | 
             
                  Server:
         | 
| 33 33 | 
             
                  - Apache
         | 
| 34 34 | 
             
                  X-Frame-Options:
         | 
| @@ -40,7 +40,7 @@ http_interactions: | |
| 40 40 | 
             
                  X-Powered-By:
         | 
| 41 41 | 
             
                  - ''
         | 
| 42 42 | 
             
                  Set-Cookie:
         | 
| 43 | 
            -
                  - CTXIDSCK= | 
| 43 | 
            +
                  - CTXIDSCK=a0mojedrbeebc6pr9poeodriu7; path=/; HttpOnly
         | 
| 44 44 | 
             
                  Expires:
         | 
| 45 45 | 
             
                  - Thu, 19 Nov 1981 08:52:00 GMT
         | 
| 46 46 | 
             
                  Cache-Control:
         | 
| @@ -52,15 +52,15 @@ http_interactions: | |
| 52 52 | 
             
                  Content-Encoding:
         | 
| 53 53 | 
             
                  - gzip
         | 
| 54 54 | 
             
                  Content-Length:
         | 
| 55 | 
            -
                  - ' | 
| 55 | 
            +
                  - '131'
         | 
| 56 56 | 
             
                  Content-Type:
         | 
| 57 57 | 
             
                  - application/json
         | 
| 58 58 | 
             
                body:
         | 
| 59 59 | 
             
                  encoding: ASCII-8BIT
         | 
| 60 60 | 
             
                  string: !binary |-
         | 
| 61 | 
            -
                     | 
| 62 | 
            -
                     | 
| 63 | 
            -
                     | 
| 61 | 
            +
                    H4sIAAAAAAAAA6tWKi5NTk4tLlaySkvMKU7VUcoFchLTU5WslJxKKxX8i1JS
         | 
| 62 | 
            +
                    ixRci4ryi6wUPPOKS9PSMpMzU/NKFNxK81KK9RSCUnMTM/My89KtFAz0DKBA
         | 
| 63 | 
            +
                    QUlHKSWxJFHJqlopFaTXOT8FZKKFgZESsg0kGFhbywUAxhnDjqwAAAA=
         | 
| 64 64 | 
             
                http_version: 
         | 
| 65 | 
            -
              recorded_at:  | 
| 65 | 
            +
              recorded_at: Mon, 06 Jul 2015 00:33:27 GMT
         | 
| 66 66 | 
             
            recorded_with: VCR 2.9.3
         | 
| @@ -0,0 +1,66 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            http_interactions:
         | 
| 3 | 
            +
            - request:
         | 
| 4 | 
            +
                method: post
         | 
| 5 | 
            +
                uri: https://sandbox.cointrader.net/api4/order/BTCUSD/buy
         | 
| 6 | 
            +
                body:
         | 
| 7 | 
            +
                  encoding: UTF-8
         | 
| 8 | 
            +
                  string: '{"total_quantity":"1.00000000","price":"10.00","secret":"2MlxW8mUU9MG4bvq7C6M4PSd5J8SaauW4H2dXnyJyAcN","t":"2015-07-06
         | 
| 9 | 
            +
                    00:33:14 UTC"}'
         | 
| 10 | 
            +
                headers:
         | 
| 11 | 
            +
                  Accept:
         | 
| 12 | 
            +
                  - "*/*; q=0.5, application/xml"
         | 
| 13 | 
            +
                  Accept-Encoding:
         | 
| 14 | 
            +
                  - gzip, deflate
         | 
| 15 | 
            +
                  Content-Type:
         | 
| 16 | 
            +
                  - application/json
         | 
| 17 | 
            +
                  X-Auth:
         | 
| 18 | 
            +
                  - nCsNvmrxTpYFnJQyU16gq6R9ncOUA6UhF4wZnuf7IqkL
         | 
| 19 | 
            +
                  X-Auth-Hash:
         | 
| 20 | 
            +
                  - 7684a274dc8e01dcc26b8098399b9f1280bc572ccd9bf0460f051749291f29b4
         | 
| 21 | 
            +
                  Content-Length:
         | 
| 22 | 
            +
                  - '133'
         | 
| 23 | 
            +
                  User-Agent:
         | 
| 24 | 
            +
                  - Ruby
         | 
| 25 | 
            +
              response:
         | 
| 26 | 
            +
                status:
         | 
| 27 | 
            +
                  code: 200
         | 
| 28 | 
            +
                  message: OK
         | 
| 29 | 
            +
                headers:
         | 
| 30 | 
            +
                  Date:
         | 
| 31 | 
            +
                  - Mon, 06 Jul 2015 00:33:16 GMT
         | 
| 32 | 
            +
                  Server:
         | 
| 33 | 
            +
                  - Apache
         | 
| 34 | 
            +
                  X-Frame-Options:
         | 
| 35 | 
            +
                  - SAMEORIGIN
         | 
| 36 | 
            +
                  X-Xss-Protection:
         | 
| 37 | 
            +
                  - 1; mode=block
         | 
| 38 | 
            +
                  X-Content-Type-Options:
         | 
| 39 | 
            +
                  - nosniff
         | 
| 40 | 
            +
                  X-Powered-By:
         | 
| 41 | 
            +
                  - ''
         | 
| 42 | 
            +
                  Set-Cookie:
         | 
| 43 | 
            +
                  - CTXIDSCK=pna8o9aoelska2eeltndlfr9e5; path=/; HttpOnly
         | 
| 44 | 
            +
                  Expires:
         | 
| 45 | 
            +
                  - Thu, 19 Nov 1981 08:52:00 GMT
         | 
| 46 | 
            +
                  Cache-Control:
         | 
| 47 | 
            +
                  - no-store, no-cache, must-revalidate, post-check=0, pre-check=0
         | 
| 48 | 
            +
                  Pragma:
         | 
| 49 | 
            +
                  - no-cache
         | 
| 50 | 
            +
                  Vary:
         | 
| 51 | 
            +
                  - Accept-Encoding
         | 
| 52 | 
            +
                  Content-Encoding:
         | 
| 53 | 
            +
                  - gzip
         | 
| 54 | 
            +
                  Content-Length:
         | 
| 55 | 
            +
                  - '131'
         | 
| 56 | 
            +
                  Content-Type:
         | 
| 57 | 
            +
                  - application/json
         | 
| 58 | 
            +
                body:
         | 
| 59 | 
            +
                  encoding: ASCII-8BIT
         | 
| 60 | 
            +
                  string: !binary |-
         | 
| 61 | 
            +
                    H4sIAAAAAAAAA6tWKi5NTk4tLlaySkvMKU7VUcoFchLTU5WslJxKKxX8i1JS
         | 
| 62 | 
            +
                    ixRci4ryi6wUPPOKS9PSMpMzU/NKFNxK81KK9RSCUnMTM/My89KtFAz0DKBA
         | 
| 63 | 
            +
                    QUlHKSWxJFHJqlopFaTXOT8FZKKFgZESsg0kGFhbywUAxhnDjqwAAAA=
         | 
| 64 | 
            +
                http_version: 
         | 
| 65 | 
            +
              recorded_at: Mon, 06 Jul 2015 00:33:17 GMT
         | 
| 66 | 
            +
            recorded_with: VCR 2.9.3
         |