SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Tue Oct 16, 2018 1:38 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Account variables.
PostPosted: Thu Sep 17, 2009 2:26 am 
Offline

Joined: Mon Jul 27, 2009 3:28 pm
Posts: 24
Location: Ukraine
How can I get real account variables?
I know that OQ doesn't provide real-time synchronization with real accounts, but I can do it manualy - Is it right?

to get account variables I'm using this code
Code:
BrokerAccount account = DataManager.GetBrokerInfo("MBTrading").Accounts[0];


Using this method I can get "BuyingPower" and "Name" variables.
But I want smth else: f.e. CurrentEquity variable . When I'm debuging my code I can see account.Fields.SyncRoot array, and in this array there are all variables that are possible to access from Broker software (and also on BrokerInfo tab). But when I've written account.Fields.SyncRoot[0]
or account.Fields.Item["CurrentEquity"] - I've recieved exception.

So the question is how to access REAL account variables. - or maybe in OQ there is another way to solve this problem ( smth like this : IsSynchronized = true; :) )


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 17, 2009 10:48 am 
Offline
Site Admin

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

Please, make sure that "CurrentEquity" field exists in account's fields.
But SyncRoot property comes from System.Collections.ICollection interface(.NET framework) and is not related to the broker info.

Regards,
Alex

_________________
SmartQuant Development Team


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 17, 2009 2:06 pm 
Offline

Joined: Mon Jul 27, 2009 3:28 pm
Posts: 24
Location: Ukraine
Ok, but how can I get Account variables? - For example cash? equity?
And what is about this screen? If there is now such property [SyncRoot] - why does it showed in VS debbuger?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 17, 2009 2:33 pm 
Offline

Joined: Mon Jul 27, 2009 3:28 pm
Posts: 24
Location: Ukraine
And also why BuyingPover = 0.0, when I have actually 100 000 on my account?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 17, 2009 2:40 pm 
Offline
Site Admin

Joined: Thu Jul 17, 2003 10:39 am
Posts: 1478
Code:
string value = account.Fields[field_name].Value;

there are no predefined field names in OQ, but each provider has its own fields. You are able to see available fields in Broker Info window(menu->View->Broker Info).

_________________
SmartQuant Development Team


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 17, 2009 2:42 pm 
Offline
Site Admin

Joined: Thu Jul 17, 2003 10:39 am
Posts: 1478
kot wrote:
And also why BuyingPover = 0.0, when I have actually 100 000 on my account?

Is your provider connected at the moment?

_________________
SmartQuant Development Team


Top
 Profile  
 
 Post subject: Screen
PostPosted: Thu Sep 17, 2009 4:46 pm 
Offline

Joined: Thu Jul 16, 2009 8:00 pm
Posts: 6
Screen where you can see that CurrentEquity really exists
but I can't get it


Attachments:
File comment: 1
Snap11.jpg
Snap11.jpg [ 88.61 KiB | Viewed 6368 times ]
Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 17, 2009 4:49 pm 
Offline

Joined: Mon Jul 27, 2009 3:28 pm
Posts: 24
Location: Ukraine
You also can see that
Code:
account.Fields["CurrentEquity"].Value;

Doesn't work.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 17, 2009 5:02 pm 
Offline
Site Admin

Joined: Thu Jul 17, 2003 10:39 am
Posts: 1478
Code:
string value = account.Fields["CurrentEquity", "USD"].Value;

_________________
SmartQuant Development Team


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 17, 2009 6:31 pm 
Offline

Joined: Mon Jul 27, 2009 3:28 pm
Posts: 24
Location: Ukraine
All works fine - thx Alex!


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