SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Sun Sep 15, 2019 9:42 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu Dec 15, 2011 6:20 am 
Offline

Joined: Mon Feb 21, 2011 10:46 am
Posts: 48
Hi, I encountered a question while developing a custom execution provider. When I start OQ and connect to my UserProvider, it is natural that I want to get the the current open position information. And my broker's API supports querying and reporting open positions. But in UserProvider class, I could not find a way to report the open position info. I think it is related to the Portfolio class, and I guess I could create a Portfolio and add some transactions to it, But the question is how could I relate this portfolio to my provider class? Or is this the right way to solve the problem?
Thanks!

Edit:
I found a sample in Sample Providers, and a class called "BrokerAccount", I think I have to override GetBrokerInfo method and add brokerAccounts, like:
Code:

protected override BrokerInfo GetBrokerInfo()
{
   BrokerInfo brokerInfo = new BrokerInfo();
   if (IsConnected)
   {
      foreach (MbtAccount account in manager.OrderClient.Accounts)
      {
         BrokerAccount brokerAccount = brokerInfo.AddAccount(account.Account);
         // account fields
         brokerAccount.BuyingPower = account.CurrentBP;
         brokerAccount.AddField("Account", account.Account);
         brokerAccount.AddField("AcctType", account.AcctType.ToString());
         ....
      }
   }
   return brokerInfo;


I think this is the solution, correct me if I'm wrong.


Top
 Profile  
 
PostPosted: Thu Dec 15, 2011 10:43 am 
Offline
Site Admin

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

Code:
BrokerPosition brokerPosition = brokerAccount.AddPosition();

brokerPosition.Symbol = "MSFT";
brokerPosition.Qty = 100;
..etc


But, this (BrokerInfo) information is not automatically added to Portfolio anyway.
Some FAQs on our forum can help you to synchronize portfolio with broker side.

_________________
SmartQuant Development Team


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 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