Sample Codes or DLL to do HTTP Post/Get

Questions about MultiCharts and user contributed studies.
meo
Posts: 26
Joined: 23 Apr 2012
Has thanked: 3 times
Been thanked: 1 time

Sample Codes or DLL to do HTTP Post/Get

Postby meo » 22 Mar 2014

Hi, does anyone here have code samples that allow me to make HTTP call to my webserver? Thanks!

meo
Posts: 26
Joined: 23 Apr 2012
Has thanked: 3 times
Been thanked: 1 time

Re: Sample Codes or DLL to do HTTP Post/Get

Postby meo » 29 Mar 2014

Willing to pay for a DLL to do it. Any interested coders, do let me know. Thanks

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: Sample Codes or DLL to do HTTP Post/Get

Postby Andrew MultiCharts » 31 Mar 2014

Willing to pay for a DLL to do it. Any interested coders, do let me know. Thanks
Hello meo,

Please contact us at support@multicharts.com with details, so we can evaluate such project for you.

meo
Posts: 26
Joined: 23 Apr 2012
Has thanked: 3 times
Been thanked: 1 time

Re: Sample Codes or DLL to do HTTP Post/Get

Postby meo » 05 Apr 2014

Hi Andrew,

Thanks for the reply. I have actually created a DLL myself using VS10.

The DLL basically makes a HTTP request to my own webpage. Code works fine when called from another C++ application.

However when I call it from my powerlanguage script, there is a connection refused error. Is there any restriction in MultiCharts to prevent HTTP call?

Thanks a lot!

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: Sample Codes or DLL to do HTTP Post/Get

Postby Andrew MultiCharts » 07 Apr 2014

However when I call it from my powerlanguage script, there is a connection refused error. Is there any restriction in MultiCharts to prevent HTTP call?
There is no restriction in MultiCharts to prevent HTTP call.

meo
Posts: 26
Joined: 23 Apr 2012
Has thanked: 3 times
Been thanked: 1 time

Re: Sample Codes or DLL to do HTTP Post/Get

Postby meo » 07 Apr 2014

I tried running other functions on the dll and the results is returned correctly to my MultiCharts code.
The "connection refused" error pops up when it ran my HTTPGet function. My DLL makes a call to an external POCO library which provides the HTTP request implementation.

Could I have missed out something? I am running 64 bit MultiCharts. DLL is created for 64bit.

Thanks

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: Sample Codes or DLL to do HTTP Post/Get

Postby Andrew MultiCharts » 08 Apr 2014

Please send us a simple example of code using the file, and the .dll to support@multicharts.com

User avatar
PatrickSocal
Posts: 58
Joined: 27 Apr 2013
Location: San Diego, CA
Has thanked: 23 times
Been thanked: 30 times

Re: Sample Codes or DLL to do HTTP Post/Get

Postby PatrickSocal » 14 Oct 2014

Hi Meo and Andrew,

Did you ever get this working? I'd be interested in using it, or helping debug it if necessary.

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: Sample Codes or DLL to do HTTP Post/Get

Postby Andrew MultiCharts » 15 Oct 2014

Did you ever get this working? I'd be interested in using it, or helping debug it if necessary.
Hello PatckSocal,

Meo used workaround for the problem by having the DLL calling an executable which does the HTTP request.

meo
Posts: 26
Joined: 23 Apr 2012
Has thanked: 3 times
Been thanked: 1 time

Re: Sample Codes or DLL to do HTTP Post/Get

Postby meo » 15 Oct 2014

Yup haha I took the lazy and not so elegant solution. Was trying to get some system testing to work fast then. If you can do a direct call, do share your code with us :)

User avatar
PatrickSocal
Posts: 58
Joined: 27 Apr 2013
Location: San Diego, CA
Has thanked: 23 times
Been thanked: 30 times

Re: Sample Codes or DLL to do HTTP Post/Get

Postby PatrickSocal » 15 Oct 2014

Hmm... sounds like there was something tricky that didn't work. Do you remember if you were using blocking or non-blocking sockets in your HTTP calls? My first thought is that you want the non-blocking ones.

Also... do you remember what external .exe you used to make it work?

My interest comes from a different reason... I want to monitor the health of our automated trading systems using an external server, so it can alert us if we have problems with 1) any of the strategies, 2) the MultiCharts application(s) or 3) the trading server itself. I've found a nice cloud-hosted server-monitoring service, and they have a RESTful API for submitting regular updates, using HTTP Post calls. I'd like my strategies to be able to use it.

Perhaps that deserves a separate thread of its own. Would you be interested in something like that?

meo
Posts: 26
Joined: 23 Apr 2012
Has thanked: 3 times
Been thanked: 1 time

Re: Sample Codes or DLL to do HTTP Post/Get

Postby meo » 16 Oct 2014

Hi Patrick,

I am not too sure on what type of socket I used as used a POCO library to make the calls.

I created a exe from Visual Studio using c++ to use the POCO http library/ Not special exe.

I did something similar previously but not on Multicharts where my strategy writes periodically to my web server. And I have a cron job running there which checks if its being regularly updated. If it is, everything is good. If not it will send an email to alert me. Ya you will need to have Multicharts make calls to your server for that to work. I don't have immediate need for it now but I am sure I will in the very near future.

User avatar
PatrickSocal
Posts: 58
Joined: 27 Apr 2013
Location: San Diego, CA
Has thanked: 23 times
Been thanked: 30 times

Re: Sample Codes or DLL to do HTTP Post/Get

Postby PatrickSocal » 16 Oct 2014

I see... it sounds like you've thought through some of these things too.

I just started a topic on system health monitoring, where I list the ways an ATS can fail and try to come up with a framework to detect and alert them all.

If you're interested, have a look: viewtopic.php?f=1&t=47391

Perhaps this can make MC and MC.NET more suitable for professional & institutional autotrading.


Return to “MultiCharts”