Jump to content
SupereeDuperee

NewTradeOrderRequestDTO Properties Doesn't match Examples

Recommended Posts

In the API PDF and (now offline) docs web site and also in this forum numerous time I have seen NewTradeOrderRequestDTO example like :-

 
{
   "IfDone":[],
   "Direction":"buy",
   "ExpiryDateTimeUTCDate":null,
   "LastChangedDateTimeUTCDate":null,
   "OcoOrder":null,
   "Type":null,
   "ExpiryDateTimeUTC":null,
   "Applicability":null,
   "TriggerPrice":null,
   "BidPrice":1.4395,
   "AuditId":"8327595- 0- 0- 0- R",
   "AutoRollover":false,
   "MarketId":401166448,
   "OfferPrice":1.4397,
   "OrderId":0,
   "Currency":null,
   "Quantity":1,
   "QuoteId":null,
   "LastChangedDateTimeUTC":null,
   "PositionMethodId":1,
   "TradingAccountId":400239061,
   "MarketName":"GBP/USD",
   "Status":null,
   "isTrade":true
}

 

This is taken from Page# 208 of the GAIN_CAP_UserGuide PDF file itself. And it works just fine. However the "NewTradeOrderRequestDTO"  description on Page# 350 of the same PDF (Screenshot attached) doesn't have any of these properties that are in the JSON above

ExpiryDateTimeUTCDate
LastChangedDateTimeUTCDate
MarketName
etc ... .. .

Why there is a mismatch? Will "NewTradeOrderRequestDTO" Object work without any of these NEW fields if I send it to API Call? Thanks

 

GAIN_NewTradeOrderReqDTO.PNG

Share this post


Link to post

Hello,

We have a project to automate documentation updates so that de-synchronisation such as the examples above no longer happen. Until that is implemented, the documentation is still being updated manually. 

It looks as though the DTO fields page was not updated when new fields were added, although the page with the Trade calls were updated with the new fields. We're scheuling some updates to refresh the docs to clean up discrepancies such as this.

Kind Regards, PM

 

 

 

 

Share this post


Link to post

I kind of assumed that and found the API Call to Open a Market Trade works fine without the NEW FIELDS. However I found this really interesting :- The Bid/Offer value has ABSOLUTELY no EFFECT as long as they are 0<Bid<Offer and CurrentRate falls within Bid/Offer range. So I am using Bid=1.0001 and Offer=999.9999 in my OpentMarketTrade API calls and it buys/sells at the current rate. I am skipping an API call to get Current Bid/Ask values. 

Is there any Serious Risk using  Bid=1.0001 and Offer=999.9999 values in above scenario?

    

{"MarketId":401484406,"Currency":null,"AutoRollover":false,
"Direction":"Buy","Quantity":3000.0,"QuoteId":0,"PositionMethodId":0,
"BidPrice":1.0001,"OfferPrice":9.9999,"AuditId":"6123214",
"TradingAccountId":101958216,"IfDone":null,"Close":null,"Reference":null,
"AllocationProfileId":0,"OrderReference":null,"Source":null,
"MarketName":"EUR/USD","PriceTolerance":0}

 

Also, The "MarketName":"EUR/USD" is useless, in above JSON i used MarketId=401484406 Which is USD/CAD so the "MarketName" is useless.

Share this post


Link to post

Hello Superee,

If your trade call is not using the actual live Bid/Offer prices at the time you send the call, you won't have it in your logs as to what price you received at the time the trade was made. I would suggest it is better to have the call to request the current Bid/Ask and use them in your trade call so you have it on record, but if that isn't something you check then it is your choice. 

Similarly, the MarkeName field is there should you or another user require it in the trade call. If you don't require it, you can leave that from your call.

Kind Regards, PM

 

Share this post


Link to post

Hi @Physicsman you mentioned 

Quote

... .. .  you won't have it in your logs as to what price you received . .. ...

Also in Documentation for Status Resons #7 says about logs (PDF Page 79)

InstructionStatusReason
Code Description
1 OK.
2 Instance of type InstructionDTO must be provided.
3 Risk Process identifier does not exist.
4 Internal user identifier must be provided.
5 Session identifier must be provided.
6 Instruction source identifier does not exist.
7 Instruction processing has resulted in an Error. Please check log for details.

Where is this "Log"? How can I access/view this log? Thank you.

Share this post


Link to post

Hi Superee,

In the first case, that is referring to any logs the user/developer such as yourself stores on the prices you are trading on. Should not need/want to keep logs on this type of information/transaction it is not required to successfuly use the API. 

In the second case, it is also referring to the logs (if any) kept by the user/yourself on the API responses received for each call you send. Specifically, you would check the OrderStatusReason code in the response for additional information as to why you are receiving a red card.

PS: the API documentation site has been back up for the past couple of weeks so you can go back to user that over the PDF file should you prefer.

Kind Regards, PM

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
×