mrchrisok/OandaV20.2

Limit Orders filled as Market Order by Oanda

Closed this issue · 1 comments

Hello again, I'm using the latest version of your wrapper now. Thanks again for all of your help.

With the latest version, I'm seeing some undesired behavior, but I'm not sure where the fault lies.

In my software, I do this:

            var request = new LimitOrderRequest(instrument);

            request.price = (decimal)price;
            request.units = amount;

            var response = await Rest20.PostOrderAsync(_accountId, request);

And I expect it to create a Limit Order. However, when I test this out on Oanda (both practice and trade accounts), while the order request shows up as Limit initially, it is then reported filled as a market order, which is obviously undesirable. This is what I see in the Activity Log in the Oanda application:

Activity Log

What I'm not sure is:

  • Is this order actually being filled as a Market Order? Or is this simply confusing terminology from Oanda?
  • If the order is being filled as a market order, am I doing something wrong? Is something going wrong in the wrapper? Or is the problem with Oanda?

Thanks for your help.

Hi zamir,

Apologies for the delayed response.

Your observations are correct regarding Oanda's process for filling limit orders.

Limit orders sent to Oanda are filled as Market orders at the price (or better) specified by the 'price' property of the LimitOrder.
Oanda uses a cancel-then-replace pattern to do this.
After the MarketOrder is filled, Oanda writes the 'id' of the MarketOrder to the fillingTransactionID of the cancelled LimitOrder.

Chris