SmartQuant Discussion
http://www.smartquant.com/forums/

Deriving form Position class
http://www.smartquant.com/forums/viewtopic.php?f=44&t=8601
Page 1 of 1

Author:  brankov [ Wed Dec 22, 2010 12:34 pm ]
Post subject:  Deriving form Position class

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

Author:  Alexei Kurov [ Wed Dec 22, 2010 12:45 pm ]
Post subject:  Re: Deriving form Position class

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

Author:  brankov [ Wed Dec 22, 2010 1:02 pm ]
Post subject:  Re: Deriving form Position class

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

Author:  Alexei Kurov [ Wed Dec 22, 2010 1:06 pm ]
Post subject:  Re: Deriving form Position class

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

Page 1 of 1 All times are UTC + 3 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/