SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Mon Aug 19, 2019 9:13 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 46 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
PostPosted: Fri Jan 17, 2014 3:23 pm 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 353
Well, I've tried to send command BUY. And I've got an event about rejection ("something with route"). But I don't mind order to be rejected as long as I get call back and I do have it. It is of kind stiEvents_OnSTIOrderRejectMsg(SterlingLib.STIOrderRejectMsg value), though I would expect XML reject but that is another issue.

So the bottom line - the call back events seem to work.

Do you want me to send you my project?

Ed


Top
 Profile  
 
PostPosted: Fri Jan 17, 2014 5:18 pm 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 353
Checked Send order. I do get call backs for Order status and Position updates. So it seems like everything is working. I'm just not sure why i don't get the XML forms of the events... For Quotes I do get them in XML but not for commands... Strange?


Top
 Profile  
 
PostPosted: Tue Jan 21, 2014 7:24 pm 
Offline

Joined: Tue Jan 14, 2014 7:51 pm
Posts: 13
Hi ed,

So I am pretty much stuck. I am able to send an order and it gets to the market place. So when I send the order to sterling I get a response saying that order is ok but when the order is sent to the market place I get no update events.

Have you add any more luck?

Brian


Top
 Profile  
 
PostPosted: Tue Jan 21, 2014 7:34 pm 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 353
Hi Brian,

As I said, I'm able to send a Buy order and to get notifications. Here is the link https://www.dropbox.com/s/m0vu2ymugci0o3y/SterlingProvider.zip to my project - please check if you get call backs. I've set there breakpoints to all event methods - I suggest you do the same - then you'll be able to see which notification comes where. I could not get XML notifications but the regular ones are coming ok.



Ed


Top
 Profile  
 
PostPosted: Tue Jan 21, 2014 7:47 pm 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 353
BTW - I'm using OQ 64-bit and no problem with that - so you may disregard what I said in one of the first posts regarding ActiveX and 32 bit.

Looking forward to hear from you.
Ed


Top
 Profile  
 
PostPosted: Tue Jan 21, 2014 8:31 pm 
Offline

Joined: Tue Jan 14, 2014 7:51 pm
Posts: 13
Hi ed,

Ok tried your code and it worked. One of the things I noticed that was different was I set the events to structs where in your code I got events from the non struct update events. Not sure why that is.

thanks for all you help.

Brian


Top
 Profile  
 
PostPosted: Tue Jan 21, 2014 8:40 pm 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 353
Brian,

I'm glad if I could help. Please do not hesitate to write to me if you have any other questions. I'm very interested in this Sterling plug-in and would appreciate if you can share it with me when it is ready.

Ed


Top
 Profile  
 
PostPosted: Tue Jan 21, 2014 9:18 pm 
Offline

Joined: Tue Jan 14, 2014 7:51 pm
Posts: 13
Ed,

How would I get the event update to call the base.emitAccepted(order) method to update OQ.

thanks

Brian


Top
 Profile  
 
PostPosted: Tue Jan 21, 2014 9:37 pm 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 353
Brian,

I'm not such an expert in plug-ins as it might seem :). So please provide more details. I guess you are asking - on which event you should send the EmitAccepted? If such event is generated in Sterling and delivered to us then - on it. Otherwise I would send the EmitAccepted once the SendCommand returns 0. Is that what you asked? Sorry if I misunderstood you.


Top
 Profile  
 
PostPosted: Tue Jan 21, 2014 9:58 pm 
Offline

Joined: Tue Jan 14, 2014 7:51 pm
Posts: 13
if an event is called by sterling like this one

Quote:
private void stiEvents_OnSTIOrderUpdateMsg(SterlingLib.STIOrderUpdateMsg oSTIOrderUpdateMsg)
{
MessageBox.Show("8");


}


How can I call base.EmitAccepted method when it is in the form class and not in the SterlingProviderClass?

If i type base. no method comes up for emitAccepted in the Sterling API class.


Top
 Profile  
 
PostPosted: Tue Jan 21, 2014 10:27 pm 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 353
Ah, ok. got it.

The way to do that is to pass a reference to the Sterling API in getInstance of SterlingAPI class. And the use the reference from SterlingAPI to call a method of SterlingProvider. Something like below (see the text in Bold):


#region Singleton Implementation
private static SterlingAPI instance;
private SterlingProviderClass spc;
/// <summary>
/// Singleton implementation
/// </summary>

public static SterlingAPI getInstance(SterlingProviderClass spc)
{

if (instance == null)
{
instance = new SterlingAPI(spc);
}
return instance;
}

/// <summary>
/// Private default constructor - needed to prevent the class instantiation by NEW statement
/// </summary>
private SterlingAPI(SterlingProviderClass spc)
{
//init all stuff
this.spc = spc;
Initialization();

}

#endregion

....

Then:

private void stiEvents_OnSTIOrderUpdateMsg(SterlingLib.STIOrderUpdateMsg oSTIOrderUpdateMsg)
{
...
spc.myEmitAccepted();
}


And in the SterlingProviderClass modify the line where you instantiate SterlingAPI this way:

...
api = SterlingAPI.getInstance(this);
...

And also define a method in SterlingProviderClass:

public void myEmitAccepted()
{
....
base.EmitAccepted();
....
}


Top
 Profile  
 
PostPosted: Tue Jan 21, 2014 10:53 pm 
Offline

Joined: Tue Jan 14, 2014 7:51 pm
Posts: 13
Ed,

That helped big time.

I will send you some code once I get a little further. Thanks again.

Brian


Top
 Profile  
 
PostPosted: Tue Jan 21, 2014 11:05 pm 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 353
I'm glad. Looking forward to test your code.

There is one thing I wanted to mention in the code, that you probably already know but just in case - if you try to interact with Sterling ActiveX while the Sterling Client is not running there is an exception. So one should make sure the lines:

Code:
            stiQuote = new SterlingLib.STIQuote();
            stiApp = new SterlingLib.STIApp();
            stiOrder = new SterlingLib.STIOrder();
            stiEvents = new SterlingLib.STIEvents();
            stiPosition = new SterlingLib.STIPosition();


are not called upon loading the plug-in but only on Connect and withing Connect they are enclosed in Try/Catch. In my code I put those lines inside the SterlingAPI constructor. The I call that only from Connect method of SterlingProviderClass.

If you don't do that - whenever you start OpenQuant and the Sterling client is not running yet - OpenQuant will give an exception when loading your plug-in.


Top
 Profile  
 
PostPosted: Thu Feb 06, 2014 10:45 am 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 353
Brian,

How is it going with Sterling provider? Looking forward to hear from you.

Ed


Top
 Profile  
 
PostPosted: Fri Feb 14, 2014 12:12 am 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 353
Brian,

Any feedback on the event queue? Did you download it?

Please let me know how it is going and whether you need anything else.

Ed


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 46 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group