mrchrisok/OandaV20.2

OANDA update to miniumTradeSize

Closed this issue · 5 comments

Hello. OANDA recently made an announcement that they will be updating their minimum trade sizes to allow fractional values (e.g. 0.1). For me this change took effect on Friday 14-May-2021. I captured an error message in my logs that stated:

Error converting value "0.1" to type 'System.Int64'. Path 'instruments[0].minimumTradeSize', line 1, position 159.

I traced the error to public class Instrument and made the following 1 change to correct the issue (see below...changing minimumTrade size from long to decimal). The code seems to work now but, I am not sure if there will be some other consequences of the change. Any thoughts or advice? Will you be updating your code to accomidated the minimum trade size change??

public class Instrument
{
public string name { get; set; }
public string type { get; set; }
public string displayName { get; set; }
public int pipLocation { get; set; }
public int displayPrecision { get; set; }
public int tradeUnitsPrecision { get; set; }
//public long minimumTradeSize { get; set; }
public decimal miniumumTradeSize { get; set; }
public decimal maximumTrailingStopDistance { get; set; }
public decimal minimumTrailingStopDistance { get; set; }
public decimal maximumPositionSize { get; set; }
public long maximumOrderUnits { get; set; }
public decimal marginRate { get; set; }
public InstrumentCommission commission { get; set; }
}

Please let us know.
Regards,
Mike

Hi Mike. Thanks for bringing this to everyone's attention! I have been using this library for a long time, but stopped over the last few months due to me moving to a different location. How did you become aware of this change from Oanda other than getting the error? I looked on the Oanda developer portal and I don't see anything in the release notes stating they updated their API. I would like to be notified of these changes if possible.

Hello davirobi. OANDA sent me an email a while ago which I read and must have deleted as I cannot find it anymore. The email said something about (I think...don't remember exactly) compatibility with MT4 trade sizes or something similar to that. I did not think much of the email at the time and was hoping the change would not break my API trading code. For me (OANDA Europe) they must have made the change on close of business Friday 14-May-2021 about 20:43 GMT as that is when I found the first error record in my logs. After the weekend, on Monday/Tuesday I noticed my API trading code was not responding and checked my logs which had the same error. I traced it to the change in minimumTradeSize and corrected it as above. I also looked on the OANDA site and I could not find any information on the change in minimumTradeSize.
Regards,
Mike

Hi Chris,

Cheers for the message and for including this fix in the next update. Your code is very useful and works well. I was able to write a C# API trading program wrapped around OkonkwoOandaV20 that I run 24 hours per day / 5 days per week some time ago. I am looking forward to checking out your latest update.

Regards,
Mike

The needed updates to support fractional units in V20.2 are complete.
However updates are still needed to update the library to Oanda v3.0.25.
That work is now underway.