Sha256: ee2701632a10a1ee8a6d5a1d1d8692d6295b543b402c879a1e2509f9d5df6bd0

Contents?: true

Size: 907 Bytes

Versions: 5

Compression:

Stored size: 907 Bytes

Contents

require 'spec_helper'
require 'support/client_helper'

describe "OandaAPI::Transaction" do
  let(:account) { ClientHelper.account }

  it "gets transaction history" do
    VCR.use_cassette("account(id).transactions(options).get") do
      ClientHelper.create_trade(instrument: "USD_JPY")
      transactions = account.transactions(instrument: "USD_JPY").get
      expect(transactions.first).to be_an OandaAPI::Resource::Transaction
    end
  end

  it "gets information for a specific transaction" do
    VCR.use_cassette("account(id).transaction(id).get") do
      ClientHelper.create_trade(instrument: "USD_JPY")
      id = account.transactions(instrument: "USD_JPY").get.first.id
      transaction = account.transaction(id).get
      expect(transaction).to be_an OandaAPI::Resource::Transaction
      expect(transaction.trade_opened).to be_a OandaAPI::Resource::Transaction::TradeOpened
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
oanda_api-0.9.4 spec/oanda_api/examples/transactions_spec.rb
oanda_api-0.9.3 spec/oanda_api/examples/transactions_spec.rb
oanda_api-0.9.2 spec/oanda_api/examples/transactions_spec.rb
oanda_api-0.9.0 spec/oanda_api/examples/transactions_spec.rb
oanda_api-0.8.3 spec/oanda_api/examples/transactions_spec.rb