oanda_api 0.9.4 → 0.9.5
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/CHANGELOG.md +67 -6
- data/README.md +31 -3
- data/lib/oanda_api.rb +3 -1
- data/lib/oanda_api/client/client.rb +17 -12
- data/lib/oanda_api/client/namespace_proxy.rb +2 -2
- data/lib/oanda_api/client/resource_descriptor.rb +25 -9
- data/lib/oanda_api/client/username_client.rb +7 -0
- data/lib/oanda_api/configuration.rb +14 -0
- data/lib/oanda_api/resource/account.rb +22 -3
- data/lib/oanda_api/resource/candle.rb +1 -1
- data/lib/oanda_api/resource/labs/calendar_event.rb +25 -0
- data/lib/oanda_api/resource/labs/spread_history.rb +61 -0
- data/lib/oanda_api/resource/order.rb +4 -4
- data/lib/oanda_api/resource/transaction_history.rb +0 -1
- data/lib/oanda_api/resource_base.rb +64 -2
- data/lib/oanda_api/resource_collection.rb +6 -0
- data/lib/oanda_api/streaming/client.rb +1 -0
- data/lib/oanda_api/version.rb +1 -1
- data/oanda_api.gemspec +2 -2
- data/spec/fixtures/vcr_cassettes/accounts_get.yml +13 -79
- data/spec/fixtures/vcr_cassettes/accounts_id_get.yml +23 -125
- data/spec/fixtures/vcr_cassettes/calendar_events_period_get.yml +54 -0
- data/spec/fixtures/vcr_cassettes/calendar_instrument_and_period_get.yml +61 -0
- data/spec/fixtures/vcr_cassettes/calendar_period_get.yml +54 -0
- data/spec/fixtures/vcr_cassettes/candles_options_get.yml +9 -45
- data/spec/fixtures/vcr_cassettes/client_helper_account.yml +45 -0
- data/spec/fixtures/vcr_cassettes/client_helper_accounts.yml +45 -0
- data/spec/fixtures/vcr_cassettes/instrument_EUR_USD.yml +42 -0
- data/spec/fixtures/vcr_cassettes/instrument_USD_JPY.yml +42 -0
- data/spec/fixtures/vcr_cassettes/instruments_get.yml +37 -303
- data/spec/fixtures/vcr_cassettes/instruments_options_get.yml +6 -43
- data/spec/fixtures/vcr_cassettes/order_id_close.yml +448 -0
- data/spec/fixtures/vcr_cassettes/order_id_get.yml +84 -0
- data/spec/fixtures/vcr_cassettes/order_options_create.yml +42 -0
- data/spec/fixtures/vcr_cassettes/order_options_update.yml +82 -0
- data/spec/fixtures/vcr_cassettes/orders_get.yml +205 -0
- data/spec/fixtures/vcr_cassettes/orders_options_get.yml +120 -0
- data/spec/fixtures/vcr_cassettes/positions_get.yml +82 -0
- data/spec/fixtures/vcr_cassettes/positions_instrument_close.yml +154 -0
- data/spec/fixtures/vcr_cassettes/{account_id_order_options_create.yml → positions_instrument_get.yml} +24 -18
- data/spec/fixtures/vcr_cassettes/prices_options_get.yml +11 -48
- data/spec/fixtures/vcr_cassettes/spread_history_get.yml +53 -0
- data/spec/fixtures/vcr_cassettes/spreads_get.yml +53 -0
- data/spec/fixtures/vcr_cassettes/trade_id_close.yml +277 -0
- data/spec/fixtures/vcr_cassettes/trade_id_get.yml +82 -0
- data/spec/fixtures/vcr_cassettes/trade_options_modify.yml +80 -0
- data/spec/fixtures/vcr_cassettes/trades_filter_get.yml +90 -0
- data/spec/fixtures/vcr_cassettes/trades_get.yml +171 -0
- data/spec/fixtures/vcr_cassettes/transaction_id_get.yml +248 -0
- data/spec/fixtures/vcr_cassettes/transactions_options_get.yml +202 -0
- data/spec/fixtures/vcr_cassettes/with_throttling_and_max_requests_per_second.yml +25 -19
- data/spec/fixtures/vcr_cassettes/with_throttling_with_multiple_threads.yml +51 -39
- data/spec/fixtures/vcr_cassettes/without_throttling.yml +81 -61
- data/spec/oanda_api/client/client_spec.rb +23 -10
- data/spec/oanda_api/client/namespace_proxy_spec.rb +1 -1
- data/spec/oanda_api/client/resource_descriptor_spec.rb +45 -14
- data/spec/oanda_api/configuration_spec.rb +13 -0
- data/spec/oanda_api/examples/accounts_spec.rb +0 -7
- data/spec/oanda_api/examples/calendar_spec.rb +27 -0
- data/spec/oanda_api/examples/orders_spec.rb +12 -12
- data/spec/oanda_api/examples/positions_spec.rb +3 -3
- data/spec/oanda_api/examples/rates_spec.rb +4 -2
- data/spec/oanda_api/examples/spread_history_spec.rb +32 -0
- data/spec/oanda_api/examples/trades_spec.rb +5 -5
- data/spec/oanda_api/examples/transactions_spec.rb +2 -2
- data/spec/oanda_api/resource_base_spec.rb +48 -8
- data/spec/oanda_api/streaming/client_spec.rb +30 -2
- data/spec/spec_helper.rb +1 -1
- data/spec/support/client_helper.rb +45 -11
- data/spec/support/vcr.rb +1 -0
- metadata +63 -49
- data/spec/fixtures/vcr_cassettes/account_id_order_id_close.yml +0 -264
- data/spec/fixtures/vcr_cassettes/account_id_order_id_get.yml +0 -114
- data/spec/fixtures/vcr_cassettes/account_id_order_options_update.yml +0 -112
- data/spec/fixtures/vcr_cassettes/account_id_orders_get.yml +0 -118
- data/spec/fixtures/vcr_cassettes/account_id_orders_options_get.yml +0 -123
- data/spec/fixtures/vcr_cassettes/account_id_positions_get.yml +0 -112
- data/spec/fixtures/vcr_cassettes/account_id_positions_instrument_close.yml +0 -214
- data/spec/fixtures/vcr_cassettes/account_id_positions_instrument_get.yml +0 -110
- data/spec/fixtures/vcr_cassettes/account_id_trade_id_close.yml +0 -252
- data/spec/fixtures/vcr_cassettes/account_id_trade_id_get.yml +0 -112
- data/spec/fixtures/vcr_cassettes/account_id_trade_options_modify.yml +0 -110
- data/spec/fixtures/vcr_cassettes/account_id_trades_filter_get.yml +0 -118
- data/spec/fixtures/vcr_cassettes/account_id_trades_get.yml +0 -118
- data/spec/fixtures/vcr_cassettes/account_id_transaction_id_get.yml +0 -283
- data/spec/fixtures/vcr_cassettes/account_id_transactions_options_get.yml +0 -205
- data/spec/fixtures/vcr_cassettes/accounts_create.yml +0 -75
- data/spec/fixtures/vcr_cassettes/sandbox_client.yml +0 -116
- data/spec/fixtures/vcr_cassettes/sandbox_client_account.yml +0 -111
- data/spec/fixtures/vcr_cassettes/sandbox_instrument_EUR_USD.yml +0 -77
- data/spec/oanda_api/client/username_client_spec.rb +0 -31
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module OandaAPI
|
|
2
|
+
module Resource
|
|
3
|
+
module Labs
|
|
4
|
+
|
|
5
|
+
# Calendar value object.
|
|
6
|
+
# See the Oanda Developer Guide for information about {http://developer.oanda.com/rest-live/forex-labs/#calendar Calendar}.
|
|
7
|
+
class CalendarEvent < ResourceBase
|
|
8
|
+
attr_accessor :actual,
|
|
9
|
+
:currency,
|
|
10
|
+
:forecast,
|
|
11
|
+
:impact,
|
|
12
|
+
:market,
|
|
13
|
+
:previous,
|
|
14
|
+
:region,
|
|
15
|
+
:timestamp,
|
|
16
|
+
:title,
|
|
17
|
+
:unit
|
|
18
|
+
|
|
19
|
+
def time
|
|
20
|
+
Time.at(timestamp).utc if timestamp
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
module OandaAPI
|
|
2
|
+
module Resource
|
|
3
|
+
module Labs
|
|
4
|
+
|
|
5
|
+
# Spread value object.
|
|
6
|
+
# See the Oanda Developer Guide for information about {http://developer.oanda.com/rest-live/forex-labs/#spreads Spreads}.
|
|
7
|
+
class SpreadHistory < ResourceBase
|
|
8
|
+
attr_accessor :avg,
|
|
9
|
+
:max,
|
|
10
|
+
:min
|
|
11
|
+
|
|
12
|
+
alias_method :averages, :avg
|
|
13
|
+
alias_method :maximums, :max
|
|
14
|
+
alias_method :minimums, :min
|
|
15
|
+
|
|
16
|
+
def initialize(attributes = {})
|
|
17
|
+
attribs = attributes.dup
|
|
18
|
+
self.averages = attribs.delete(:avg) || []
|
|
19
|
+
self.maximums = attribs.delete(:max) || []
|
|
20
|
+
self.minimums = attribs.delete(:min) || []
|
|
21
|
+
super attribs
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def averages=(array=[])
|
|
25
|
+
@avg = []
|
|
26
|
+
array.each { |elements| @avg << Tuple.new(*elements) }
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def maximums=(array=[])
|
|
30
|
+
@max = []
|
|
31
|
+
array.each { |elements| @max << Tuple.new(*elements) }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def minimums=(array=[])
|
|
35
|
+
@min = []
|
|
36
|
+
array.each { |elements| @min << Tuple.new(*elements) }
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# @private
|
|
40
|
+
class Tuple
|
|
41
|
+
attr_accessor :spread,
|
|
42
|
+
:time,
|
|
43
|
+
:timestamp
|
|
44
|
+
|
|
45
|
+
def initialize(timestamp, spread)
|
|
46
|
+
@timestamp = timestamp
|
|
47
|
+
@spread = spread
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def time
|
|
51
|
+
Time.at(timestamp).utc if timestamp
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def to_s
|
|
55
|
+
spread
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -23,10 +23,10 @@ module OandaAPI
|
|
|
23
23
|
|
|
24
24
|
def initialize(attributes = {})
|
|
25
25
|
attribs = attributes.dup
|
|
26
|
-
self.order_opened = attribs.delete(order_opened) || {}
|
|
27
|
-
self.trade_opened = attribs.delete(trade_opened) || {}
|
|
28
|
-
self.trade_reduced = attribs.delete(trade_reduced) || {}
|
|
29
|
-
self.trades_closed = attribs.delete(trades_closed) || []
|
|
26
|
+
self.order_opened = attribs.delete(:order_opened) || {}
|
|
27
|
+
self.trade_opened = attribs.delete(:trade_opened) || {}
|
|
28
|
+
self.trade_reduced = attribs.delete(:trade_reduced) || {}
|
|
29
|
+
self.trades_closed = attribs.delete(:trades_closed) || []
|
|
30
30
|
super attribs
|
|
31
31
|
end
|
|
32
32
|
|
|
@@ -3,7 +3,6 @@ module OandaAPI
|
|
|
3
3
|
# Transactions History value object. Resource name in API: alltransactions.
|
|
4
4
|
# See the Oanda Developer Guide for information about {http://developer.oanda.com/rest-live/transaction-history/ Transactions history}.
|
|
5
5
|
class TransactionHistory < ResourceBase
|
|
6
|
-
|
|
7
6
|
end
|
|
8
7
|
end
|
|
9
8
|
end
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
module OandaAPI
|
|
2
2
|
require 'json'
|
|
3
|
+
|
|
3
4
|
# Base class for all Resources.
|
|
4
5
|
#
|
|
5
6
|
# @!attribute [rw] location
|
|
@@ -20,14 +21,63 @@ module OandaAPI
|
|
|
20
21
|
@location = attributes.location if attributes.respond_to? :location
|
|
21
22
|
end
|
|
22
23
|
|
|
23
|
-
# Serializes an instance as JSON
|
|
24
|
+
# Serializes an instance as JSON.
|
|
24
25
|
# @return [String] a stringified JSON representation of an instance
|
|
25
26
|
def to_json(*args)
|
|
26
27
|
JSON.generate @_attributes.merge(custom_attributes), *args
|
|
27
28
|
end
|
|
28
29
|
|
|
30
|
+
# Returns the class of a Resource if klass_symbol is the name
|
|
31
|
+
# of a resource, otherwise nil.
|
|
32
|
+
#
|
|
33
|
+
# @example Example:
|
|
34
|
+
# ResourceBase.class_from_symbol(:transaction_history) => OandaAPI::Resource::TransactionHistory
|
|
35
|
+
# ResourceBase.class_from_symbol(:calendar_event) => OandaAPI::Resource::Labs::CalendarEvent
|
|
36
|
+
#
|
|
37
|
+
# @param [Symbol] resource_symbol symbolized resource name
|
|
38
|
+
#
|
|
39
|
+
# @return [Nil] if resource_symbol is not a Resource.
|
|
40
|
+
#
|
|
41
|
+
# @return [Class] if resource_symbol is identifies a Resource.
|
|
42
|
+
def self.class_from_symbol(resource_symbol)
|
|
43
|
+
descendant resource_symbol
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Tests whether a class is a Labs Resource.
|
|
47
|
+
#
|
|
48
|
+
# @param [Class] klass the class to be tested.
|
|
49
|
+
#
|
|
50
|
+
# @return [Boolean] True if the class is a Labs Resource.
|
|
51
|
+
def self.labs_resource?(klass)
|
|
52
|
+
(@lab_resources ||=[]).include? klass
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# List of API resources that don't follow normal REST naming standards,
|
|
56
|
+
# and are not pluralized despite being collections.
|
|
57
|
+
NOT_PLURALIZED = [:calendar]
|
|
58
|
+
|
|
59
|
+
# Returns a pluralized version of the resource class name
|
|
60
|
+
# @param [Symbol] klass_symbol
|
|
61
|
+
# @return [String] the pluralized resource class name
|
|
62
|
+
def self.pluralize(klass_symbol)
|
|
63
|
+
NOT_PLURALIZED.include?(klass_symbol.to_sym) ? klass_symbol.to_s : OandaAPI::Utils.pluralize(klass_symbol)
|
|
64
|
+
end
|
|
65
|
+
|
|
29
66
|
private
|
|
30
67
|
|
|
68
|
+
# @private
|
|
69
|
+
# Called whenever ResourceBase class is inherited by a descendant class.
|
|
70
|
+
# Used to track descendant classes.
|
|
71
|
+
# Used to identify classes within the "::Labs::" namespace.
|
|
72
|
+
def self.inherited(klass)
|
|
73
|
+
ResourceBase.inherited(klass) unless self == OandaAPI::ResourceBase
|
|
74
|
+
klass.to_s.match(/^(?<labs>(.*::)?Labs::)?(.*?)?(?<resource_name>(\w)+)$/) do |matched|
|
|
75
|
+
resource_symbol = OandaAPI::Utils.underscore(matched[:resource_name]).to_sym
|
|
76
|
+
(@descendants ||= {})[resource_symbol] = klass
|
|
77
|
+
(@lab_resources ||= []) << klass if matched[:labs]
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
31
81
|
# @private
|
|
32
82
|
# Initializes attributes.
|
|
33
83
|
#
|
|
@@ -40,10 +90,22 @@ module OandaAPI
|
|
|
40
90
|
end
|
|
41
91
|
end
|
|
42
92
|
|
|
93
|
+
# @private
|
|
43
94
|
# Provides additional attributes used in serialization.
|
|
44
|
-
# @return [Hash]
|
|
95
|
+
# @return [Hash] a hash of customized attributes for serialization
|
|
45
96
|
def custom_attributes
|
|
46
97
|
{}.tap { |hash| hash[:location] = location if location }
|
|
47
98
|
end
|
|
99
|
+
|
|
100
|
+
# @private
|
|
101
|
+
# Returns a class name if klass_symbol is the name of a class that
|
|
102
|
+
# descends from {OandaAPI::ResourceBase}, otherwise nil.
|
|
103
|
+
# @param [Symbol] klass_symbol class name of a resource class
|
|
104
|
+
# @return [Class]
|
|
105
|
+
# @return [Nil] if klass_symbol is not a class that descends from
|
|
106
|
+
# {OandaAPI::ResourceBase}.
|
|
107
|
+
def self.descendant(klass_symbol)
|
|
108
|
+
(@descendants || {})[klass_symbol]
|
|
109
|
+
end
|
|
48
110
|
end
|
|
49
111
|
end
|
|
@@ -28,6 +28,12 @@ module OandaAPI
|
|
|
28
28
|
# about the resource collection and its elements.
|
|
29
29
|
def initialize(attributes, resource_descriptor)
|
|
30
30
|
attributes = {} if attributes.nil? || attributes.respond_to?(:empty) && attributes.empty?
|
|
31
|
+
if attributes.kind_of?(Array)
|
|
32
|
+
h = {}
|
|
33
|
+
h["#{resource_descriptor.collection_name}".to_sym] = attributes
|
|
34
|
+
attributes = h
|
|
35
|
+
end
|
|
36
|
+
|
|
31
37
|
fail ArgumentError, "Expecting a Hash" unless attributes.respond_to? :each_pair
|
|
32
38
|
@attributes = Utils.rubyize_keys attributes
|
|
33
39
|
@collection = @attributes.delete(resource_descriptor.collection_name) || []
|
|
@@ -132,6 +132,7 @@ module OandaAPI
|
|
|
132
132
|
uri: api_uri(path),
|
|
133
133
|
query: Utils.stringify_keys(conditions),
|
|
134
134
|
headers: OandaAPI.configuration.headers.merge(headers)
|
|
135
|
+
@streaming_request.emit_heartbeats = emit_heartbeats?
|
|
135
136
|
@streaming_request.stream(&block)
|
|
136
137
|
return nil
|
|
137
138
|
end
|
data/lib/oanda_api/version.rb
CHANGED
data/oanda_api.gemspec
CHANGED
|
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
|
|
|
26
26
|
s.add_dependency "http-exceptions", "~> 0.0"
|
|
27
27
|
|
|
28
28
|
s.add_development_dependency "rspec", "~> 3.2"
|
|
29
|
-
s.add_development_dependency "vcr", "~>
|
|
30
|
-
s.add_development_dependency "webmock", "~> 1.
|
|
29
|
+
s.add_development_dependency "vcr", "~> 3.0"
|
|
30
|
+
s.add_development_dependency "webmock", "~> 1.24"
|
|
31
31
|
s.add_development_dependency "yard", "~> 0.8"
|
|
32
32
|
end
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: get
|
|
5
|
-
uri:
|
|
5
|
+
uri: https://api-fxpractice.oanda.com/v1/accounts
|
|
6
6
|
body:
|
|
7
7
|
encoding: US-ASCII
|
|
8
8
|
string: ''
|
|
9
9
|
headers:
|
|
10
10
|
X-Accept-Datetime-Format:
|
|
11
11
|
- RFC3339
|
|
12
|
+
Authorization:
|
|
13
|
+
- Bearer <OANDA_TESTING_API_TOKEN>
|
|
12
14
|
Connection:
|
|
13
15
|
- keep-alive
|
|
14
16
|
Keep-Alive:
|
|
@@ -21,91 +23,23 @@ http_interactions:
|
|
|
21
23
|
Server:
|
|
22
24
|
- openresty/1.7.0.1
|
|
23
25
|
Date:
|
|
24
|
-
-
|
|
26
|
+
- Mon, 14 Mar 2016 16:28:06 GMT
|
|
25
27
|
Content-Type:
|
|
26
28
|
- application/json
|
|
27
29
|
Content-Length:
|
|
28
|
-
- '
|
|
30
|
+
- '366'
|
|
29
31
|
Connection:
|
|
30
32
|
- keep-alive
|
|
31
33
|
Etag:
|
|
32
|
-
- '"
|
|
34
|
+
- '"efb224b14d5e6c03ab1a19a9983274e09d124b20"'
|
|
33
35
|
body:
|
|
34
36
|
encoding: UTF-8
|
|
35
|
-
string: "{\n\t\"accounts\" : [\n\t\t{\n\t\t\t\"accountId\" :
|
|
37
|
+
string: "{\n\t\"accounts\" : [\n\t\t{\n\t\t\t\"accountId\" : 1871900,\n\t\t\t\"accountName\"
|
|
36
38
|
: \"Primary\",\n\t\t\t\"accountCurrency\" : \"USD\",\n\t\t\t\"marginRate\"
|
|
37
|
-
: 0.05\n\t\t}\n\t
|
|
39
|
+
: 0.05\n\t\t},\n\t\t{\n\t\t\t\"accountId\" : 1401515,\n\t\t\t\"accountName\"
|
|
40
|
+
: \"USD\",\n\t\t\t\"accountCurrency\" : \"USD\",\n\t\t\t\"marginRate\" : 0.1\n\t\t},\n\t\t{\n\t\t\t\"accountId\"
|
|
41
|
+
: 5094848,\n\t\t\t\"accountName\" : \"WTI\",\n\t\t\t\"accountCurrency\" :
|
|
42
|
+
\"CAD\",\n\t\t\t\"marginRate\" : 0.05\n\t\t}\n\t]\n}"
|
|
38
43
|
http_version:
|
|
39
|
-
recorded_at:
|
|
40
|
-
|
|
41
|
-
method: get
|
|
42
|
-
uri: http://api-sandbox.oanda.com/v1/accounts/?username=paudougles
|
|
43
|
-
body:
|
|
44
|
-
encoding: US-ASCII
|
|
45
|
-
string: ''
|
|
46
|
-
headers:
|
|
47
|
-
X-Accept-Datetime-Format:
|
|
48
|
-
- RFC3339
|
|
49
|
-
Connection:
|
|
50
|
-
- keep-alive
|
|
51
|
-
Keep-Alive:
|
|
52
|
-
- 30
|
|
53
|
-
response:
|
|
54
|
-
status:
|
|
55
|
-
code: 200
|
|
56
|
-
message: OK
|
|
57
|
-
headers:
|
|
58
|
-
Server:
|
|
59
|
-
- openresty/1.7.0.1
|
|
60
|
-
Date:
|
|
61
|
-
- Tue, 20 Jan 2015 23:27:03 GMT
|
|
62
|
-
Content-Type:
|
|
63
|
-
- application/json
|
|
64
|
-
Content-Length:
|
|
65
|
-
- '139'
|
|
66
|
-
Connection:
|
|
67
|
-
- keep-alive
|
|
68
|
-
Etag:
|
|
69
|
-
- '"61cce213956060b4ccb6fd9f47235b4c03e74095"'
|
|
70
|
-
body:
|
|
71
|
-
encoding: UTF-8
|
|
72
|
-
string: "{\n\t\"accounts\" : [\n\t\t{\n\t\t\t\"accountId\" : 1724176,\n\t\t\t\"accountName\"
|
|
73
|
-
: \"Primary\",\n\t\t\t\"accountCurrency\" : \"USD\",\n\t\t\t\"marginRate\"
|
|
74
|
-
: 0.05\n\t\t}\n\t]\n}"
|
|
75
|
-
http_version:
|
|
76
|
-
recorded_at: Tue, 20 Jan 2015 23:27:03 GMT
|
|
77
|
-
- request:
|
|
78
|
-
method: get
|
|
79
|
-
uri: http://api-sandbox.oanda.com/v1/accounts?username
|
|
80
|
-
body:
|
|
81
|
-
encoding: US-ASCII
|
|
82
|
-
string: ''
|
|
83
|
-
headers:
|
|
84
|
-
X-Accept-Datetime-Format:
|
|
85
|
-
- RFC3339
|
|
86
|
-
Connection:
|
|
87
|
-
- keep-alive
|
|
88
|
-
Keep-Alive:
|
|
89
|
-
- 30
|
|
90
|
-
response:
|
|
91
|
-
status:
|
|
92
|
-
code: 404
|
|
93
|
-
message: NOT_FOUND
|
|
94
|
-
headers:
|
|
95
|
-
Server:
|
|
96
|
-
- openresty/1.7.0.1
|
|
97
|
-
Date:
|
|
98
|
-
- Fri, 23 Jan 2015 17:37:52 GMT
|
|
99
|
-
Content-Type:
|
|
100
|
-
- application/json
|
|
101
|
-
Content-Length:
|
|
102
|
-
- '144'
|
|
103
|
-
Connection:
|
|
104
|
-
- keep-alive
|
|
105
|
-
body:
|
|
106
|
-
encoding: UTF-8
|
|
107
|
-
string: "{\n\t\"code\" : 55,\n\t\"message\" : \"Username specified is invalid\",\n\t\"moreInfo\"
|
|
108
|
-
: \"http:\\/\\/developer.oanda.com\\/docs\\/v1\\/troubleshooting\\/#errors\"\n}"
|
|
109
|
-
http_version:
|
|
110
|
-
recorded_at: Fri, 23 Jan 2015 17:37:52 GMT
|
|
111
|
-
recorded_with: VCR 2.9.3
|
|
44
|
+
recorded_at: Mon, 14 Mar 2016 16:28:06 GMT
|
|
45
|
+
recorded_with: VCR 3.0.1
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: get
|
|
5
|
-
uri:
|
|
5
|
+
uri: https://api-fxpractice.oanda.com/v1/accounts
|
|
6
6
|
body:
|
|
7
7
|
encoding: US-ASCII
|
|
8
8
|
string: ''
|
|
9
9
|
headers:
|
|
10
10
|
X-Accept-Datetime-Format:
|
|
11
11
|
- RFC3339
|
|
12
|
+
Authorization:
|
|
13
|
+
- Bearer <OANDA_TESTING_API_TOKEN>
|
|
12
14
|
Connection:
|
|
13
15
|
- keep-alive
|
|
14
16
|
Keep-Alive:
|
|
@@ -21,31 +23,36 @@ http_interactions:
|
|
|
21
23
|
Server:
|
|
22
24
|
- openresty/1.7.0.1
|
|
23
25
|
Date:
|
|
24
|
-
-
|
|
26
|
+
- Mon, 14 Mar 2016 16:28:07 GMT
|
|
25
27
|
Content-Type:
|
|
26
28
|
- application/json
|
|
27
29
|
Content-Length:
|
|
28
|
-
- '
|
|
30
|
+
- '366'
|
|
29
31
|
Connection:
|
|
30
32
|
- keep-alive
|
|
31
33
|
Etag:
|
|
32
|
-
- '"
|
|
34
|
+
- '"efb224b14d5e6c03ab1a19a9983274e09d124b20"'
|
|
33
35
|
body:
|
|
34
36
|
encoding: UTF-8
|
|
35
|
-
string: "{\n\t\"accounts\" : [\n\t\t{\n\t\t\t\"accountId\" :
|
|
37
|
+
string: "{\n\t\"accounts\" : [\n\t\t{\n\t\t\t\"accountId\" : 1871900,\n\t\t\t\"accountName\"
|
|
36
38
|
: \"Primary\",\n\t\t\t\"accountCurrency\" : \"USD\",\n\t\t\t\"marginRate\"
|
|
37
|
-
: 0.05\n\t\t}\n\t
|
|
39
|
+
: 0.05\n\t\t},\n\t\t{\n\t\t\t\"accountId\" : 1401515,\n\t\t\t\"accountName\"
|
|
40
|
+
: \"USD\",\n\t\t\t\"accountCurrency\" : \"USD\",\n\t\t\t\"marginRate\" : 0.1\n\t\t},\n\t\t{\n\t\t\t\"accountId\"
|
|
41
|
+
: 5094848,\n\t\t\t\"accountName\" : \"WTI\",\n\t\t\t\"accountCurrency\" :
|
|
42
|
+
\"CAD\",\n\t\t\t\"marginRate\" : 0.05\n\t\t}\n\t]\n}"
|
|
38
43
|
http_version:
|
|
39
|
-
recorded_at:
|
|
44
|
+
recorded_at: Mon, 14 Mar 2016 16:28:07 GMT
|
|
40
45
|
- request:
|
|
41
46
|
method: get
|
|
42
|
-
uri:
|
|
47
|
+
uri: https://api-fxpractice.oanda.com/v1/accounts/1871900
|
|
43
48
|
body:
|
|
44
49
|
encoding: US-ASCII
|
|
45
50
|
string: ''
|
|
46
51
|
headers:
|
|
47
52
|
X-Accept-Datetime-Format:
|
|
48
53
|
- RFC3339
|
|
54
|
+
Authorization:
|
|
55
|
+
- Bearer <OANDA_TESTING_API_TOKEN>
|
|
49
56
|
Connection:
|
|
50
57
|
- keep-alive
|
|
51
58
|
Keep-Alive:
|
|
@@ -58,130 +65,21 @@ http_interactions:
|
|
|
58
65
|
Server:
|
|
59
66
|
- openresty/1.7.0.1
|
|
60
67
|
Date:
|
|
61
|
-
-
|
|
68
|
+
- Mon, 14 Mar 2016 16:28:08 GMT
|
|
62
69
|
Content-Type:
|
|
63
70
|
- application/json
|
|
64
71
|
Content-Length:
|
|
65
|
-
- '
|
|
72
|
+
- '276'
|
|
66
73
|
Connection:
|
|
67
74
|
- keep-alive
|
|
68
75
|
Etag:
|
|
69
|
-
- '"
|
|
76
|
+
- '"158b907f059d85274d407e88979dc2a616a3e0c9"'
|
|
70
77
|
body:
|
|
71
78
|
encoding: UTF-8
|
|
72
|
-
string: "{\n\t\"accountId\" :
|
|
73
|
-
:
|
|
74
|
-
:
|
|
79
|
+
string: "{\n\t\"accountId\" : 1871900,\n\t\"accountName\" : \"Primary\",\n\t\"balance\"
|
|
80
|
+
: 100375.6663,\n\t\"unrealizedPl\" : -18.712,\n\t\"realizedPl\" : 332.7989,\n\t\"marginUsed\"
|
|
81
|
+
: 8111.17,\n\t\"marginAvail\" : 92245.7843,\n\t\"openTrades\" : 16,\n\t\"openOrders\"
|
|
75
82
|
: 0,\n\t\"marginRate\" : 0.05,\n\t\"accountCurrency\" : \"USD\"\n}"
|
|
76
83
|
http_version:
|
|
77
|
-
recorded_at:
|
|
78
|
-
|
|
79
|
-
method: get
|
|
80
|
-
uri: http://api-sandbox.oanda.com/v1/accounts/?username=paudougles
|
|
81
|
-
body:
|
|
82
|
-
encoding: US-ASCII
|
|
83
|
-
string: ''
|
|
84
|
-
headers:
|
|
85
|
-
X-Accept-Datetime-Format:
|
|
86
|
-
- RFC3339
|
|
87
|
-
Connection:
|
|
88
|
-
- keep-alive
|
|
89
|
-
Keep-Alive:
|
|
90
|
-
- 30
|
|
91
|
-
response:
|
|
92
|
-
status:
|
|
93
|
-
code: 200
|
|
94
|
-
message: OK
|
|
95
|
-
headers:
|
|
96
|
-
Server:
|
|
97
|
-
- openresty/1.7.0.1
|
|
98
|
-
Date:
|
|
99
|
-
- Tue, 20 Jan 2015 23:27:04 GMT
|
|
100
|
-
Content-Type:
|
|
101
|
-
- application/json
|
|
102
|
-
Content-Length:
|
|
103
|
-
- '139'
|
|
104
|
-
Connection:
|
|
105
|
-
- keep-alive
|
|
106
|
-
Etag:
|
|
107
|
-
- '"61cce213956060b4ccb6fd9f47235b4c03e74095"'
|
|
108
|
-
body:
|
|
109
|
-
encoding: UTF-8
|
|
110
|
-
string: "{\n\t\"accounts\" : [\n\t\t{\n\t\t\t\"accountId\" : 1724176,\n\t\t\t\"accountName\"
|
|
111
|
-
: \"Primary\",\n\t\t\t\"accountCurrency\" : \"USD\",\n\t\t\t\"marginRate\"
|
|
112
|
-
: 0.05\n\t\t}\n\t]\n}"
|
|
113
|
-
http_version:
|
|
114
|
-
recorded_at: Tue, 20 Jan 2015 23:27:03 GMT
|
|
115
|
-
- request:
|
|
116
|
-
method: get
|
|
117
|
-
uri: http://api-sandbox.oanda.com/v1/accounts/1724176?username=paudougles
|
|
118
|
-
body:
|
|
119
|
-
encoding: US-ASCII
|
|
120
|
-
string: ''
|
|
121
|
-
headers:
|
|
122
|
-
X-Accept-Datetime-Format:
|
|
123
|
-
- RFC3339
|
|
124
|
-
Connection:
|
|
125
|
-
- keep-alive
|
|
126
|
-
Keep-Alive:
|
|
127
|
-
- 30
|
|
128
|
-
response:
|
|
129
|
-
status:
|
|
130
|
-
code: 200
|
|
131
|
-
message: OK
|
|
132
|
-
headers:
|
|
133
|
-
Server:
|
|
134
|
-
- openresty/1.7.0.1
|
|
135
|
-
Date:
|
|
136
|
-
- Tue, 20 Jan 2015 23:27:04 GMT
|
|
137
|
-
Content-Type:
|
|
138
|
-
- application/json
|
|
139
|
-
Content-Length:
|
|
140
|
-
- '247'
|
|
141
|
-
Connection:
|
|
142
|
-
- keep-alive
|
|
143
|
-
Etag:
|
|
144
|
-
- '"83c3b001199921bd888ca07ddf04539617fe4a63"'
|
|
145
|
-
body:
|
|
146
|
-
encoding: UTF-8
|
|
147
|
-
string: "{\n\t\"accountId\" : 1724176,\n\t\"accountName\" : \"Primary\",\n\t\"balance\"
|
|
148
|
-
: 100000,\n\t\"unrealizedPl\" : 0,\n\t\"realizedPl\" : 0,\n\t\"marginUsed\"
|
|
149
|
-
: 0,\n\t\"marginAvail\" : 100000,\n\t\"openTrades\" : 0,\n\t\"openOrders\"
|
|
150
|
-
: 0,\n\t\"marginRate\" : 0.05,\n\t\"accountCurrency\" : \"USD\"\n}"
|
|
151
|
-
http_version:
|
|
152
|
-
recorded_at: Tue, 20 Jan 2015 23:27:04 GMT
|
|
153
|
-
- request:
|
|
154
|
-
method: get
|
|
155
|
-
uri: http://api-sandbox.oanda.com/v1/accounts?username
|
|
156
|
-
body:
|
|
157
|
-
encoding: US-ASCII
|
|
158
|
-
string: ''
|
|
159
|
-
headers:
|
|
160
|
-
X-Accept-Datetime-Format:
|
|
161
|
-
- RFC3339
|
|
162
|
-
Connection:
|
|
163
|
-
- keep-alive
|
|
164
|
-
Keep-Alive:
|
|
165
|
-
- 30
|
|
166
|
-
response:
|
|
167
|
-
status:
|
|
168
|
-
code: 404
|
|
169
|
-
message: NOT_FOUND
|
|
170
|
-
headers:
|
|
171
|
-
Server:
|
|
172
|
-
- openresty/1.7.0.1
|
|
173
|
-
Date:
|
|
174
|
-
- Fri, 23 Jan 2015 17:37:52 GMT
|
|
175
|
-
Content-Type:
|
|
176
|
-
- application/json
|
|
177
|
-
Content-Length:
|
|
178
|
-
- '144'
|
|
179
|
-
Connection:
|
|
180
|
-
- keep-alive
|
|
181
|
-
body:
|
|
182
|
-
encoding: UTF-8
|
|
183
|
-
string: "{\n\t\"code\" : 55,\n\t\"message\" : \"Username specified is invalid\",\n\t\"moreInfo\"
|
|
184
|
-
: \"http:\\/\\/developer.oanda.com\\/docs\\/v1\\/troubleshooting\\/#errors\"\n}"
|
|
185
|
-
http_version:
|
|
186
|
-
recorded_at: Fri, 23 Jan 2015 17:37:53 GMT
|
|
187
|
-
recorded_with: VCR 2.9.3
|
|
84
|
+
recorded_at: Mon, 14 Mar 2016 16:28:08 GMT
|
|
85
|
+
recorded_with: VCR 3.0.1
|