Skip to content

Commit 7b37f4a

Browse files
committed
Auto-generated v20 API changes
1 parent a0af73f commit 7b37f4a

File tree

8 files changed

+365
-8
lines changed

8 files changed

+365
-8
lines changed

src/com/oanda/v20/RequestException.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,17 @@ public String getErrorMessage() {
3232
}
3333

3434
public String toString() {
35-
String str = "";
36-
str += status;
37-
str += " : ";
38-
str += errorCode;
39-
str += " : ";
40-
str += errorMessage;
35+
String str = "HTTP " + status;
36+
37+
if (errorCode != null) {
38+
str += " : ";
39+
str += errorCode;
40+
}
41+
if (errorMessage != null) {
42+
str += " : ";
43+
str += errorMessage;
44+
}
45+
4146
return str;
4247
}
4348
}

src/com/oanda/v20/position/CalculatedPositionState.java

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public CalculatedPositionState(CalculatedPositionState other) {
2828
this.netUnrealizedPL = other.netUnrealizedPL;
2929
this.longUnrealizedPL = other.longUnrealizedPL;
3030
this.shortUnrealizedPL = other.shortUnrealizedPL;
31+
this.marginUsed = other.marginUsed;
3132
}
3233

3334
@SerializedName("instrument") private InstrumentName instrument;
@@ -275,6 +276,73 @@ public CalculatedPositionState setShortUnrealizedPL(BigDecimal shortUnrealizedPL
275276
return this;
276277
}
277278

279+
@SerializedName("marginUsed") private AccountUnits marginUsed;
280+
281+
/**
282+
* Get the Margin Used
283+
* <p>
284+
* Margin currently used by the Position.
285+
* <p>
286+
* @return the Margin Used
287+
* @see AccountUnits
288+
*/
289+
public AccountUnits getMarginUsed() {
290+
return this.marginUsed;
291+
}
292+
293+
/**
294+
* Set the Margin Used
295+
* <p>
296+
* Margin currently used by the Position.
297+
* <p>
298+
* @param marginUsed the Margin Used as an AccountUnits
299+
* @return {@link CalculatedPositionState CalculatedPositionState}
300+
* @see AccountUnits
301+
*/
302+
public CalculatedPositionState setMarginUsed(AccountUnits marginUsed) {
303+
this.marginUsed = marginUsed;
304+
return this;
305+
}
306+
/**
307+
* Set the Margin Used
308+
* <p>
309+
* Margin currently used by the Position.
310+
* <p>
311+
* @param marginUsed the Margin Used as a String
312+
* @return {@link CalculatedPositionState CalculatedPositionState}
313+
* @see AccountUnits
314+
*/
315+
public CalculatedPositionState setMarginUsed(String marginUsed) {
316+
this.marginUsed = new AccountUnits(marginUsed);
317+
return this;
318+
}
319+
/**
320+
* Set the Margin Used
321+
* <p>
322+
* Margin currently used by the Position.
323+
* <p>
324+
* @param marginUsed the Margin Used as a double
325+
* @return {@link CalculatedPositionState CalculatedPositionState}
326+
* @see AccountUnits
327+
*/
328+
public CalculatedPositionState setMarginUsed(double marginUsed) {
329+
this.marginUsed = new AccountUnits(marginUsed);
330+
return this;
331+
}
332+
/**
333+
* Set the Margin Used
334+
* <p>
335+
* Margin currently used by the Position.
336+
* <p>
337+
* @param marginUsed the Margin Used as a BigDecimal
338+
* @return {@link CalculatedPositionState CalculatedPositionState}
339+
* @see AccountUnits
340+
*/
341+
public CalculatedPositionState setMarginUsed(BigDecimal marginUsed) {
342+
this.marginUsed = new AccountUnits(marginUsed);
343+
return this;
344+
}
345+
278346
@Override
279347
public String toString() {
280348
return "CalculatedPositionState(" +
@@ -285,7 +353,9 @@ public String toString() {
285353
"longUnrealizedPL=" +
286354
(longUnrealizedPL == null ? "null" : longUnrealizedPL.toString()) + ", " +
287355
"shortUnrealizedPL=" +
288-
(shortUnrealizedPL == null ? "null" : shortUnrealizedPL.toString()) +
356+
(shortUnrealizedPL == null ? "null" : shortUnrealizedPL.toString()) + ", " +
357+
"marginUsed=" +
358+
(marginUsed == null ? "null" : marginUsed.toString()) +
289359
")";
290360
}
291361
}

src/com/oanda/v20/position/Position.java

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public Position(Position other) {
2929
this.instrument = other.instrument;
3030
this.pl = other.pl;
3131
this.unrealizedPL = other.unrealizedPL;
32+
this.marginUsed = other.marginUsed;
3233
this.resettablePL = other.resettablePL;
3334
this.commission = other.commission;
3435
if (other.longValue != null)
@@ -221,6 +222,73 @@ public Position setUnrealizedPL(BigDecimal unrealizedPL) {
221222
return this;
222223
}
223224

225+
@SerializedName("marginUsed") private AccountUnits marginUsed;
226+
227+
/**
228+
* Get the Margin Used
229+
* <p>
230+
* Margin currently used by the Position.
231+
* <p>
232+
* @return the Margin Used
233+
* @see AccountUnits
234+
*/
235+
public AccountUnits getMarginUsed() {
236+
return this.marginUsed;
237+
}
238+
239+
/**
240+
* Set the Margin Used
241+
* <p>
242+
* Margin currently used by the Position.
243+
* <p>
244+
* @param marginUsed the Margin Used as an AccountUnits
245+
* @return {@link Position Position}
246+
* @see AccountUnits
247+
*/
248+
public Position setMarginUsed(AccountUnits marginUsed) {
249+
this.marginUsed = marginUsed;
250+
return this;
251+
}
252+
/**
253+
* Set the Margin Used
254+
* <p>
255+
* Margin currently used by the Position.
256+
* <p>
257+
* @param marginUsed the Margin Used as a String
258+
* @return {@link Position Position}
259+
* @see AccountUnits
260+
*/
261+
public Position setMarginUsed(String marginUsed) {
262+
this.marginUsed = new AccountUnits(marginUsed);
263+
return this;
264+
}
265+
/**
266+
* Set the Margin Used
267+
* <p>
268+
* Margin currently used by the Position.
269+
* <p>
270+
* @param marginUsed the Margin Used as a double
271+
* @return {@link Position Position}
272+
* @see AccountUnits
273+
*/
274+
public Position setMarginUsed(double marginUsed) {
275+
this.marginUsed = new AccountUnits(marginUsed);
276+
return this;
277+
}
278+
/**
279+
* Set the Margin Used
280+
* <p>
281+
* Margin currently used by the Position.
282+
* <p>
283+
* @param marginUsed the Margin Used as a BigDecimal
284+
* @return {@link Position Position}
285+
* @see AccountUnits
286+
*/
287+
public Position setMarginUsed(BigDecimal marginUsed) {
288+
this.marginUsed = new AccountUnits(marginUsed);
289+
return this;
290+
}
291+
224292
@SerializedName("resettablePL") private AccountUnits resettablePL;
225293

226294
/**
@@ -430,6 +498,8 @@ public String toString() {
430498
(pl == null ? "null" : pl.toString()) + ", " +
431499
"unrealizedPL=" +
432500
(unrealizedPL == null ? "null" : unrealizedPL.toString()) + ", " +
501+
"marginUsed=" +
502+
(marginUsed == null ? "null" : marginUsed.toString()) + ", " +
433503
"resettablePL=" +
434504
(resettablePL == null ? "null" : resettablePL.toString()) + ", " +
435505
"commission=" +

src/com/oanda/v20/trade/CalculatedTradeState.java

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public CalculatedTradeState() {
2525
public CalculatedTradeState(CalculatedTradeState other) {
2626
this.id = other.id;
2727
this.unrealizedPL = other.unrealizedPL;
28+
this.marginUsed = other.marginUsed;
2829
}
2930

3031
@SerializedName("id") private TradeID id;
@@ -135,13 +136,82 @@ public CalculatedTradeState setUnrealizedPL(BigDecimal unrealizedPL) {
135136
return this;
136137
}
137138

139+
@SerializedName("marginUsed") private AccountUnits marginUsed;
140+
141+
/**
142+
* Get the Margin Used
143+
* <p>
144+
* Margin currently used by the Trade.
145+
* <p>
146+
* @return the Margin Used
147+
* @see AccountUnits
148+
*/
149+
public AccountUnits getMarginUsed() {
150+
return this.marginUsed;
151+
}
152+
153+
/**
154+
* Set the Margin Used
155+
* <p>
156+
* Margin currently used by the Trade.
157+
* <p>
158+
* @param marginUsed the Margin Used as an AccountUnits
159+
* @return {@link CalculatedTradeState CalculatedTradeState}
160+
* @see AccountUnits
161+
*/
162+
public CalculatedTradeState setMarginUsed(AccountUnits marginUsed) {
163+
this.marginUsed = marginUsed;
164+
return this;
165+
}
166+
/**
167+
* Set the Margin Used
168+
* <p>
169+
* Margin currently used by the Trade.
170+
* <p>
171+
* @param marginUsed the Margin Used as a String
172+
* @return {@link CalculatedTradeState CalculatedTradeState}
173+
* @see AccountUnits
174+
*/
175+
public CalculatedTradeState setMarginUsed(String marginUsed) {
176+
this.marginUsed = new AccountUnits(marginUsed);
177+
return this;
178+
}
179+
/**
180+
* Set the Margin Used
181+
* <p>
182+
* Margin currently used by the Trade.
183+
* <p>
184+
* @param marginUsed the Margin Used as a double
185+
* @return {@link CalculatedTradeState CalculatedTradeState}
186+
* @see AccountUnits
187+
*/
188+
public CalculatedTradeState setMarginUsed(double marginUsed) {
189+
this.marginUsed = new AccountUnits(marginUsed);
190+
return this;
191+
}
192+
/**
193+
* Set the Margin Used
194+
* <p>
195+
* Margin currently used by the Trade.
196+
* <p>
197+
* @param marginUsed the Margin Used as a BigDecimal
198+
* @return {@link CalculatedTradeState CalculatedTradeState}
199+
* @see AccountUnits
200+
*/
201+
public CalculatedTradeState setMarginUsed(BigDecimal marginUsed) {
202+
this.marginUsed = new AccountUnits(marginUsed);
203+
return this;
204+
}
205+
138206
@Override
139207
public String toString() {
140208
return "CalculatedTradeState(" +
141209
"id=" +
142210
(id == null ? "null" : id.toString()) + ", " +
143211
"unrealizedPL=" +
144-
(unrealizedPL == null ? "null" : unrealizedPL.toString()) +
212+
(unrealizedPL == null ? "null" : unrealizedPL.toString()) + ", " +
213+
"marginUsed=" +
214+
(marginUsed == null ? "null" : marginUsed.toString()) +
145215
")";
146216
}
147217
}

src/com/oanda/v20/trade/Trade.java

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public Trade(Trade other) {
4848
this.currentUnits = other.currentUnits;
4949
this.realizedPL = other.realizedPL;
5050
this.unrealizedPL = other.unrealizedPL;
51+
this.marginUsed = other.marginUsed;
5152
this.averageClosePrice = other.averageClosePrice;
5253
if (other.closingTransactionIDs != null)
5354
{
@@ -569,6 +570,73 @@ public Trade setUnrealizedPL(BigDecimal unrealizedPL) {
569570
return this;
570571
}
571572

573+
@SerializedName("marginUsed") private AccountUnits marginUsed;
574+
575+
/**
576+
* Get the Margin Used
577+
* <p>
578+
* Margin currently used by the Trade.
579+
* <p>
580+
* @return the Margin Used
581+
* @see AccountUnits
582+
*/
583+
public AccountUnits getMarginUsed() {
584+
return this.marginUsed;
585+
}
586+
587+
/**
588+
* Set the Margin Used
589+
* <p>
590+
* Margin currently used by the Trade.
591+
* <p>
592+
* @param marginUsed the Margin Used as an AccountUnits
593+
* @return {@link Trade Trade}
594+
* @see AccountUnits
595+
*/
596+
public Trade setMarginUsed(AccountUnits marginUsed) {
597+
this.marginUsed = marginUsed;
598+
return this;
599+
}
600+
/**
601+
* Set the Margin Used
602+
* <p>
603+
* Margin currently used by the Trade.
604+
* <p>
605+
* @param marginUsed the Margin Used as a String
606+
* @return {@link Trade Trade}
607+
* @see AccountUnits
608+
*/
609+
public Trade setMarginUsed(String marginUsed) {
610+
this.marginUsed = new AccountUnits(marginUsed);
611+
return this;
612+
}
613+
/**
614+
* Set the Margin Used
615+
* <p>
616+
* Margin currently used by the Trade.
617+
* <p>
618+
* @param marginUsed the Margin Used as a double
619+
* @return {@link Trade Trade}
620+
* @see AccountUnits
621+
*/
622+
public Trade setMarginUsed(double marginUsed) {
623+
this.marginUsed = new AccountUnits(marginUsed);
624+
return this;
625+
}
626+
/**
627+
* Set the Margin Used
628+
* <p>
629+
* Margin currently used by the Trade.
630+
* <p>
631+
* @param marginUsed the Margin Used as a BigDecimal
632+
* @return {@link Trade Trade}
633+
* @see AccountUnits
634+
*/
635+
public Trade setMarginUsed(BigDecimal marginUsed) {
636+
this.marginUsed = new AccountUnits(marginUsed);
637+
return this;
638+
}
639+
572640
@SerializedName("averageClosePrice") private PriceValue averageClosePrice;
573641

574642
/**
@@ -937,6 +1005,8 @@ public String toString() {
9371005
(realizedPL == null ? "null" : realizedPL.toString()) + ", " +
9381006
"unrealizedPL=" +
9391007
(unrealizedPL == null ? "null" : unrealizedPL.toString()) + ", " +
1008+
"marginUsed=" +
1009+
(marginUsed == null ? "null" : marginUsed.toString()) + ", " +
9401010
"averageClosePrice=" +
9411011
(averageClosePrice == null ? "null" : averageClosePrice.toString()) + ", " +
9421012
"closingTransactionIDs=" +

0 commit comments

Comments
 (0)