Jump to content
Sign in to follow this  
Anders

New Stop Entry Order

Recommended Posts

Hi,

After reading this good education material on order types (https://www.forex.com/en/education/education-themes/managing-risk/introduction-to-order-types/), I wanted to try out creating a "stop entry buy order" to see how that would look using the API.

I tried out the /order/newstoplimitorder end point (assuming that was the correct one in this case), using this JSON:

{
  "Direction": "buy",
  "MarketId": EUR-USD-market-id-here,
  "Quantity": 1000,
  "TradingAccountId": trading-account-id-here,
  "TriggerPrice": 1.1829,
  "BidPrice": 1.184,
  "OfferPrice": 1.185            
}

where at the time I did the testing all the three prices were above the current spread. On all my attempts it failed with:

{'Status': 2, 'StatusReason': 75, 'OrderId': 0, 'Orders': [{'OrderId': 0, 'StatusReason': 49, 'Status': 10, 'OrderTypeId': 3, 'Price': 0.0, 'Quantity': 1000.0, 'TriggerPrice': 1.1829, 'CommissionCharge': 0.0, 'IfDone': [], 'GuaranteedPremium': 0.0, 'OCO': null, 'AssociatedOrders': {'Stop': null, 'Limit': null}, 'Associated': false}], 'Quote': null, 'Actions': [], 'ErrorMessage': null}

Apparently I'm doing it wrong. :D

How should a stop entry order (i.e. "an order that triggers a market order when a predefined rate is reached") be created using the API? Thanks for all input. 🙏

Share this post


Link to post

Hi,

You are using the correct API endpoint.

I used the following JSON body to successfully place an entry order to buy EUR/USD should the market fall down to the specified price of 1.171 from the current 1.18. Please try your calls with a similar format and see whether that works as expected.

Kind Regards, PM

{
    "MarketId": 401484347,
    "OrderId": 0,
    "Direction": "buy",
    "Applicability": "gtc",
    "ExpiryDateTimeUTC": null,
    "Quantity": 1000,
    "BidPrice": 1.18,
    "OfferPrice": 1.18016,
    "AuditId": "EC51276387",
    "TradingAccountId": 401637645,
    "TriggerPrice": 1.171,
    "PositionMethodId": 1,
    "IfDone": [],
    "OcoOrder": null
}

 

image.png

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×