oanda_api 0.8.1 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +38 -0
- data/.rspec_non_jruby +2 -0
- data/.yardopts +6 -0
- data/Gemfile +13 -0
- data/Guardfile +7 -0
- data/LICENSE +22 -0
- data/README.md +218 -0
- data/Rakefile +23 -0
- data/lib/oanda_api.rb +25 -0
- data/lib/oanda_api/client/client.rb +175 -0
- data/lib/oanda_api/client/namespace_proxy.rb +112 -0
- data/lib/oanda_api/client/resource_descriptor.rb +52 -0
- data/lib/oanda_api/client/token_client.rb +69 -0
- data/lib/oanda_api/client/username_client.rb +53 -0
- data/lib/oanda_api/configuration.rb +167 -0
- data/lib/oanda_api/errors.rb +4 -0
- data/lib/oanda_api/resource/account.rb +37 -0
- data/lib/oanda_api/resource/candle.rb +29 -0
- data/lib/oanda_api/resource/instrument.rb +21 -0
- data/lib/oanda_api/resource/order.rb +74 -0
- data/lib/oanda_api/resource/position.rb +18 -0
- data/lib/oanda_api/resource/price.rb +16 -0
- data/lib/oanda_api/resource/trade.rb +23 -0
- data/lib/oanda_api/resource/transaction.rb +67 -0
- data/lib/oanda_api/resource_base.rb +35 -0
- data/lib/oanda_api/resource_collection.rb +77 -0
- data/lib/oanda_api/utils/utils.rb +101 -0
- data/lib/oanda_api/version.rb +3 -0
- data/oanda_api.gemspec +32 -0
- data/spec/fixtures/vcr_cassettes/account_id_order_id_close.yml +264 -0
- data/spec/fixtures/vcr_cassettes/account_id_order_id_get.yml +114 -0
- data/spec/fixtures/vcr_cassettes/account_id_order_options_create.yml +74 -0
- data/spec/fixtures/vcr_cassettes/account_id_order_options_update.yml +112 -0
- data/spec/fixtures/vcr_cassettes/account_id_orders_get.yml +118 -0
- data/spec/fixtures/vcr_cassettes/account_id_orders_options_get.yml +123 -0
- data/spec/fixtures/vcr_cassettes/account_id_positions_get.yml +112 -0
- data/spec/fixtures/vcr_cassettes/account_id_positions_instrument_close.yml +214 -0
- data/spec/fixtures/vcr_cassettes/account_id_positions_instrument_get.yml +110 -0
- data/spec/fixtures/vcr_cassettes/account_id_trade_id_close.yml +252 -0
- data/spec/fixtures/vcr_cassettes/account_id_trade_id_get.yml +112 -0
- data/spec/fixtures/vcr_cassettes/account_id_trade_options_modify.yml +110 -0
- data/spec/fixtures/vcr_cassettes/account_id_trades_filter_get.yml +118 -0
- data/spec/fixtures/vcr_cassettes/account_id_trades_get.yml +118 -0
- data/spec/fixtures/vcr_cassettes/account_id_transaction_id_get.yml +283 -0
- data/spec/fixtures/vcr_cassettes/account_id_transactions_options_get.yml +205 -0
- data/spec/fixtures/vcr_cassettes/accounts_create.yml +75 -0
- data/spec/fixtures/vcr_cassettes/accounts_get.yml +111 -0
- data/spec/fixtures/vcr_cassettes/accounts_id_get.yml +187 -0
- data/spec/fixtures/vcr_cassettes/candles_options_get.yml +79 -0
- data/spec/fixtures/vcr_cassettes/instruments_get.yml +501 -0
- data/spec/fixtures/vcr_cassettes/instruments_options_get.yml +81 -0
- data/spec/fixtures/vcr_cassettes/prices_options_get.yml +81 -0
- data/spec/fixtures/vcr_cassettes/sandbox_client.yml +116 -0
- data/spec/fixtures/vcr_cassettes/sandbox_client_account.yml +111 -0
- data/spec/fixtures/vcr_cassettes/sandbox_instrument_EUR_USD.yml +77 -0
- data/spec/oanda_api/client/client_spec.rb +107 -0
- data/spec/oanda_api/client/namespace_proxy_spec.rb +16 -0
- data/spec/oanda_api/client/resource_descriptor_spec.rb +39 -0
- data/spec/oanda_api/client/token_client_spec.rb +60 -0
- data/spec/oanda_api/client/username_client_spec.rb +31 -0
- data/spec/oanda_api/configuration_spec.rb +138 -0
- data/spec/oanda_api/examples/accounts_spec.rb +28 -0
- data/spec/oanda_api/examples/orders_spec.rb +68 -0
- data/spec/oanda_api/examples/positions_spec.rb +38 -0
- data/spec/oanda_api/examples/rates_spec.rb +46 -0
- data/spec/oanda_api/examples/trades_spec.rb +58 -0
- data/spec/oanda_api/examples/transactions_spec.rb +24 -0
- data/spec/oanda_api/resource_collection_spec.rb +109 -0
- data/spec/oanda_api/utils/utils_spec.rb +109 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/support/client_helper.rb +60 -0
- data/spec/support/vcr.rb +7 -0
- metadata +124 -9
data/oanda_api.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'oanda_api/version'
|
5
|
+
require 'time'
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "oanda_api"
|
9
|
+
s.authors = ["Dean Missikowski"]
|
10
|
+
s.email = "dmissikowski@gmail.com"
|
11
|
+
s.homepage = "http://github.com/nukeproof/oanda_api"
|
12
|
+
s.summary = %q{ A ruby client for the Oanda REST API. }
|
13
|
+
s.description = %q{ A simple ruby client that supports all of the Oanda REST API methods. Uses Oanda recommended best practices including persistent connections, compression, request rate throttling, SSL certificate verification.}
|
14
|
+
s.version = OandaAPI::VERSION
|
15
|
+
s.date = Date.today.to_s
|
16
|
+
s.license = "MIT"
|
17
|
+
|
18
|
+
s.required_ruby_version = ">= 2.0.0"
|
19
|
+
|
20
|
+
s.files = `git ls-files`.split("\n")
|
21
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
|
24
|
+
s.add_dependency "httparty", "~> 0.13"
|
25
|
+
s.add_dependency "persistent_httparty", "~> 0.1"
|
26
|
+
s.add_dependency "http-exceptions", "~> 0.0"
|
27
|
+
|
28
|
+
s.add_development_dependency "rspec", "~> 3.1"
|
29
|
+
s.add_development_dependency "vcr", "~> 2.9"
|
30
|
+
s.add_development_dependency "webmock", "~> 1.20"
|
31
|
+
s.add_development_dependency "yard", "~> 0.8"
|
32
|
+
end
|
@@ -0,0 +1,264 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://api-sandbox.oanda.com/v1/accounts/5342358/orders
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: expiry=2015-01-20T18%3A22%3A31%2B00%3A00&instrument=USD_JPY&price=1.14089&side=buy&type=limit&units=10000&username=dwaymotim
|
9
|
+
headers:
|
10
|
+
X-Accept-Datetime-Format:
|
11
|
+
- RFC3339
|
12
|
+
Connection:
|
13
|
+
- keep-alive
|
14
|
+
Keep-Alive:
|
15
|
+
- 30
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 201
|
19
|
+
message: CREATED
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- openresty/1.7.0.1
|
23
|
+
Date:
|
24
|
+
- Tue, 20 Jan 2015 17:22:28 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Content-Length:
|
28
|
+
- '313'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Location:
|
32
|
+
- http://api-sandbox.oanda.com/v1/accounts/5342358/orders/175503913
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: "{\n\t\"instrument\" : \"USD_JPY\",\n\t\"time\" : \"2015-01-20T17:22:28.000000Z\",\n\t\"price\"
|
36
|
+
: 1.14089,\n\t\"orderOpened\" : {\n\t\t\"id\" : 175503913,\n\t\t\"units\"
|
37
|
+
: 10000,\n\t\t\"side\" : \"buy\",\n\t\t\"takeProfit\" : 0,\n\t\t\"stopLoss\"
|
38
|
+
: 0,\n\t\t\"expiry\" : \"2015-01-20T18:22:31.000000Z\",\n\t\t\"upperBound\"
|
39
|
+
: 0,\n\t\t\"lowerBound\" : 0,\n\t\t\"trailingStop\" : 0\n\t}\n}"
|
40
|
+
http_version:
|
41
|
+
recorded_at: Tue, 20 Jan 2015 17:22:31 GMT
|
42
|
+
- request:
|
43
|
+
method: get
|
44
|
+
uri: http://api-sandbox.oanda.com/v1/accounts/5342358/orders?username=dwaymotim
|
45
|
+
body:
|
46
|
+
encoding: US-ASCII
|
47
|
+
string: ''
|
48
|
+
headers:
|
49
|
+
X-Accept-Datetime-Format:
|
50
|
+
- RFC3339
|
51
|
+
Connection:
|
52
|
+
- keep-alive
|
53
|
+
Keep-Alive:
|
54
|
+
- 30
|
55
|
+
response:
|
56
|
+
status:
|
57
|
+
code: 200
|
58
|
+
message: OK
|
59
|
+
headers:
|
60
|
+
Server:
|
61
|
+
- openresty/1.7.0.1
|
62
|
+
Date:
|
63
|
+
- Tue, 20 Jan 2015 17:22:28 GMT
|
64
|
+
Content-Type:
|
65
|
+
- application/json
|
66
|
+
Content-Length:
|
67
|
+
- '1683'
|
68
|
+
Connection:
|
69
|
+
- keep-alive
|
70
|
+
Etag:
|
71
|
+
- '"f7d8307f842f7716a831e277508d85f5338d2db4"'
|
72
|
+
X-Result-Count:
|
73
|
+
- '5'
|
74
|
+
body:
|
75
|
+
encoding: UTF-8
|
76
|
+
string: "{\n\t\"orders\" : [\n\t\t{\n\t\t\t\"id\" : 175503913,\n\t\t\t\"instrument\"
|
77
|
+
: \"USD_JPY\",\n\t\t\t\"units\" : 10000,\n\t\t\t\"side\" : \"buy\",\n\t\t\t\"type\"
|
78
|
+
: \"limit\",\n\t\t\t\"time\" : \"2015-01-20T17:22:28.000000Z\",\n\t\t\t\"price\"
|
79
|
+
: 1.14089,\n\t\t\t\"takeProfit\" : 0,\n\t\t\t\"stopLoss\" : 0,\n\t\t\t\"expiry\"
|
80
|
+
: \"2015-01-20T18:22:31.000000Z\",\n\t\t\t\"upperBound\" : 0,\n\t\t\t\"lowerBound\"
|
81
|
+
: 0,\n\t\t\t\"trailingStop\" : 0\n\t\t},\n\t\t{\n\t\t\t\"id\" : 175503911,\n\t\t\t\"instrument\"
|
82
|
+
: \"USD_JPY\",\n\t\t\t\"units\" : 9000,\n\t\t\t\"side\" : \"buy\",\n\t\t\t\"type\"
|
83
|
+
: \"limit\",\n\t\t\t\"time\" : \"2015-01-20T17:22:28.000000Z\",\n\t\t\t\"price\"
|
84
|
+
: 1.14089,\n\t\t\t\"takeProfit\" : 0,\n\t\t\t\"stopLoss\" : 0,\n\t\t\t\"expiry\"
|
85
|
+
: \"2015-01-20T18:22:30.000000Z\",\n\t\t\t\"upperBound\" : 0,\n\t\t\t\"lowerBound\"
|
86
|
+
: 0,\n\t\t\t\"trailingStop\" : 0\n\t\t},\n\t\t{\n\t\t\t\"id\" : 175503910,\n\t\t\t\"instrument\"
|
87
|
+
: \"USD_JPY\",\n\t\t\t\"units\" : 10000,\n\t\t\t\"side\" : \"buy\",\n\t\t\t\"type\"
|
88
|
+
: \"limit\",\n\t\t\t\"time\" : \"2015-01-20T17:22:28.000000Z\",\n\t\t\t\"price\"
|
89
|
+
: 1.14089,\n\t\t\t\"takeProfit\" : 0,\n\t\t\t\"stopLoss\" : 0,\n\t\t\t\"expiry\"
|
90
|
+
: \"2015-01-20T18:22:30.000000Z\",\n\t\t\t\"upperBound\" : 0,\n\t\t\t\"lowerBound\"
|
91
|
+
: 0,\n\t\t\t\"trailingStop\" : 0\n\t\t},\n\t\t{\n\t\t\t\"id\" : 175503909,\n\t\t\t\"instrument\"
|
92
|
+
: \"USD_JPY\",\n\t\t\t\"units\" : 10000,\n\t\t\t\"side\" : \"buy\",\n\t\t\t\"type\"
|
93
|
+
: \"limit\",\n\t\t\t\"time\" : \"2015-01-20T17:22:28.000000Z\",\n\t\t\t\"price\"
|
94
|
+
: 1.14089,\n\t\t\t\"takeProfit\" : 0,\n\t\t\t\"stopLoss\" : 0,\n\t\t\t\"expiry\"
|
95
|
+
: \"2015-01-20T18:22:30.000000Z\",\n\t\t\t\"upperBound\" : 0,\n\t\t\t\"lowerBound\"
|
96
|
+
: 0,\n\t\t\t\"trailingStop\" : 0\n\t\t},\n\t\t{\n\t\t\t\"id\" : 175503908,\n\t\t\t\"instrument\"
|
97
|
+
: \"USD_JPY\",\n\t\t\t\"units\" : 10000,\n\t\t\t\"side\" : \"buy\",\n\t\t\t\"type\"
|
98
|
+
: \"limit\",\n\t\t\t\"time\" : \"2015-01-20T17:22:27.000000Z\",\n\t\t\t\"price\"
|
99
|
+
: 1.14089,\n\t\t\t\"takeProfit\" : 0,\n\t\t\t\"stopLoss\" : 0,\n\t\t\t\"expiry\"
|
100
|
+
: \"2015-01-20T18:22:30.000000Z\",\n\t\t\t\"upperBound\" : 0,\n\t\t\t\"lowerBound\"
|
101
|
+
: 0,\n\t\t\t\"trailingStop\" : 0\n\t\t}\n\t]\n}"
|
102
|
+
http_version:
|
103
|
+
recorded_at: Tue, 20 Jan 2015 17:22:31 GMT
|
104
|
+
- request:
|
105
|
+
method: delete
|
106
|
+
uri: http://api-sandbox.oanda.com/v1/accounts/5342358/orders/175503913?username=dwaymotim
|
107
|
+
body:
|
108
|
+
encoding: US-ASCII
|
109
|
+
string: ''
|
110
|
+
headers:
|
111
|
+
X-Accept-Datetime-Format:
|
112
|
+
- RFC3339
|
113
|
+
Connection:
|
114
|
+
- keep-alive
|
115
|
+
Keep-Alive:
|
116
|
+
- 30
|
117
|
+
response:
|
118
|
+
status:
|
119
|
+
code: 200
|
120
|
+
message: OK
|
121
|
+
headers:
|
122
|
+
Server:
|
123
|
+
- openresty/1.7.0.1
|
124
|
+
Date:
|
125
|
+
- Tue, 20 Jan 2015 17:22:29 GMT
|
126
|
+
Content-Type:
|
127
|
+
- application/json
|
128
|
+
Content-Length:
|
129
|
+
- '166'
|
130
|
+
Connection:
|
131
|
+
- keep-alive
|
132
|
+
body:
|
133
|
+
encoding: UTF-8
|
134
|
+
string: "{\n\t\"id\" : 175503913,\n\t\"instrument\" : \"USD_JPY\",\n\t\"units\"
|
135
|
+
: 10000,\n\t\"side\" : \"buy\",\n\t\"price\" : 1.14089,\n\t\"time\" : \"2015-01-20T17:22:29.000000Z\",\n\t\"type\"
|
136
|
+
: \"BuyLimit\"\n}"
|
137
|
+
http_version:
|
138
|
+
recorded_at: Tue, 20 Jan 2015 17:22:31 GMT
|
139
|
+
- request:
|
140
|
+
method: get
|
141
|
+
uri: http://api-sandbox.oanda.com/v1/accounts/5342358/orders?username=dwaymotim
|
142
|
+
body:
|
143
|
+
encoding: US-ASCII
|
144
|
+
string: ''
|
145
|
+
headers:
|
146
|
+
X-Accept-Datetime-Format:
|
147
|
+
- RFC3339
|
148
|
+
Connection:
|
149
|
+
- keep-alive
|
150
|
+
Keep-Alive:
|
151
|
+
- 30
|
152
|
+
response:
|
153
|
+
status:
|
154
|
+
code: 200
|
155
|
+
message: OK
|
156
|
+
headers:
|
157
|
+
Server:
|
158
|
+
- openresty/1.7.0.1
|
159
|
+
Date:
|
160
|
+
- Tue, 20 Jan 2015 17:22:29 GMT
|
161
|
+
Content-Type:
|
162
|
+
- application/json
|
163
|
+
Content-Length:
|
164
|
+
- '1350'
|
165
|
+
Connection:
|
166
|
+
- keep-alive
|
167
|
+
Etag:
|
168
|
+
- '"16f3da3e5a0a8b39a957a4a071f276157154f4c6"'
|
169
|
+
X-Result-Count:
|
170
|
+
- '4'
|
171
|
+
body:
|
172
|
+
encoding: UTF-8
|
173
|
+
string: "{\n\t\"orders\" : [\n\t\t{\n\t\t\t\"id\" : 175503911,\n\t\t\t\"instrument\"
|
174
|
+
: \"USD_JPY\",\n\t\t\t\"units\" : 9000,\n\t\t\t\"side\" : \"buy\",\n\t\t\t\"type\"
|
175
|
+
: \"limit\",\n\t\t\t\"time\" : \"2015-01-20T17:22:28.000000Z\",\n\t\t\t\"price\"
|
176
|
+
: 1.14089,\n\t\t\t\"takeProfit\" : 0,\n\t\t\t\"stopLoss\" : 0,\n\t\t\t\"expiry\"
|
177
|
+
: \"2015-01-20T18:22:30.000000Z\",\n\t\t\t\"upperBound\" : 0,\n\t\t\t\"lowerBound\"
|
178
|
+
: 0,\n\t\t\t\"trailingStop\" : 0\n\t\t},\n\t\t{\n\t\t\t\"id\" : 175503910,\n\t\t\t\"instrument\"
|
179
|
+
: \"USD_JPY\",\n\t\t\t\"units\" : 10000,\n\t\t\t\"side\" : \"buy\",\n\t\t\t\"type\"
|
180
|
+
: \"limit\",\n\t\t\t\"time\" : \"2015-01-20T17:22:28.000000Z\",\n\t\t\t\"price\"
|
181
|
+
: 1.14089,\n\t\t\t\"takeProfit\" : 0,\n\t\t\t\"stopLoss\" : 0,\n\t\t\t\"expiry\"
|
182
|
+
: \"2015-01-20T18:22:30.000000Z\",\n\t\t\t\"upperBound\" : 0,\n\t\t\t\"lowerBound\"
|
183
|
+
: 0,\n\t\t\t\"trailingStop\" : 0\n\t\t},\n\t\t{\n\t\t\t\"id\" : 175503909,\n\t\t\t\"instrument\"
|
184
|
+
: \"USD_JPY\",\n\t\t\t\"units\" : 10000,\n\t\t\t\"side\" : \"buy\",\n\t\t\t\"type\"
|
185
|
+
: \"limit\",\n\t\t\t\"time\" : \"2015-01-20T17:22:28.000000Z\",\n\t\t\t\"price\"
|
186
|
+
: 1.14089,\n\t\t\t\"takeProfit\" : 0,\n\t\t\t\"stopLoss\" : 0,\n\t\t\t\"expiry\"
|
187
|
+
: \"2015-01-20T18:22:30.000000Z\",\n\t\t\t\"upperBound\" : 0,\n\t\t\t\"lowerBound\"
|
188
|
+
: 0,\n\t\t\t\"trailingStop\" : 0\n\t\t},\n\t\t{\n\t\t\t\"id\" : 175503908,\n\t\t\t\"instrument\"
|
189
|
+
: \"USD_JPY\",\n\t\t\t\"units\" : 10000,\n\t\t\t\"side\" : \"buy\",\n\t\t\t\"type\"
|
190
|
+
: \"limit\",\n\t\t\t\"time\" : \"2015-01-20T17:22:27.000000Z\",\n\t\t\t\"price\"
|
191
|
+
: 1.14089,\n\t\t\t\"takeProfit\" : 0,\n\t\t\t\"stopLoss\" : 0,\n\t\t\t\"expiry\"
|
192
|
+
: \"2015-01-20T18:22:30.000000Z\",\n\t\t\t\"upperBound\" : 0,\n\t\t\t\"lowerBound\"
|
193
|
+
: 0,\n\t\t\t\"trailingStop\" : 0\n\t\t}\n\t]\n}"
|
194
|
+
http_version:
|
195
|
+
recorded_at: Tue, 20 Jan 2015 17:22:31 GMT
|
196
|
+
- request:
|
197
|
+
method: post
|
198
|
+
uri: http://api-sandbox.oanda.com/v1//accounts/5342358/orders
|
199
|
+
body:
|
200
|
+
encoding: UTF-8
|
201
|
+
string: username=dwaymotim
|
202
|
+
headers:
|
203
|
+
X-Accept-Datetime-Format:
|
204
|
+
- RFC3339
|
205
|
+
Connection:
|
206
|
+
- keep-alive
|
207
|
+
Keep-Alive:
|
208
|
+
- 30
|
209
|
+
response:
|
210
|
+
status:
|
211
|
+
code: 400
|
212
|
+
message: BAD_REQUEST
|
213
|
+
headers:
|
214
|
+
Server:
|
215
|
+
- openresty/1.7.0.1
|
216
|
+
Date:
|
217
|
+
- Tue, 20 Jan 2015 21:03:07 GMT
|
218
|
+
Content-Type:
|
219
|
+
- application/json
|
220
|
+
Content-Length:
|
221
|
+
- '145'
|
222
|
+
Connection:
|
223
|
+
- keep-alive
|
224
|
+
body:
|
225
|
+
encoding: UTF-8
|
226
|
+
string: "{\n\t\"code\" : 2,\n\t\"message\" : \"Missing required argument: type\",\n\t\"moreInfo\"
|
227
|
+
: \"http:\\/\\/developer.oanda.com\\/docs\\/v1\\/troubleshooting\\/#errors\"\n}"
|
228
|
+
http_version:
|
229
|
+
recorded_at: Tue, 20 Jan 2015 21:03:07 GMT
|
230
|
+
- request:
|
231
|
+
method: delete
|
232
|
+
uri: http://api-sandbox.oanda.com/v1/accounts/5342358/orders/orders/175503913?username=dwaymotim
|
233
|
+
body:
|
234
|
+
encoding: US-ASCII
|
235
|
+
string: ''
|
236
|
+
headers:
|
237
|
+
X-Accept-Datetime-Format:
|
238
|
+
- RFC3339
|
239
|
+
Connection:
|
240
|
+
- keep-alive
|
241
|
+
Keep-Alive:
|
242
|
+
- 30
|
243
|
+
response:
|
244
|
+
status:
|
245
|
+
code: 400
|
246
|
+
message: BAD_REQUEST
|
247
|
+
headers:
|
248
|
+
Server:
|
249
|
+
- openresty/1.7.0.1
|
250
|
+
Date:
|
251
|
+
- Tue, 20 Jan 2015 23:53:33 GMT
|
252
|
+
Content-Type:
|
253
|
+
- application/json
|
254
|
+
Content-Length:
|
255
|
+
- '166'
|
256
|
+
Connection:
|
257
|
+
- keep-alive
|
258
|
+
body:
|
259
|
+
encoding: UTF-8
|
260
|
+
string: "{\n\t\"code\" : 52,\n\t\"message\" : \"Invalid or malformed resource
|
261
|
+
identifier: accountId\",\n\t\"moreInfo\" : \"http:\\/\\/developer.oanda.com\\/docs\\/v1\\/troubleshooting\\/#errors\"\n}"
|
262
|
+
http_version:
|
263
|
+
recorded_at: Tue, 20 Jan 2015 23:53:33 GMT
|
264
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,114 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://api-sandbox.oanda.com/v1/accounts/5342358/orders
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: expiry=2015-01-20T18%3A22%3A30%2B00%3A00&instrument=USD_JPY&price=1.14089&side=buy&type=limit&units=10000&username=dwaymotim
|
9
|
+
headers:
|
10
|
+
X-Accept-Datetime-Format:
|
11
|
+
- RFC3339
|
12
|
+
Connection:
|
13
|
+
- keep-alive
|
14
|
+
Keep-Alive:
|
15
|
+
- 30
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 201
|
19
|
+
message: CREATED
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- openresty/1.7.0.1
|
23
|
+
Date:
|
24
|
+
- Tue, 20 Jan 2015 17:22:28 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Content-Length:
|
28
|
+
- '313'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Location:
|
32
|
+
- http://api-sandbox.oanda.com/v1/accounts/5342358/orders/175503910
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: "{\n\t\"instrument\" : \"USD_JPY\",\n\t\"time\" : \"2015-01-20T17:22:28.000000Z\",\n\t\"price\"
|
36
|
+
: 1.14089,\n\t\"orderOpened\" : {\n\t\t\"id\" : 175503910,\n\t\t\"units\"
|
37
|
+
: 10000,\n\t\t\"side\" : \"buy\",\n\t\t\"takeProfit\" : 0,\n\t\t\"stopLoss\"
|
38
|
+
: 0,\n\t\t\"expiry\" : \"2015-01-20T18:22:30.000000Z\",\n\t\t\"upperBound\"
|
39
|
+
: 0,\n\t\t\"lowerBound\" : 0,\n\t\t\"trailingStop\" : 0\n\t}\n}"
|
40
|
+
http_version:
|
41
|
+
recorded_at: Tue, 20 Jan 2015 17:22:30 GMT
|
42
|
+
- request:
|
43
|
+
method: get
|
44
|
+
uri: http://api-sandbox.oanda.com/v1/accounts/5342358/orders/175503910?username=dwaymotim
|
45
|
+
body:
|
46
|
+
encoding: US-ASCII
|
47
|
+
string: ''
|
48
|
+
headers:
|
49
|
+
X-Accept-Datetime-Format:
|
50
|
+
- RFC3339
|
51
|
+
Connection:
|
52
|
+
- keep-alive
|
53
|
+
Keep-Alive:
|
54
|
+
- 30
|
55
|
+
response:
|
56
|
+
status:
|
57
|
+
code: 200
|
58
|
+
message: OK
|
59
|
+
headers:
|
60
|
+
Server:
|
61
|
+
- openresty/1.7.0.1
|
62
|
+
Date:
|
63
|
+
- Tue, 20 Jan 2015 17:22:28 GMT
|
64
|
+
Content-Type:
|
65
|
+
- application/json
|
66
|
+
Content-Length:
|
67
|
+
- '301'
|
68
|
+
Connection:
|
69
|
+
- keep-alive
|
70
|
+
Etag:
|
71
|
+
- '"f68d2f102464051138244c2c31a00353806398fc"'
|
72
|
+
body:
|
73
|
+
encoding: UTF-8
|
74
|
+
string: "{\n\t\"id\" : 175503910,\n\t\"instrument\" : \"USD_JPY\",\n\t\"units\"
|
75
|
+
: 10000,\n\t\"side\" : \"buy\",\n\t\"type\" : \"limit\",\n\t\"time\" : \"2015-01-20T17:22:28.000000Z\",\n\t\"price\"
|
76
|
+
: 1.14089,\n\t\"takeProfit\" : 0,\n\t\"stopLoss\" : 0,\n\t\"expiry\" : \"2015-01-20T18:22:30.000000Z\",\n\t\"upperBound\"
|
77
|
+
: 0,\n\t\"lowerBound\" : 0,\n\t\"trailingStop\" : 0\n}"
|
78
|
+
http_version:
|
79
|
+
recorded_at: Tue, 20 Jan 2015 17:22:30 GMT
|
80
|
+
- request:
|
81
|
+
method: post
|
82
|
+
uri: http://api-sandbox.oanda.com/v1//accounts/5342358/orders
|
83
|
+
body:
|
84
|
+
encoding: UTF-8
|
85
|
+
string: username=dwaymotim
|
86
|
+
headers:
|
87
|
+
X-Accept-Datetime-Format:
|
88
|
+
- RFC3339
|
89
|
+
Connection:
|
90
|
+
- keep-alive
|
91
|
+
Keep-Alive:
|
92
|
+
- 30
|
93
|
+
response:
|
94
|
+
status:
|
95
|
+
code: 400
|
96
|
+
message: BAD_REQUEST
|
97
|
+
headers:
|
98
|
+
Server:
|
99
|
+
- openresty/1.7.0.1
|
100
|
+
Date:
|
101
|
+
- Tue, 20 Jan 2015 21:03:06 GMT
|
102
|
+
Content-Type:
|
103
|
+
- application/json
|
104
|
+
Content-Length:
|
105
|
+
- '145'
|
106
|
+
Connection:
|
107
|
+
- keep-alive
|
108
|
+
body:
|
109
|
+
encoding: UTF-8
|
110
|
+
string: "{\n\t\"code\" : 2,\n\t\"message\" : \"Missing required argument: type\",\n\t\"moreInfo\"
|
111
|
+
: \"http:\\/\\/developer.oanda.com\\/docs\\/v1\\/troubleshooting\\/#errors\"\n}"
|
112
|
+
http_version:
|
113
|
+
recorded_at: Tue, 20 Jan 2015 21:03:06 GMT
|
114
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,74 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://api-sandbox.oanda.com/v1/accounts/5342358/orders
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: instrument=EUR_USD&side=buy&type=market&units=10000&username=dwaymotim
|
9
|
+
headers:
|
10
|
+
X-Accept-Datetime-Format:
|
11
|
+
- RFC3339
|
12
|
+
Connection:
|
13
|
+
- keep-alive
|
14
|
+
Keep-Alive:
|
15
|
+
- 30
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- openresty/1.7.0.1
|
23
|
+
Date:
|
24
|
+
- Tue, 20 Jan 2015 17:22:27 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Content-Length:
|
28
|
+
- '273'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
body:
|
32
|
+
encoding: UTF-8
|
33
|
+
string: "{\n\t\"instrument\" : \"EUR_USD\",\n\t\"time\" : \"2015-01-20T17:22:27.000000Z\",\n\t\"price\"
|
34
|
+
: 1.24101,\n\t\"tradeOpened\" : {\n\t\t\"id\" : 175503907,\n\t\t\"units\"
|
35
|
+
: 10000,\n\t\t\"side\" : \"buy\",\n\t\t\"takeProfit\" : 0,\n\t\t\"stopLoss\"
|
36
|
+
: 0,\n\t\t\"trailingStop\" : 0\n\t},\n\t\"tradesClosed\" : [],\n\t\"tradeReduced\"
|
37
|
+
: {}\n}"
|
38
|
+
http_version:
|
39
|
+
recorded_at: Tue, 20 Jan 2015 17:22:29 GMT
|
40
|
+
- request:
|
41
|
+
method: post
|
42
|
+
uri: http://api-sandbox.oanda.com/v1//accounts/5342358/orders
|
43
|
+
body:
|
44
|
+
encoding: UTF-8
|
45
|
+
string: username=dwaymotim
|
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: 400
|
56
|
+
message: BAD_REQUEST
|
57
|
+
headers:
|
58
|
+
Server:
|
59
|
+
- openresty/1.7.0.1
|
60
|
+
Date:
|
61
|
+
- Tue, 20 Jan 2015 21:03:06 GMT
|
62
|
+
Content-Type:
|
63
|
+
- application/json
|
64
|
+
Content-Length:
|
65
|
+
- '145'
|
66
|
+
Connection:
|
67
|
+
- keep-alive
|
68
|
+
body:
|
69
|
+
encoding: UTF-8
|
70
|
+
string: "{\n\t\"code\" : 2,\n\t\"message\" : \"Missing required argument: type\",\n\t\"moreInfo\"
|
71
|
+
: \"http:\\/\\/developer.oanda.com\\/docs\\/v1\\/troubleshooting\\/#errors\"\n}"
|
72
|
+
http_version:
|
73
|
+
recorded_at: Tue, 20 Jan 2015 21:03:06 GMT
|
74
|
+
recorded_with: VCR 2.9.3
|