SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Wed Oct 28, 2020 12:36 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Wed Dec 22, 2010 12:34 pm 
Offline

Joined: Wed Sep 26, 2007 10:03 pm
Posts: 101
Hi

I would like to enhance and customize the Position class (adding new public properties and methods). However, the Position class is a static class and I cannot write a new class (let's say MyPosition class) which inherits from the Position class.

Is there a way to write a new static MyPosition class which has all the members of the Position class and where I can add new members?

Regards,
Boris


Top
 Profile  
 
PostPosted: Wed Dec 22, 2010 12:45 pm 
Offline
Site Admin

Joined: Thu Jul 17, 2003 10:39 am
Posts: 1478
Hi Boris,

do you mean Position class from OpenQuant API? This class is not static class, you can extend it, but it does not make sense since OQ will not use your class anyway...

Regards,
Alex

_________________
SmartQuant Development Team


Top
 Profile  
 
PostPosted: Wed Dec 22, 2010 1:02 pm 
Offline

Joined: Wed Sep 26, 2007 10:03 pm
Posts: 101
Hi Alex

thank you for your answer. Yes, I mean the Position class from OpenQuant.API.

What I want to do is something like this:

public class MyPosition : OpenQuant.API.Position
{
// inheret everything from OpenQuant.API.Position
// implement additional public properties and methods
}

In the strategy code, I could access then for example Position.Qty as MyPosition.Qty but also new properties which I implemented, for example, MyPosition.StopPrice.

Is that possible to do?

Regards,
Boris


Top
 Profile  
 
PostPosted: Wed Dec 22, 2010 1:06 pm 
Offline
Site Admin

Joined: Thu Jul 17, 2003 10:39 am
Posts: 1478
it will not work...OQ creates an instance of OpenQuant.API.Position class, but not of MyPosition one...It doesn't know about MyPosition class

_________________
SmartQuant Development Team


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

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