SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Sun Sep 15, 2019 1:14 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Thu Sep 13, 2012 5:52 am 
Offline

Joined: Mon Feb 21, 2011 10:46 am
Posts: 48
Hi, I've been using a custom user provider in OQ for a while, and it works pretty well. Recently I've been trying to get it work in QR but failed.

My userProvider calls methods in a C++ dll file. Whenever I call a method (like connect) I get the following exception:

Image

But it all works fine in OQ. So I guess there's something different about UserProvider support between OQ and QR ?


Top
 Profile  
 
PostPosted: Thu Sep 13, 2012 11:47 am 
Offline

Joined: Wed Oct 08, 2003 1:06 pm
Posts: 833
Hi,

Are you using OQ 64bit version? Could you try to use your provider in OQ 32bit version? QR exists only in 32 bit version, so maybe your provider works fine in 64bit, but not in 32bit.

By the way, which version of QR are you using?

And finally perhaps it will be helpfull if you recompile your provider with QR libs.

Regards,
Sergey.


Top
 Profile  
 
PostPosted: Thu Sep 13, 2012 12:07 pm 
Offline

Joined: Mon Feb 21, 2011 10:46 am
Posts: 48
Thanks for the reply, Sergey.

1. Yes, I'm using OQ 32bit version.
2. QR version is 2.0.2
3. It sounds promising to recompile my code, but how to get it done "with QR libs"? In my project the only related reference is "OpenQuant.API.dll", from "OpenQuant\Bin" folder.


Top
 Profile  
 
PostPosted: Thu Sep 13, 2012 1:11 pm 
Offline

Joined: Wed Oct 08, 2003 1:06 pm
Posts: 833
Hi,

Please try to reference OpenQuant.API.dll located at C:\Program Files (x86)\SmartQuant Ltd\QuantRouter\Bin folder.

Regards,
Sergey.


Top
 Profile  
 
PostPosted: Thu Sep 13, 2012 1:30 pm 
Offline

Joined: Mon Feb 21, 2011 10:46 am
Posts: 48
Thanks,I'll try it. Another question about QR: if I use QR as an execution provider, and connect two or more brokers in QR, can I get all broker's position info in OpenQuant?


Top
 Profile  
 
PostPosted: Thu Sep 13, 2012 2:18 pm 
Offline

Joined: Wed Oct 08, 2003 1:06 pm
Posts: 833
Hi,

If you are talking about the Broker Info, then unfortunately it is not accessable in this configuration. But you will see all positions/transactions from both brokers in the Portfolio window as usually.

Regards,
Sergey.


Top
 Profile  
 
PostPosted: Thu Sep 13, 2012 2:31 pm 
Offline

Joined: Mon Feb 21, 2011 10:46 am
Posts: 48
Just tried recompiling using "OpenQuant.API.dll" in QuantRouter\Bin folder, still the same error:

Code:
System.InvalidOperationException: The Undo operation encountered a context that is different from what was applied in the corresponding Set operation. The possible cause is that a context was Set on the thread and not reverted(undone).
   at System.Threading.SynchronizationContextSwitcher.Undo()
   at System.Threading.ExecutionContextSwitcher.Undo()
   at System.Threading.ExecutionContext.runFinallyCode(Object userData, Boolean exceptionThrown)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteBackoutCodeHelper(Object backoutCode, Object userData, Boolean exceptionThrown)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbacks()


I've also debugged the exception, it occurs when my provider code is trying to access the C++ dll method, see the screenshot:

Image


Top
 Profile  
 
PostPosted: Thu Sep 13, 2012 3:14 pm 
Offline

Joined: Wed Oct 08, 2003 1:06 pm
Posts: 833
Could you install OQ 32bit, recompile the userprovider with its 32bit libs and try the provider into OQ 32bit?

Regards,
Sergey.


Top
 Profile  
 
PostPosted: Thu Sep 13, 2012 7:46 pm 
Offline

Joined: Mon Feb 21, 2011 10:46 am
Posts: 48
I've tried rebuilding my provider in 32bit windows, 32bit OpenQuant. The problem still persists.

The provider is writen in C#, but it uses DllImport to import a native dll, like

Code:
   public void Connect() { connect(this.FrontAddr); }
   [DllImport(strDllFile, EntryPoint = "?Connect@@YAXPAD@Z", CallingConvention = CallingConvention.Cdecl)]
   static extern void connect(string pFrontAddr);


and the exception is throwed on Connect(). But like I said, it works fine in OQ.


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