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

SmartQuant.IB.dll not useable from QuantTrader
http://www.smartquant.com/forums/viewtopic.php?f=60&t=14901
Page 1 of 1

Author:  abasqd [ Mon Apr 08, 2019 7:07 am ]
Post subject:  SmartQuant.IB.dll not useable from QuantTrader

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)

Author:  skuvv [ Mon Apr 08, 2019 10:35 am ]
Post subject:  Re: SmartQuant.IB.dll not useable from QuantTrader

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.

Author:  abasqd [ Tue Apr 09, 2019 10:32 am ]
Post subject:  Re: SmartQuant.IB.dll not useable from QuantTrader

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.

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