oanda_api 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +67 -6
  3. data/README.md +31 -3
  4. data/lib/oanda_api.rb +3 -1
  5. data/lib/oanda_api/client/client.rb +17 -12
  6. data/lib/oanda_api/client/namespace_proxy.rb +2 -2
  7. data/lib/oanda_api/client/resource_descriptor.rb +25 -9
  8. data/lib/oanda_api/client/username_client.rb +7 -0
  9. data/lib/oanda_api/configuration.rb +14 -0
  10. data/lib/oanda_api/resource/account.rb +22 -3
  11. data/lib/oanda_api/resource/candle.rb +1 -1
  12. data/lib/oanda_api/resource/labs/calendar_event.rb +25 -0
  13. data/lib/oanda_api/resource/labs/spread_history.rb +61 -0
  14. data/lib/oanda_api/resource/order.rb +4 -4
  15. data/lib/oanda_api/resource/transaction_history.rb +0 -1
  16. data/lib/oanda_api/resource_base.rb +64 -2
  17. data/lib/oanda_api/resource_collection.rb +6 -0
  18. data/lib/oanda_api/streaming/client.rb +1 -0
  19. data/lib/oanda_api/version.rb +1 -1
  20. data/oanda_api.gemspec +2 -2
  21. data/spec/fixtures/vcr_cassettes/accounts_get.yml +13 -79
  22. data/spec/fixtures/vcr_cassettes/accounts_id_get.yml +23 -125
  23. data/spec/fixtures/vcr_cassettes/calendar_events_period_get.yml +54 -0
  24. data/spec/fixtures/vcr_cassettes/calendar_instrument_and_period_get.yml +61 -0
  25. data/spec/fixtures/vcr_cassettes/calendar_period_get.yml +54 -0
  26. data/spec/fixtures/vcr_cassettes/candles_options_get.yml +9 -45
  27. data/spec/fixtures/vcr_cassettes/client_helper_account.yml +45 -0
  28. data/spec/fixtures/vcr_cassettes/client_helper_accounts.yml +45 -0
  29. data/spec/fixtures/vcr_cassettes/instrument_EUR_USD.yml +42 -0
  30. data/spec/fixtures/vcr_cassettes/instrument_USD_JPY.yml +42 -0
  31. data/spec/fixtures/vcr_cassettes/instruments_get.yml +37 -303
  32. data/spec/fixtures/vcr_cassettes/instruments_options_get.yml +6 -43
  33. data/spec/fixtures/vcr_cassettes/order_id_close.yml +448 -0
  34. data/spec/fixtures/vcr_cassettes/order_id_get.yml +84 -0
  35. data/spec/fixtures/vcr_cassettes/order_options_create.yml +42 -0
  36. data/spec/fixtures/vcr_cassettes/order_options_update.yml +82 -0
  37. data/spec/fixtures/vcr_cassettes/orders_get.yml +205 -0
  38. data/spec/fixtures/vcr_cassettes/orders_options_get.yml +120 -0
  39. data/spec/fixtures/vcr_cassettes/positions_get.yml +82 -0
  40. data/spec/fixtures/vcr_cassettes/positions_instrument_close.yml +154 -0
  41. data/spec/fixtures/vcr_cassettes/{account_id_order_options_create.yml → positions_instrument_get.yml} +24 -18
  42. data/spec/fixtures/vcr_cassettes/prices_options_get.yml +11 -48
  43. data/spec/fixtures/vcr_cassettes/spread_history_get.yml +53 -0
  44. data/spec/fixtures/vcr_cassettes/spreads_get.yml +53 -0
  45. data/spec/fixtures/vcr_cassettes/trade_id_close.yml +277 -0
  46. data/spec/fixtures/vcr_cassettes/trade_id_get.yml +82 -0
  47. data/spec/fixtures/vcr_cassettes/trade_options_modify.yml +80 -0
  48. data/spec/fixtures/vcr_cassettes/trades_filter_get.yml +90 -0
  49. data/spec/fixtures/vcr_cassettes/trades_get.yml +171 -0
  50. data/spec/fixtures/vcr_cassettes/transaction_id_get.yml +248 -0
  51. data/spec/fixtures/vcr_cassettes/transactions_options_get.yml +202 -0
  52. data/spec/fixtures/vcr_cassettes/with_throttling_and_max_requests_per_second.yml +25 -19
  53. data/spec/fixtures/vcr_cassettes/with_throttling_with_multiple_threads.yml +51 -39
  54. data/spec/fixtures/vcr_cassettes/without_throttling.yml +81 -61
  55. data/spec/oanda_api/client/client_spec.rb +23 -10
  56. data/spec/oanda_api/client/namespace_proxy_spec.rb +1 -1
  57. data/spec/oanda_api/client/resource_descriptor_spec.rb +45 -14
  58. data/spec/oanda_api/configuration_spec.rb +13 -0
  59. data/spec/oanda_api/examples/accounts_spec.rb +0 -7
  60. data/spec/oanda_api/examples/calendar_spec.rb +27 -0
  61. data/spec/oanda_api/examples/orders_spec.rb +12 -12
  62. data/spec/oanda_api/examples/positions_spec.rb +3 -3
  63. data/spec/oanda_api/examples/rates_spec.rb +4 -2
  64. data/spec/oanda_api/examples/spread_history_spec.rb +32 -0
  65. data/spec/oanda_api/examples/trades_spec.rb +5 -5
  66. data/spec/oanda_api/examples/transactions_spec.rb +2 -2
  67. data/spec/oanda_api/resource_base_spec.rb +48 -8
  68. data/spec/oanda_api/streaming/client_spec.rb +30 -2
  69. data/spec/spec_helper.rb +1 -1
  70. data/spec/support/client_helper.rb +45 -11
  71. data/spec/support/vcr.rb +1 -0
  72. metadata +63 -49
  73. data/spec/fixtures/vcr_cassettes/account_id_order_id_close.yml +0 -264
  74. data/spec/fixtures/vcr_cassettes/account_id_order_id_get.yml +0 -114
  75. data/spec/fixtures/vcr_cassettes/account_id_order_options_update.yml +0 -112
  76. data/spec/fixtures/vcr_cassettes/account_id_orders_get.yml +0 -118
  77. data/spec/fixtures/vcr_cassettes/account_id_orders_options_get.yml +0 -123
  78. data/spec/fixtures/vcr_cassettes/account_id_positions_get.yml +0 -112
  79. data/spec/fixtures/vcr_cassettes/account_id_positions_instrument_close.yml +0 -214
  80. data/spec/fixtures/vcr_cassettes/account_id_positions_instrument_get.yml +0 -110
  81. data/spec/fixtures/vcr_cassettes/account_id_trade_id_close.yml +0 -252
  82. data/spec/fixtures/vcr_cassettes/account_id_trade_id_get.yml +0 -112
  83. data/spec/fixtures/vcr_cassettes/account_id_trade_options_modify.yml +0 -110
  84. data/spec/fixtures/vcr_cassettes/account_id_trades_filter_get.yml +0 -118
  85. data/spec/fixtures/vcr_cassettes/account_id_trades_get.yml +0 -118
  86. data/spec/fixtures/vcr_cassettes/account_id_transaction_id_get.yml +0 -283
  87. data/spec/fixtures/vcr_cassettes/account_id_transactions_options_get.yml +0 -205
  88. data/spec/fixtures/vcr_cassettes/accounts_create.yml +0 -75
  89. data/spec/fixtures/vcr_cassettes/sandbox_client.yml +0 -116
  90. data/spec/fixtures/vcr_cassettes/sandbox_client_account.yml +0 -111
  91. data/spec/fixtures/vcr_cassettes/sandbox_instrument_EUR_USD.yml +0 -77
  92. data/spec/oanda_api/client/username_client_spec.rb +0 -31
@@ -1,112 +0,0 @@
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=USD_JPY&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:29 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\" : \"USD_JPY\",\n\t\"time\" : \"2015-01-20T17:22:29.000000Z\",\n\t\"price\"
34
- : 114.893,\n\t\"tradeOpened\" : {\n\t\t\"id\" : 175503915,\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:31 GMT
40
- - request:
41
- method: get
42
- uri: http://api-sandbox.oanda.com/v1/accounts/5342358/positions?username=dwaymotim
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 17:22:29 GMT
62
- Content-Type:
63
- - application/json
64
- Content-Length:
65
- - '224'
66
- Connection:
67
- - keep-alive
68
- Etag:
69
- - '"fde8d56cf47b8943c9140031c927b7fedd01e14d"'
70
- body:
71
- encoding: UTF-8
72
- string: "{\n\t\"positions\" : [\n\t\t{\n\t\t\t\"instrument\" : \"EUR_USD\",\n\t\t\t\"units\"
73
- : 10000,\n\t\t\t\"side\" : \"buy\",\n\t\t\t\"avgPrice\" : 1.24101\n\t\t},\n\t\t{\n\t\t\t\"instrument\"
74
- : \"USD_JPY\",\n\t\t\t\"units\" : 10000,\n\t\t\t\"side\" : \"buy\",\n\t\t\t\"avgPrice\"
75
- : 114.893\n\t\t}\n\t]\n}"
76
- http_version:
77
- recorded_at: Tue, 20 Jan 2015 17:22:31 GMT
78
- - request:
79
- method: post
80
- uri: http://api-sandbox.oanda.com/v1//accounts/5342358/orders
81
- body:
82
- encoding: UTF-8
83
- string: username=dwaymotim
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: 400
94
- message: BAD_REQUEST
95
- headers:
96
- Server:
97
- - openresty/1.7.0.1
98
- Date:
99
- - Tue, 20 Jan 2015 21:03:07 GMT
100
- Content-Type:
101
- - application/json
102
- Content-Length:
103
- - '145'
104
- Connection:
105
- - keep-alive
106
- body:
107
- encoding: UTF-8
108
- string: "{\n\t\"code\" : 2,\n\t\"message\" : \"Missing required argument: type\",\n\t\"moreInfo\"
109
- : \"http:\\/\\/developer.oanda.com\\/docs\\/v1\\/troubleshooting\\/#errors\"\n}"
110
- http_version:
111
- recorded_at: Tue, 20 Jan 2015 21:03:07 GMT
112
- recorded_with: VCR 2.9.3
@@ -1,214 +0,0 @@
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=USD_JPY&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:29 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\" : \"USD_JPY\",\n\t\"time\" : \"2015-01-20T17:22:29.000000Z\",\n\t\"price\"
34
- : 114.893,\n\t\"tradeOpened\" : {\n\t\t\"id\" : 175503917,\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:32 GMT
40
- - request:
41
- method: get
42
- uri: http://api-sandbox.oanda.com/v1/accounts/5342358/positions/USD_JPY?username=dwaymotim
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 17:22:30 GMT
62
- Content-Type:
63
- - application/json
64
- Content-Length:
65
- - '87'
66
- Connection:
67
- - keep-alive
68
- Etag:
69
- - '"bc64caecfbe1242cd1401bbe6d9f5125c93abd83"'
70
- body:
71
- encoding: UTF-8
72
- string: "{\n\t\"instrument\" : \"USD_JPY\",\n\t\"units\" : 30000,\n\t\"side\"
73
- : \"buy\",\n\t\"avgPrice\" : 114.893\n}"
74
- http_version:
75
- recorded_at: Tue, 20 Jan 2015 17:22:32 GMT
76
- - request:
77
- method: delete
78
- uri: http://api-sandbox.oanda.com/v1/accounts/5342358/positions/USD_JPY?username=dwaymotim
79
- body:
80
- encoding: US-ASCII
81
- string: ''
82
- headers:
83
- X-Accept-Datetime-Format:
84
- - RFC3339
85
- Connection:
86
- - keep-alive
87
- Keep-Alive:
88
- - 30
89
- response:
90
- status:
91
- code: 200
92
- message: OK
93
- headers:
94
- Server:
95
- - openresty/1.7.0.1
96
- Date:
97
- - Tue, 20 Jan 2015 17:22:30 GMT
98
- Content-Type:
99
- - application/json
100
- Content-Length:
101
- - '164'
102
- Connection:
103
- - keep-alive
104
- body:
105
- encoding: UTF-8
106
- string: "{\n\t\"ids\" : [\n\t\t175503915,\n\t\t175503918,\n\t\t175503916,\n\t\t175503919,\n\t\t175503917,\n\t\t175503920\n\t],\n\t\"instrument\"
107
- : \"USD_JPY\",\n\t\"totalUnits\" : 30000,\n\t\"price\" : 114.879\n}"
108
- http_version:
109
- recorded_at: Tue, 20 Jan 2015 17:22:32 GMT
110
- - request:
111
- method: get
112
- uri: http://api-sandbox.oanda.com/v1/accounts/5342358/positions?username=dwaymotim
113
- body:
114
- encoding: US-ASCII
115
- string: ''
116
- headers:
117
- X-Accept-Datetime-Format:
118
- - RFC3339
119
- Connection:
120
- - keep-alive
121
- Keep-Alive:
122
- - 30
123
- response:
124
- status:
125
- code: 200
126
- message: OK
127
- headers:
128
- Server:
129
- - openresty/1.7.0.1
130
- Date:
131
- - Tue, 20 Jan 2015 17:22:30 GMT
132
- Content-Type:
133
- - application/json
134
- Content-Length:
135
- - '123'
136
- Connection:
137
- - keep-alive
138
- Etag:
139
- - '"0e99155591e8a0de4e3571f0bbe3d8060b2f6976"'
140
- body:
141
- encoding: UTF-8
142
- string: "{\n\t\"positions\" : [\n\t\t{\n\t\t\t\"instrument\" : \"EUR_USD\",\n\t\t\t\"units\"
143
- : 10000,\n\t\t\t\"side\" : \"buy\",\n\t\t\t\"avgPrice\" : 1.24101\n\t\t}\n\t]\n}"
144
- http_version:
145
- recorded_at: Tue, 20 Jan 2015 17:22:33 GMT
146
- - request:
147
- method: post
148
- uri: http://api-sandbox.oanda.com/v1//accounts/5342358/orders
149
- body:
150
- encoding: UTF-8
151
- string: username=dwaymotim
152
- headers:
153
- X-Accept-Datetime-Format:
154
- - RFC3339
155
- Connection:
156
- - keep-alive
157
- Keep-Alive:
158
- - 30
159
- response:
160
- status:
161
- code: 400
162
- message: BAD_REQUEST
163
- headers:
164
- Server:
165
- - openresty/1.7.0.1
166
- Date:
167
- - Tue, 20 Jan 2015 21:03:07 GMT
168
- Content-Type:
169
- - application/json
170
- Content-Length:
171
- - '145'
172
- Connection:
173
- - keep-alive
174
- body:
175
- encoding: UTF-8
176
- string: "{\n\t\"code\" : 2,\n\t\"message\" : \"Missing required argument: type\",\n\t\"moreInfo\"
177
- : \"http:\\/\\/developer.oanda.com\\/docs\\/v1\\/troubleshooting\\/#errors\"\n}"
178
- http_version:
179
- recorded_at: Tue, 20 Jan 2015 21:03:09 GMT
180
- - request:
181
- method: delete
182
- uri: http://api-sandbox.oanda.com/v1/accounts/5342358/positions/USD_JPY/positions/USD_JPY?username=dwaymotim
183
- body:
184
- encoding: US-ASCII
185
- string: ''
186
- headers:
187
- X-Accept-Datetime-Format:
188
- - RFC3339
189
- Connection:
190
- - keep-alive
191
- Keep-Alive:
192
- - 30
193
- response:
194
- status:
195
- code: 400
196
- message: BAD_REQUEST
197
- headers:
198
- Server:
199
- - openresty/1.7.0.1
200
- Date:
201
- - Tue, 20 Jan 2015 23:53:34 GMT
202
- Content-Type:
203
- - application/json
204
- Content-Length:
205
- - '166'
206
- Connection:
207
- - keep-alive
208
- body:
209
- encoding: UTF-8
210
- string: "{\n\t\"code\" : 52,\n\t\"message\" : \"Invalid or malformed resource
211
- identifier: accountId\",\n\t\"moreInfo\" : \"http:\\/\\/developer.oanda.com\\/docs\\/v1\\/troubleshooting\\/#errors\"\n}"
212
- http_version:
213
- recorded_at: Tue, 20 Jan 2015 23:53:34 GMT
214
- recorded_with: VCR 2.9.3
@@ -1,110 +0,0 @@
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=USD_JPY&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:29 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\" : \"USD_JPY\",\n\t\"time\" : \"2015-01-20T17:22:29.000000Z\",\n\t\"price\"
34
- : 114.893,\n\t\"tradeOpened\" : {\n\t\t\"id\" : 175503916,\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:31 GMT
40
- - request:
41
- method: get
42
- uri: http://api-sandbox.oanda.com/v1/accounts/5342358/positions/USD_JPY?username=dwaymotim
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 17:22:29 GMT
62
- Content-Type:
63
- - application/json
64
- Content-Length:
65
- - '87'
66
- Connection:
67
- - keep-alive
68
- Etag:
69
- - '"9f52bb38c777d797a51c95efe903fcbbf4aa3476"'
70
- body:
71
- encoding: UTF-8
72
- string: "{\n\t\"instrument\" : \"USD_JPY\",\n\t\"units\" : 20000,\n\t\"side\"
73
- : \"buy\",\n\t\"avgPrice\" : 114.893\n}"
74
- http_version:
75
- recorded_at: Tue, 20 Jan 2015 17:22:32 GMT
76
- - request:
77
- method: post
78
- uri: http://api-sandbox.oanda.com/v1//accounts/5342358/orders
79
- body:
80
- encoding: UTF-8
81
- string: username=dwaymotim
82
- headers:
83
- X-Accept-Datetime-Format:
84
- - RFC3339
85
- Connection:
86
- - keep-alive
87
- Keep-Alive:
88
- - 30
89
- response:
90
- status:
91
- code: 400
92
- message: BAD_REQUEST
93
- headers:
94
- Server:
95
- - openresty/1.7.0.1
96
- Date:
97
- - Tue, 20 Jan 2015 21:03:07 GMT
98
- Content-Type:
99
- - application/json
100
- Content-Length:
101
- - '145'
102
- Connection:
103
- - keep-alive
104
- body:
105
- encoding: UTF-8
106
- string: "{\n\t\"code\" : 2,\n\t\"message\" : \"Missing required argument: type\",\n\t\"moreInfo\"
107
- : \"http:\\/\\/developer.oanda.com\\/docs\\/v1\\/troubleshooting\\/#errors\"\n}"
108
- http_version:
109
- recorded_at: Tue, 20 Jan 2015 21:03:07 GMT
110
- recorded_with: VCR 2.9.3
@@ -1,252 +0,0 @@
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=USD_JPY&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:33 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\" : \"USD_JPY\",\n\t\"time\" : \"2015-01-20T17:22:33.000000Z\",\n\t\"price\"
34
- : 114.893,\n\t\"tradeOpened\" : {\n\t\t\"id\" : 175503926,\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:35 GMT
40
- - request:
41
- method: get
42
- uri: http://api-sandbox.oanda.com/v1/accounts/5342358/trades?instrument=USD_JPY&username=dwaymotim
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 17:22:33 GMT
62
- Content-Type:
63
- - application/json
64
- Content-Length:
65
- - '1275'
66
- Connection:
67
- - keep-alive
68
- Etag:
69
- - '"1ea18ebc08fad3ca4df57b2f89ff476112678a17"'
70
- X-Result-Count:
71
- - '5'
72
- body:
73
- encoding: UTF-8
74
- string: "{\n\t\"trades\" : [\n\t\t{\n\t\t\t\"id\" : 175503926,\n\t\t\t\"units\"
75
- : 10000,\n\t\t\t\"side\" : \"buy\",\n\t\t\t\"instrument\" : \"USD_JPY\",\n\t\t\t\"time\"
76
- : \"2015-01-20T17:22:33.000000Z\",\n\t\t\t\"price\" : 114.893,\n\t\t\t\"takeProfit\"
77
- : 0,\n\t\t\t\"stopLoss\" : 0,\n\t\t\t\"trailingStop\" : 0,\n\t\t\t\"trailingAmount\"
78
- : 0\n\t\t},\n\t\t{\n\t\t\t\"id\" : 175503924,\n\t\t\t\"units\" : 10000,\n\t\t\t\"side\"
79
- : \"buy\",\n\t\t\t\"instrument\" : \"USD_JPY\",\n\t\t\t\"time\" : \"2015-01-20T17:22:33.000000Z\",\n\t\t\t\"price\"
80
- : 114.893,\n\t\t\t\"takeProfit\" : 116.893,\n\t\t\t\"stopLoss\" : 0,\n\t\t\t\"trailingStop\"
81
- : 0,\n\t\t\t\"trailingAmount\" : 0\n\t\t},\n\t\t{\n\t\t\t\"id\" : 175503923,\n\t\t\t\"units\"
82
- : 10000,\n\t\t\t\"side\" : \"buy\",\n\t\t\t\"instrument\" : \"USD_JPY\",\n\t\t\t\"time\"
83
- : \"2015-01-20T17:22:32.000000Z\",\n\t\t\t\"price\" : 114.893,\n\t\t\t\"takeProfit\"
84
- : 0,\n\t\t\t\"stopLoss\" : 0,\n\t\t\t\"trailingStop\" : 0,\n\t\t\t\"trailingAmount\"
85
- : 0\n\t\t},\n\t\t{\n\t\t\t\"id\" : 175503922,\n\t\t\t\"units\" : 10000,\n\t\t\t\"side\"
86
- : \"buy\",\n\t\t\t\"instrument\" : \"USD_JPY\",\n\t\t\t\"time\" : \"2015-01-20T17:22:32.000000Z\",\n\t\t\t\"price\"
87
- : 114.893,\n\t\t\t\"takeProfit\" : 0,\n\t\t\t\"stopLoss\" : 0,\n\t\t\t\"trailingStop\"
88
- : 0,\n\t\t\t\"trailingAmount\" : 0\n\t\t},\n\t\t{\n\t\t\t\"id\" : 175503921,\n\t\t\t\"units\"
89
- : 10000,\n\t\t\t\"side\" : \"buy\",\n\t\t\t\"instrument\" : \"USD_JPY\",\n\t\t\t\"time\"
90
- : \"2015-01-20T17:22:32.000000Z\",\n\t\t\t\"price\" : 114.893,\n\t\t\t\"takeProfit\"
91
- : 0,\n\t\t\t\"stopLoss\" : 0,\n\t\t\t\"trailingStop\" : 0,\n\t\t\t\"trailingAmount\"
92
- : 0\n\t\t}\n\t]\n}"
93
- http_version:
94
- recorded_at: Tue, 20 Jan 2015 17:22:35 GMT
95
- - request:
96
- method: delete
97
- uri: http://api-sandbox.oanda.com/v1/accounts/5342358/trades/175503921?username=dwaymotim
98
- body:
99
- encoding: US-ASCII
100
- string: ''
101
- headers:
102
- X-Accept-Datetime-Format:
103
- - RFC3339
104
- Connection:
105
- - keep-alive
106
- Keep-Alive:
107
- - 30
108
- response:
109
- status:
110
- code: 200
111
- message: OK
112
- headers:
113
- Server:
114
- - openresty/1.7.0.1
115
- Date:
116
- - Tue, 20 Jan 2015 17:22:33 GMT
117
- Content-Type:
118
- - application/json
119
- Content-Length:
120
- - '147'
121
- Connection:
122
- - keep-alive
123
- body:
124
- encoding: UTF-8
125
- string: "{\n\t\"id\" : 175503927,\n\t\"price\" : 114.879,\n\t\"profit\" : -1.2187,\n\t\"instrument\"
126
- : \"USD_JPY\",\n\t\"side\" : \"buy\",\n\t\"time\" : \"2015-01-20T17:22:33.000000Z\"\n}"
127
- http_version:
128
- recorded_at: Tue, 20 Jan 2015 17:22:36 GMT
129
- - request:
130
- method: get
131
- uri: http://api-sandbox.oanda.com/v1/accounts/5342358/trades?username=dwaymotim
132
- body:
133
- encoding: US-ASCII
134
- string: ''
135
- headers:
136
- X-Accept-Datetime-Format:
137
- - RFC3339
138
- Connection:
139
- - keep-alive
140
- Keep-Alive:
141
- - 30
142
- response:
143
- status:
144
- code: 200
145
- message: OK
146
- headers:
147
- Server:
148
- - openresty/1.7.0.1
149
- Date:
150
- - Tue, 20 Jan 2015 17:22:33 GMT
151
- Content-Type:
152
- - application/json
153
- Content-Length:
154
- - '1275'
155
- Connection:
156
- - keep-alive
157
- Etag:
158
- - '"6b538c818124bfa06a29e746db8ebe3fcc2d3a35"'
159
- X-Result-Count:
160
- - '5'
161
- body:
162
- encoding: UTF-8
163
- string: "{\n\t\"trades\" : [\n\t\t{\n\t\t\t\"id\" : 175503926,\n\t\t\t\"units\"
164
- : 10000,\n\t\t\t\"side\" : \"buy\",\n\t\t\t\"instrument\" : \"USD_JPY\",\n\t\t\t\"time\"
165
- : \"2015-01-20T17:22:33.000000Z\",\n\t\t\t\"price\" : 114.893,\n\t\t\t\"takeProfit\"
166
- : 0,\n\t\t\t\"stopLoss\" : 0,\n\t\t\t\"trailingStop\" : 0,\n\t\t\t\"trailingAmount\"
167
- : 0\n\t\t},\n\t\t{\n\t\t\t\"id\" : 175503924,\n\t\t\t\"units\" : 10000,\n\t\t\t\"side\"
168
- : \"buy\",\n\t\t\t\"instrument\" : \"USD_JPY\",\n\t\t\t\"time\" : \"2015-01-20T17:22:33.000000Z\",\n\t\t\t\"price\"
169
- : 114.893,\n\t\t\t\"takeProfit\" : 116.893,\n\t\t\t\"stopLoss\" : 0,\n\t\t\t\"trailingStop\"
170
- : 0,\n\t\t\t\"trailingAmount\" : 0\n\t\t},\n\t\t{\n\t\t\t\"id\" : 175503923,\n\t\t\t\"units\"
171
- : 10000,\n\t\t\t\"side\" : \"buy\",\n\t\t\t\"instrument\" : \"USD_JPY\",\n\t\t\t\"time\"
172
- : \"2015-01-20T17:22:32.000000Z\",\n\t\t\t\"price\" : 114.893,\n\t\t\t\"takeProfit\"
173
- : 0,\n\t\t\t\"stopLoss\" : 0,\n\t\t\t\"trailingStop\" : 0,\n\t\t\t\"trailingAmount\"
174
- : 0\n\t\t},\n\t\t{\n\t\t\t\"id\" : 175503922,\n\t\t\t\"units\" : 10000,\n\t\t\t\"side\"
175
- : \"buy\",\n\t\t\t\"instrument\" : \"USD_JPY\",\n\t\t\t\"time\" : \"2015-01-20T17:22:32.000000Z\",\n\t\t\t\"price\"
176
- : 114.893,\n\t\t\t\"takeProfit\" : 0,\n\t\t\t\"stopLoss\" : 0,\n\t\t\t\"trailingStop\"
177
- : 0,\n\t\t\t\"trailingAmount\" : 0\n\t\t},\n\t\t{\n\t\t\t\"id\" : 175503907,\n\t\t\t\"units\"
178
- : 10000,\n\t\t\t\"side\" : \"buy\",\n\t\t\t\"instrument\" : \"EUR_USD\",\n\t\t\t\"time\"
179
- : \"2015-01-20T17:22:27.000000Z\",\n\t\t\t\"price\" : 1.24101,\n\t\t\t\"takeProfit\"
180
- : 0,\n\t\t\t\"stopLoss\" : 0,\n\t\t\t\"trailingStop\" : 0,\n\t\t\t\"trailingAmount\"
181
- : 0\n\t\t}\n\t]\n}"
182
- http_version:
183
- recorded_at: Tue, 20 Jan 2015 17:22:36 GMT
184
- - request:
185
- method: post
186
- uri: http://api-sandbox.oanda.com/v1//accounts/5342358/orders
187
- body:
188
- encoding: UTF-8
189
- string: username=dwaymotim
190
- headers:
191
- X-Accept-Datetime-Format:
192
- - RFC3339
193
- Connection:
194
- - keep-alive
195
- Keep-Alive:
196
- - 30
197
- response:
198
- status:
199
- code: 400
200
- message: BAD_REQUEST
201
- headers:
202
- Server:
203
- - openresty/1.7.0.1
204
- Date:
205
- - Tue, 20 Jan 2015 21:03:09 GMT
206
- Content-Type:
207
- - application/json
208
- Content-Length:
209
- - '145'
210
- Connection:
211
- - keep-alive
212
- body:
213
- encoding: UTF-8
214
- string: "{\n\t\"code\" : 2,\n\t\"message\" : \"Missing required argument: type\",\n\t\"moreInfo\"
215
- : \"http:\\/\\/developer.oanda.com\\/docs\\/v1\\/troubleshooting\\/#errors\"\n}"
216
- http_version:
217
- recorded_at: Tue, 20 Jan 2015 21:03:09 GMT
218
- - request:
219
- method: delete
220
- uri: http://api-sandbox.oanda.com/v1/accounts/5342358/trades/trades/175503921?instrument=USD_JPY&username=dwaymotim
221
- body:
222
- encoding: US-ASCII
223
- string: ''
224
- headers:
225
- X-Accept-Datetime-Format:
226
- - RFC3339
227
- Connection:
228
- - keep-alive
229
- Keep-Alive:
230
- - 30
231
- response:
232
- status:
233
- code: 400
234
- message: BAD_REQUEST
235
- headers:
236
- Server:
237
- - openresty/1.7.0.1
238
- Date:
239
- - Tue, 20 Jan 2015 23:53:35 GMT
240
- Content-Type:
241
- - application/json
242
- Content-Length:
243
- - '166'
244
- Connection:
245
- - keep-alive
246
- body:
247
- encoding: UTF-8
248
- string: "{\n\t\"code\" : 52,\n\t\"message\" : \"Invalid or malformed resource
249
- identifier: accountId\",\n\t\"moreInfo\" : \"http:\\/\\/developer.oanda.com\\/docs\\/v1\\/troubleshooting\\/#errors\"\n}"
250
- http_version:
251
- recorded_at: Tue, 20 Jan 2015 23:53:36 GMT
252
- recorded_with: VCR 2.9.3