Dissecting the Nest Plus Auto Trading API

yusi

Well-Known Member
Re: 11. Order Status ... [2]

How did you use the GetOrderStatus function? It looks like you did it through Ami AFL. When I tried it, I got an error.
From your old post: GetOrderStatus(OrderRefNo (string), Status (string*), FillQty (long*), FillPrice (double* / long*)) How do I implement it?
The gotcha in using pointers or references related calls in AFLs was explained here. Specially the Eric Lippert link reference in part 7.2

As a corollary, also consider the adequacy of the feedback available when a stop is modified through the API.

[You ought to know that "got an error" is not sufficient.]
 

yusi

Well-Known Member
Re: 11. Order Status ... [2]

In simple words if I should say I am not sure how to implement the reference function calls in AFLs.

I tried this:

Code:
OrderRefNo = 1;
ReturnStatus = "";
FillQty = 10;
FillPrice = 282;
plus.GetOrderStatus(OrderRefNo, ReturnStatus, FillQty, FillPrice);
but it didn't work (Buy order was already sent). Surely because the code is wrong. To check the values returned I printed them all and got an {EMPTY}.

Can you share your code? Just this one function call.
In simple words, you can't call the function via AFL, IMO. Not even using VBScript within the AFL. The whole purpose of the referenced post was to explain why (however nitpicking it may sound to the non-programmer), and the small change in the Plus API that would have made it possible.

If an AFL is out, well you call it via custom code that the AFL uses. In my case, it was something like this for what was shown in the illustration:

Code:
function GetStatus(plusObject, OrderNo) {
    orderStatus = plusObject.X_OrderStatus(OrderNo);
    fillQty = plusObject.X_OrderFillQty(OrderNo);
    fillPrice = plusObject.X_OrderFillPrice(OrderNo);

    traceStr = Now(2);
    traceStr = traceStr + " : " + OrderNo + " -- " + orderStatus + " (" + NumToStr(fillQty, 1.0) + " @ " +  NumToStr(fillPrice, 1.2) + ")";
   _TRACE(traceStr);
}
The original status call was broken down as the AFL would nod need the fill values if the returned status (open / trigger pending) did not warrant fetching them. The X_OrderStatus, etc., are custom calls.

As to the usefulness of the GetOrderStatus as it is currently available in the Plus Api, leave it to you to add your thoughts.
 

yusi

Well-Known Member
Order came into my PlusAPI dry run window and from there I click place and it goes into the order book. That's it. It's visible in the order book on the right side.
Your image did not show that order as user confirmed.

The Nest Order number / Exchange Order number is only generated after user confirmation. If not "Nest Order Number not found" as in your log.

If you had confirmed... something else, cannot say offhand.
 

augubhai

Well-Known Member
Order came into my PlusAPI dry run window and from there I click place and it goes into the order book. That's it. It's visible in the order book on the right side.
I had faced this same issue in September. I got in touch with Omnesys thru' RKSV. While Omnesys confirmed that they knew about this issue (i am guessing that it is some internal reference mismatch), they still wanted to access my system during market hours to replicate the issue. I refused, and there was no further response from their side. I did not follow up on the issue... i have decided to just wait until better softwares appear in the market.

Thanks Veera,

I noticed the same when I tried the GDFL plugin.

Need to contact Omnesys to find a solution, but right now too busy with some other stuff.... Whenever I try to modify an order, I get an error that the Nest Order number with that reference number is not found

 

yusi

Well-Known Member
I had faced this same issue in September. I got in touch with Omnesys thru' RKSV. While Omnesys confirmed that they knew about this issue (i am guessing that it is some internal reference mismatch), they still wanted to access my system during market hours to replicate the issue. I refused, and there was no further response from their side. I did not follow up on the issue... i have decided to just wait until better softwares appear in the market.
The order cancellation / modification does work fine.

There is one more possibility that I learnt the hard way: the order lookup is based on the (COM instance + order number) key uniqueness. So multiple clients may have the exact same order number, yet it would be treated as different orders. The presence of the Date-time in the user approval window (API Generated Order window) is insignificant.
 

yusi

Well-Known Member
I doubt that I follow you completely.

The order reached my order book. Beyond this point it will go into Trade book i.e. a confirmed order at the exchange. How and why would I need to modify/cancel a confirmed order?

Yes I can see a NestOrderNo and ExchangeOrderNo in my Order book. This is same order for YesBank to be bought at Rs. 280 that came in from my AFL.

What I should be able to do is Modify/Cancel an open order in the Order book? Correct? If yes, this is what I tried.
In the image that you posted, there is no --Triggered-- in the Nest Order Number column of the API Generated Orders window. This led me to assume that you had not user confirmed the order number 8, at the time of the snashot. If you Refresh, the --Triggered-- is replaced by the Nest Order No. Also, as all your order are @ 280.00 it is hard to differentiate otherwise. I cannot make out if it was Order No 7 or an earlier order in the Order Book.
 

augubhai

Well-Known Member
The order cancellation / modification does work fine.

There is one more possibility that I learnt the hard way: the order lookup is based on the (COM instance + order number) key uniqueness. So multiple clients may have the exact same order number, yet it would be treated as different orders. The presence of the Date-time in the user approval window (API Generated Order window) is insignificant.
I was using this code to create the instance, and thought that it would create only 1 instance and reuse it in the Amibroker seesion.
if(plus=CreateStaticObject("Nest.PlusApi")) { plus.SetObjectName(ClientID); }
 

yusi

Well-Known Member
I was using this code to create the instance, and thought that it would create only 1 instance and reuse it in the Amibroker seesion.
if(plus=CreateStaticObject("Nest.PlusApi")) { plus.SetObjectName(ClientID); }
That should have worked fine.

Was just checking if I had an old screen capture, log, or something that would show how modify / delete was tested, but could not locate anything. One secondary curiosity that needed an answer was "Does modify or delete also require user confirmation?" No it did not.

At this point, do not have a subscription to the Plus Trading API, so cannot recheck. BTW, I'm still at pre 1.8 in Plus.
 

Similar threads