SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Thu Sep 19, 2019 7:18 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Mon Apr 08, 2019 7:07 am 
Offline

Joined: Thu Dec 06, 2018 1:57 am
Posts: 28
I would like to use the SmartQuant.IB.dll in my strategy so that I can do something like this:

ITBWS ibtws = (IBTWS)ProviderManager.GetProvider("IB")
ibtws.Host = "10.1.2.14"
ibtws.Port = 3124
ibtws.WhatToShow = "BID"

I need to set these properties dynamically, so setting them manually from the GUI is not an option. However QuantTrader's reference and my strategies reference to SmartQuant.IB.dll are different, so this exception is thrown. What can I do?

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidCastException: [A]SmartQuant.IB.IBTWS cannot be cast to [B]SmartQuant.IB.IBTWS. Type A originates from 'SmartQuant.IB, Version=1.0.7026.31158, Culture=neutral, PublicKeyToken=null' in the context 'Default' at location 'C:\Program Files\SmartQuant Ltd\QuantTrader 2014\SmartQuant.IB.dll'. Type B originates from 'SmartQuant.IB, Version=1.0.7026.31158, Culture=neutral, PublicKeyToken=null' in the context 'LoadFrom' at location 'C:\Users\Quant\Documents\QuantTrader 2014\Packages\MyStrategy!\MyStrategy\SmartQuant.IB.dll'.
at OpenQuant.RealTime.Run()
at OpenQuant.Program.Main(String[] args)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at QuantTrader.SolutionRunner.Run(Object obj)


Top
 Profile  
 
PostPosted: Mon Apr 08, 2019 10:35 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 497
Hello abasqd,
I tested several references and they are working properly after exporting to QT2014.

I can advise following:
Check that version of SmartQuant.IB are same in OQ2014 and in QT2014.
If not, copy SmartQuant.IB.dll from OQ2014 folder to QT2014 folder.
Try start your solution.

Additionally you can check version of SmartQuant.IB.dll in package folder in My docs.
It should be same as in QT2014. You can try to replace older version to newer.


Top
 Profile  
 
PostPosted: Tue Apr 09, 2019 10:32 am 
Offline

Joined: Thu Dec 06, 2018 1:57 am
Posts: 28
If you read the error message carefully you will find that both SmartQuant.IB dlls are of the same version: Version=1.0.7026.31158. As I understand the exception, the problem arises because the two dll's come from two different directories.

While exporting my strategy from OpenQuant, if I set a reference to a dll in the QuantTrader Program Files (to ensure same version), this reference is overwritten and set to C:\Users\Quant\Documents\QuantTrader 2014\Packages\MyStrategy!\MyStrategy\SmartQuant.IB.dll after the package is loaded in QuantTrader.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 2 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:  
cron
Powered by phpBB® Forum Software © phpBB Group