SmartQuant Discussion

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

All times are UTC + 3 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Tue Mar 12, 2019 5:32 am 
Offline

Joined: Thu Feb 05, 2015 11:15 am
Posts: 39
Hi,

How to initialize strategy portfolio when start strategy, with or without information from brokers?

Thanks very much.


Top
 Profile  
 
PostPosted: Tue Mar 12, 2019 9:42 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 471
Hi,
in case of new(your own) portfolio.
When you create it with framework, it will be initialized automatically.
Code:
Portfolio portfolio = new Portfolio(framework);


Portfolio of strategy will be initialized on starting.

Broker information can not be automatically filled in portfolio.


Top
 Profile  
 
PostPosted: Tue Mar 12, 2019 12:41 pm 
Offline

Joined: Thu Feb 05, 2015 11:15 am
Posts: 39
So it is not possible to initialize strategy with already existed positions/fills?

For example, I would like to run a simple turtle strategy on ES. I already has 3 unit of ES in my account and the turtle strategy should take maximum 1 more unit ES (Turtle takes max 4 units position on one side). Is it possible to tell strategy it should consider having 3 units already when initialing it?

I know that a strategy can be recovered with StrategyPersistence. But how about if the strategy state changed outside of OQ?

Thanks.

skuvv wrote:
Hi,
in case of new(your own) portfolio.
When you create it with framework, it will be initialized automatically.
Code:
Portfolio portfolio = new Portfolio(framework);


Portfolio of strategy will be initialized on starting.

Broker information can not be automatically filled in portfolio.


Top
 Profile  
 
PostPosted: Tue Mar 12, 2019 3:07 pm 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 471
ericwang wrote:
So it is not possible to initialize strategy with already existed positions/fills?

For example, I would like to run a simple turtle strategy on ES. I already has 3 unit of ES in my account and the turtle strategy should take maximum 1 more unit ES (Turtle takes max 4 units position on one side). Is it possible to tell strategy it should consider having 3 units already when initialing it?

I know that a strategy can be recovered with StrategyPersistence. But how about if the strategy state changed outside of OQ?

Thanks.

skuvv wrote:
Hi,
in case of new(your own) portfolio.
When you create it with framework, it will be initialized automatically.
Code:
Portfolio portfolio = new Portfolio(framework);


Portfolio of strategy will be initialized on starting.

Broker information can not be automatically filled in portfolio.

I not sure that it can be implemented.

You can play around Portfolio.Add(ExecutionReport) or Position.Add(Fill)


Top
 Profile  
 
PostPosted: Wed Mar 13, 2019 4:16 am 
Offline

Joined: Thu Feb 05, 2015 11:15 am
Posts: 39
I tried, but strategy.Portfolio is null after strategy initialized and instrument added.


Top
 Profile  
 
PostPosted: Wed Mar 13, 2019 9:30 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 471
ericwang wrote:
I tried, but strategy.Portfolio is null after strategy initialized and instrument added.

What type of strategy do you tested?
For type Strategy the portfolio is creating during initialization, so you can check it OnStrategyInit event.


Top
 Profile  
 
PostPosted: Wed Mar 13, 2019 10:48 am 
Offline

Joined: Thu Feb 05, 2015 11:15 am
Posts: 39
I am using InstrumentStrategy

skuvv wrote:
ericwang wrote:
I tried, but strategy.Portfolio is null after strategy initialized and instrument added.

What type of strategy do you tested?
For type Strategy the portfolio is creating during initialization, so you can check it OnStrategyInit event.


Top
 Profile  
 
PostPosted: Wed Mar 13, 2019 11:50 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 471
ericwang wrote:
I am using InstrumentStrategy

skuvv wrote:
ericwang wrote:
I tried, but strategy.Portfolio is null after strategy initialized and instrument added.

What type of strategy do you tested?
For type Strategy the portfolio is creating during initialization, so you can check it OnStrategyInit event.

InstrumentStrategy have same behavior as Starategy.

So, during OnStrategyInit event, portfolio already created and cannot be null


Top
 Profile  
 
PostPosted: Wed Mar 13, 2019 12:29 pm 
Offline

Joined: Thu Feb 05, 2015 11:15 am
Posts: 39
Thank you very much.

I thought strategy will get initialized right after created and before scenario started.


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 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:  
Powered by phpBB® Forum Software © phpBB Group