SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Tue Mar 26, 2019 8:04 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Fri Oct 22, 2010 4:27 pm 
Offline

Joined: Sun Oct 17, 2010 2:26 am
Posts: 8
Hi,

im new to oq, is it possible to make script close all Pending Orders in "Order Manager"? if so, please give me example.

Thanks


Top
 Profile  
 
PostPosted: Fri Oct 22, 2010 4:36 pm 
Offline

Joined: Wed Oct 08, 2003 1:06 pm
Posts: 833
Hi,

Please try the following script.

Code:
   foreach (Order order in Orders)
         if (!order.IsDone)
            order.Cancel();


Regards,
Sergey.


Top
 Profile  
 
PostPosted: Sat Oct 23, 2010 12:56 am 
Offline

Joined: Sun Oct 17, 2010 2:26 am
Posts: 8
The name "Orders" does not exists in current context.

any idea what is wrong ?


Top
 Profile  
 
PostPosted: Sat Oct 23, 2010 10:11 am 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6811
Are you running this code inside a strategy?

Regards,
Anton


Top
 Profile  
 
PostPosted: Sat Oct 23, 2010 11:06 am 
Offline

Joined: Sun Oct 17, 2010 2:26 am
Posts: 8
Im running this code as Script , but it doesn't work

Code:
public class MyScript : Script
{
   
   public override void Run()
   {
      // Type your code here
      foreach (Order order in Orders)
         if (!order.IsDone)
            order.Cancel();
   }
}


Dr. Anton Fokin wrote:
Are you running this code inside a strategy?

Regards,
Anton


Top
 Profile  
 
PostPosted: Sat Oct 23, 2010 12:38 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6811
You don't have access to Orders in the script, Orders object references a list of current Strategy orders (actually it's Strategy.Orders property, you can find it in the API documentation).

We can add OrderManager object to make it possible to access order lists in a script.

Regards,
Anton


Top
 Profile  
 
PostPosted: Sat Oct 23, 2010 1:13 pm 
Offline

Joined: Sun Oct 17, 2010 2:26 am
Posts: 8
Thanks, that would be great.
Dr. Anton Fokin wrote:
You don't have access to Orders in the script, Orders object references a list of current Strategy orders (actually it's Strategy.Orders property, you can find it in the API documentation).

We can add OrderManager object to make it possible to access order lists in a script.

Regards,
Anton


Top
 Profile  
 
PostPosted: Thu Mar 31, 2011 4:13 pm 
Offline

Joined: Thu Mar 31, 2011 4:09 pm
Posts: 1
Dr. Anton Fokin wrote:
You don't have access to Orders in the script, Orders object references a list of current Strategy orders (actually it's Strategy.Orders property, you can find it in the API documentation).

We can add OrderManager object to make it possible to access order lists in a script.

Regards,
Anton


Hi Anton,

Does recent version of OQ allow to access active orders in context of a solution's Scenario.cs (e.g. OrderManager mentioned in your post)?

Thanks!


Top
 Profile  
 
PostPosted: Wed Jun 20, 2012 6:37 pm 
Offline

Joined: Thu Mar 10, 2011 10:09 pm
Posts: 582
As I understand feature is still not available. Right ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 2 guests


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