SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Mon Aug 10, 2020 7:22 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 

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?

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

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.

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

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

BrokerPosition brokerPosition = brokerAccount.AddPosition();

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

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

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