softwarespartan / IB4m

Interactive Brokers API for Matlab
GNU General Public License v2.0
62 stars 21 forks source link

Integration in a standalone app #41

Open Mark91P opened 5 years ago

Mark91P commented 5 years ago

Hi Abel, I want to integrate the api in a standalone app that I would like to deploy in a separate computer that doesn't have matlab on it. After few tests I wasn't able to do that, not even copying the api folder in the deployment folder and adding manually via code the paths for the api (like the installation quickstart guide). Is there a agile way to do that? Thanks again! Marco

softwarespartan commented 5 years ago

Ya, exporting in this way is problematic. Better to compile matlab code to java and just embed into java application where you can just use IB API directly

On Thu, Oct 18, 2018 at 5:37 PM Mark91P notifications@github.com wrote:

Hi Abel, I want to integrate the api in a standalone app that I would like to deploy in a separate computer that doesn't have matlab on it. After few tests I wasn't able to do that, not even copying the api folder in the deployment folder and adding manually via code the paths for the api (like the installation quickstart guide). Is there a agile way to do that? Thanks again! Marco

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/softwarespartan/IB4m/issues/41, or mute the thread https://github.com/notifications/unsubscribe-auth/AEWq1C7_8pYUv2BP33BGvgcprz9gf-jWks5umJIkgaJpZM4Xtlgg .

Despair2000 commented 5 years ago

Hi Mark91P,

I tried this also in many ways but could never make it work. I could call the functions from the jar-file (you have to include a file javaclasspath.txt with the path of the jar-file when compiling) and I saw the API returning the requested data in the log-file of IB gateway but the data never made it to my buffer for further processing.

quebien90 commented 3 years ago

Hi Abel, Despair, I was wondering, whether you have made progress in that direction. I made an app that collects and stores scanner information, which i now would like to run standalone using matlab compiler. As Despair, I managed to actually get the responses from IB (gateeway log) but they do not make it to the buffers. Some issues with the java.util.concurrent.ConcurrentHashMap ... I run the .exe in "testing-mode" and get following cmd error: image To embed it into a java application as suggested above is a bit too much for me at the moment, for I have not done that yet, so ... Does anybody knows the trick to get this straightforward approach working yet? Thank you for your advice!

Ya, exporting in this way is problematic. Better to compile matlab code to java and just embed into java application where you can just use IB API directly On Thu, Oct 18, 2018 at 5:37 PM Mark91P @.***> wrote: Hi Abel, I want to integrate the api in a standalone app that I would like to deploy in a separate computer that doesn't have matlab on it. After few tests I wasn't able to do that, not even copying the api folder in the deployment folder and adding manually via code the paths for the api (like the installation quickstart guide). Is there a agile way to do that? Thanks again! Marco — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#41>, or mute the thread https://github.com/notifications/unsubscribe-auth/AEWq1C7_8pYUv2BP33BGvgcprz9gf-jWks5umJIkgaJpZM4Xtlgg .

Despair2000 commented 3 years ago

Hi quebien90,

I have no new information regarding this since the original post. Sorry....

quebien90 commented 3 years ago

Thank you for your answer! I'ts just that I feel like it must be possible, specially since the request direction is working. Also, matlab doc suggests it is possible to add .jar packages to a compiled system, not even a need to call javaaddpath. But alright, I will report in case of success one day ^^.

softwarespartan commented 3 years ago

This is strange exception. Not clear what's causing the exception. I looked at the code for this and it looks OK.

Just to confirm, you get this exception when deploy the code in stand-alone app? Does this same exception occur for the same use-case in typical matlab setting?

quebien90 commented 3 years ago

Thank you for your reply! Yes, this exception only appers in stand-alone. Since then I have tried different compile configurations in a try-and-error fashion. Within the application compiler one must declare which files "are required" for the application to run and which files "shall be installed" for the deployed app. In my opinion, the most logical configuration would be to add your IB4m folder without the .jar as "required to run" and the .jar as "install for deployed app". - Does not work ^^ Even though the described error message does not appear anymore, the listeners still do not register any java events. After some research I came to the conclusion that I probably will have to modify and include the classpath file to make sure the .jar does not end up in the dynamic but in the static java path. Apparently this fixes all kinds of "strange behaviour". When I get the chance I will try that and report.

Despair2000 commented 3 years ago

I don't think that the problem is that the application doesn't find the jar-file. You can issue all commands which would cause error messages if the jar-file wasn't available. The commands are working and the API also receives them and returns the requested data as you can see in the API-log. The problem is just that the data doesn't end up in the buffer.

quebien90 commented 3 years ago

I remember reading about a similar issue that could be solved like this. But I agree, it's a long shot.

softwarespartan commented 3 years ago

I've added a modified jar file in the repo "Jar" folder with "_SA" for standalone. Can you please try this out in your standalone application and let me know the result. Note I can not test this since I don't have the tools to build matlab stand alone apps. This updated jar file has modified call into Matlab that might be why events do not show up in standalone build. If this does not work there is one more modification that we can try that might be root cause. Keep me posted.

quebien90 commented 3 years ago

Thank you for your efforts! I tested your modification. I verified the standalone version uses the _SA jar. Unfortunately, as before, while I do see the scanner results in the Gateway log, the events still do not arrive ... There are no errors or exceptions either. I can't wait to test your next modification!

softwarespartan commented 3 years ago

OK, there is new updated jar for "_SA". Let me know how it works out

quebien90 commented 3 years ago

So it looks like we are one step further because I get an error on each received response! Everytime the Gateway shows received scanner data, the standalone app throws following error message: image

Any ideas?