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

IB Provider - questions allocation profiles
http://www.smartquant.com/forums/viewtopic.php?f=86&t=14680
Page 1 of 1

Author:  mikembb [ Thu Jan 12, 2017 4:17 pm ]
Post subject:  IB Provider - questions allocation profiles

Dear Team,

I have a few specific questions regarding the usage of the IB provider:
1.) If I want to change the monitored account from the IB execution provider during live trading, how could I do that? I tried with this:
Code:
var accountDataEntry = AccountDataManager.GetSnapshot(IB.Id, IB.Id);
but then I only get the same account. And I cannot find a way, to change the monitored account.
2.) If I want to change the default allocation account when I am trading live, how can I do that? Or can you direct me in the direction on how I could accomplish, what I tried in OQ2013 like this:
Code:
Order Test = MarketOrder(Instrument,OrderSide.Sell,0)
Test.IB.FaGroup = "All";
TestI.IB.FaProfile = "50all";

But I currenlty cannot see a way to access the provider properties from IB via the order properties.

Thanks for your support.
Mike

Author:  mikembb [ Thu Jan 19, 2017 12:19 pm ]
Post subject:  Re: IB Provider - questions allocation profiles

can anybody help with this?

Author:  skuvv [ Thu Jan 19, 2017 1:06 pm ]
Post subject:  Re: IB Provider - questions allocation profiles

Hello Mike,
try this solution:
Attachment:
IB_settings.zip [3.56 KiB]
Downloaded 266 times


ps don't forget check the reference for IB library.

Author:  mikembb [ Thu Jan 19, 2017 1:33 pm ]
Post subject:  Re: IB Provider - questions allocation profiles

thanks. works like charm and I get the concept.

But I cannot transpose that concept onto my question number 2: how could I cahnge this per Order?

Or would I need to, once I generated the order, attach/assign an instance of a provider to that order?

Any ideas? Can you post some demo code?

thanks in advance
Mike

Author:  skuvv [ Thu Jan 19, 2017 2:02 pm ]
Post subject:  Re: IB Provider - questions allocation profiles

2) This feature not implemented in OQ2014.

Author:  mikembb [ Thu Jan 19, 2017 2:35 pm ]
Post subject:  Re: IB Provider - questions allocation profiles

you knew I was going to ask this:
any idea if you will implement it in the future?

If so, any idea for a timeline?

So, basically, you say for every account, I should have an instance of OQ running, until this is implemented, right?

Author:  mikembb [ Wed Mar 22, 2017 8:27 pm ]
Post subject:  Re: IB Provider - questions allocation profiles

Dear Team,

now, I tried to apply your concept to a live setup.

I have two IB TWS running. One listens on port: 7496 and the other on port 7495. I have OQ set to the port 7496.

Now, when I try to implement your code in your sample and add:
Code:
 
ib.Port = 7495;
ib.ClientId = 42;
ib.Connect();


at the end. Then I run my strategy, I can see, in the OQ GUI after IB provider connected, that I the changes have been made in the gui, but OQ still connects to the IB TWS port 7496. So the wrong TWS for this strategy.

It seems like, that for the connect, OQ still uses the old settings and not the new settings which I have set programmatically.

Any idea what the reason might be?

Regards
Michael

Author:  skuvv [ Mon Apr 10, 2017 1:24 pm ]
Post subject:  Re: IB Provider - questions allocation profiles

I reproduced your scenario and it works correctly for me.
Both instances of OQ2014 are connected to their TWS:
Attachment:
IBx2.png
IBx2.png [ 269.32 KiB | Viewed 6381 times ]

Author:  mikembb [ Wed Jul 04, 2018 2:57 pm ]
Post subject:  Re: IB Provider - questions allocation profiles

Dear Team,

when I have these two IB providers connected, do you see any solution, on how I can get a snapshot for each one of those?

Currently, when I use:
Code:
 AccountDataManager.GetSnapshot(DataProvider.Id)

I only have the option, to specify an id or a route. Though, since I have setup my own instance of a provider, could you implement a feature for AccountDataManager.GetSnapshot so that I could provide the instance of that provider with it?

Or is there another way, when I have two instances of a provider on how to specify from which provider I will get the account value?

Thanks for your support.
Mike

Author:  skuvv [ Fri Jul 06, 2018 11:47 am ]
Post subject:  Re: IB Provider - questions allocation profiles

In case of several instances of provider they all will send AccountData to AccountDataManager and to all strategies.
I suppose that account name will be unique and you will be able to process AccountData by AccountName.
So AccountDataManager.GetSnapshot() should return total snapshot with all accounts from all instances of IB.
Or you can subscribe strategy to event OnAccountData to retrieve it by events.

Author:  mikembb [ Mon Jul 09, 2018 11:40 pm ]
Post subject:  Re: IB Provider - questions allocation profiles

great, that works!

for people who also need to get this done, please use:
AccountDataManager.GetSnapshots()

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