Go Back   Developer Program Forum > Sports API > Other

Other Other programming languages

Post Reply
 
Thread Tools Display Modes
  #21  
Old 04-18-2012, 06:07 PM
totally_skint totally_skint is offline
Member
 
Join Date: Feb 2010
Posts: 52
Default

OK here is another problem with gSOAP for botting purposes. Because it generates a lot of automatically named files which then get compiled along with the main application, I have come up against a serious problem that I do not know how to resolve simply. Because I want to use BOTH global and UK enchange services I have to run the gSOAP parser on 2 separate wsdl files. Now the output is written to the SAME file and so until I work out how to change this I am restricted to using either global OR exchange API calls within one application. There is probably a way of resolving this but I have officially given up now on gSOAP and will start from scratch and try and do it the good old fashioned way using hard coded XML and parsing responses. I hope that this serves as a warning to anyone coming here to use gSOAP as it seems you can get so far then hit a brick wall. Alternatively someone may actually know how to resolve the issue I have mentioned in which case gSOAP would be a very useful tool....
  #22  
Old 04-19-2012, 06:23 AM
AlgoTrader AlgoTrader is offline
Senior Member
 
Join Date: Mar 2012
Posts: 523
Default

Quote:
Originally Posted by totally_skint View Post
OK here is another problem with gSOAP for botting purposes. Because it generates a lot of automatically named files which then get compiled along with the main application, I have come up against a serious problem that I do not know how to resolve simply. Because I want to use BOTH global and UK enchange services I have to run the gSOAP parser on 2 separate wsdl files.
That's not a smart thing to do. UK and AUS difference is only georaphic location (api.betfair.com and api-au.betfair.com if I remember correctly).

You CAN modify autogenerated files to select one of two addresses. That's easy.

The problem is gSoap is really monstrous. It has megabytes of code and code quality is real shit:

Code:
Entry	**p, *q;
	if (table == (Table*)0)
		return (Entry*)0;
	for (p = &table->list; *p != (Entry*)0 && (*p)->next != (Entry*)0;
	     p = &(*p)->next);
	q = *p;
	*p = (Entry*)0;
	return q;
I can provide you C++ code for Qt that is kilobytes and support all the Betfair API calls I needed.

Code:
17.10.2011  23:24                44 BetfairApiStats.cpp
17.10.2011  23:24             1 028 BetfairApiStats.h
17.10.2011  23:24               903 BetfairCallback.cpp
17.10.2011  23:24               616 BetfairCallback.h
17.10.2011  23:24             5 491 BetfairDecoder.cpp
17.10.2011  23:24               596 BetfairDecoder.h
17.10.2011  23:24            12 477 BetfairDecompressor.cpp
17.10.2011  23:24               620 BetfairDecompressor.h
17.10.2011  23:24             4 357 BetfairEncoder.cpp
17.10.2011  23:24               667 BetfairEncoder.h
20.01.2012  15:01             7 085 BetfairExchangeService.cpp
20.01.2012  15:01             2 514 BetfairExchangeService.h
17.10.2011  23:24             2 196 BetfairGlobalService.cpp
17.10.2011  23:24               907 BetfairGlobalService.h
17.10.2011  23:24               357 BetfairHttpTransport.cpp
17.10.2011  23:24               540 BetfairHttpTransport.h
17.10.2011  23:24             6 783 BetfairInvocation.cpp
17.10.2011  23:24             1 506 BetfairInvocation.h
20.01.2012  15:01            23 627 BetfairSession.cpp
20.01.2012  14:59             3 835 BetfairSession.h
17.10.2011  23:24             3 697 BetfairStake.cpp
17.10.2011  23:24               445 BetfairStake.h
But if you need result but not C++ sex switch to simpler languages.

Last edited by AlgoTrader; 04-19-2012 at 06:25 AM
  #23  
Old 04-19-2012, 08:55 AM
totally_skint totally_skint is offline
Member
 
Join Date: Feb 2010
Posts: 52
Default

Yes I am giving up on gSOAP. I am sure it works IF you know exactly how to do it. I did try one more thing - you can run wsdl2h on multiple .wsdl files to get what you want but then you have to build with certain flags set to get it to link properly. In a nutshell it is no longer a C++ issue, it is an issue with wrestling with a 277 user guide to someone elses libraries that just seem too much hassle to use. I am sure that if you could be bothered to spend weeks on forums seeking the answer for the specific approach you want then gSOAP would be a good and reliable solution (it seems that people who get it working are ultimately happy with it). Since I am only wanting this for betfair purposes I will try and code it from the system socket level and hard code the API request xml messages by hand.
  #24  
Old 04-19-2012, 10:52 AM
AlgoTrader AlgoTrader is offline
Senior Member
 
Join Date: Mar 2012
Posts: 523
Default

Quote:
Originally Posted by totally_skint View Post
Since I am only wanting this for betfair purposes I will try and code it from the system socket level and hard code the API request xml messages by hand.
If you have a year of free time - you are welcome. Forget about sockets, manual XML stuff, etc, it is conter-productive

I maximally use third-party code and I use JavaScript. I use exellent HTTP libs instead of sockets, I use third-party XML parsers/generators, I use libs to do most of routine work. It took me two weeks to make a complete BF API solution.
  #25  
Old 04-19-2012, 02:54 PM
totally_skint totally_skint is offline
Member
 
Join Date: Feb 2010
Posts: 52
Default

Quote:
Originally Posted by AlgoTrader View Post
That's not a smart thing to do. UK and AUS difference is only georaphic location (api.betfair.com and api-au.betfair.com if I remember correctly).
But what else can I do?? wsdl2h acts on .wsdl files. Betfair has 3 wsdl files of which I am wanting to use just 2 (global and UKExchange) ?? Running this generates soapGlobalProxy and soapExchangeProxy classes of which I need to create instances of both if I want to get all the API functionality I need. I am getting to the point where I am tempted to stick with perl .My reasons for wanting to use c++ is that i know how to create multithreaded apps, but perl I dont know how to do threading. Also I am stubbourn and want to crack gSOAP as it has started to annoy me immensely.
  #26  
Old 04-19-2012, 03:59 PM
AlgoTrader AlgoTrader is offline
Senior Member
 
Join Date: Mar 2012
Posts: 523
Default

Quote:
Originally Posted by totally_skint View Post
My reasons for wanting to use c++ is that i know how to create multithreaded apps, but perl I dont know how to do threading. Also I am stubbourn and want to crack gSOAP as it has started to annoy me immensely.
Perl threading is pain. Perl asynchronous programming even bigger pain. It is easy for simple apps but no way to do complex parallel apps.
  #27  
Old 04-23-2012, 11:19 PM
totally_skint totally_skint is offline
Member
 
Join Date: Feb 2010
Posts: 52
Default

OK for anyone using gSOAP, I finally managed to build a simple app to access the API. The problem is that it doesnt work - I have 2 proxy classes (one for the BFGlobal wsdl and one for the UKExchange wsdl) but my program crashes if I create them both in the same scope!!! I can have one but as soon as I create the other - BANG. I am wondering if this is a OpenSSL issue. Has anyone experienced a similar issue at any stage?? In the meantime I am going to try and get something working using libcurl as I see that people have had success with that approach on Linux. It should not be this hard surely!!!!!!
  #28  
Old 04-23-2012, 11:55 PM
wotsisname wotsisname is offline
Senior Member
 
Join Date: Jan 2009
Posts: 214
Default

When I moved from Windows to Linux full time, I spent several months trying out new programming languages because I only knew VB6. I was keen to learn a "real" language and opted for C. As a learning project, I decided to re-write my betfair bots using gSoap. Several annoying weeks later, I decided to try C++ instead. About a month after that, I decided to go back to the "old" method of sending xml strings over http. I used gSoap (and still do) to generate the XML request files but delete all the other crap it generates. Even the http stuff seemed more difficult than it should be in C/C++, so I soon gave up on it.

I now program everything in Python and find it about 100 times more productive.

If I were you (or anyone else just starting out), I'd look hard at Node.js. It's a simple interface on top of a turbocharged C/C++ engine. And from what I can see, it allows for event-driven, non-blocking, async requests, so there is no need to use threading.
__________________
http://www.bespokebots.com

Last edited by wotsisname; 04-23-2012 at 11:59 PM
  #29  
Old 04-24-2012, 06:13 AM
AlgoTrader AlgoTrader is offline
Senior Member
 
Join Date: Mar 2012
Posts: 523
Default

Quote:
In the meantime I am going to try and get something working using libcurl as I see that people have had success with that approach on Linux. It should not be this hard surely!!!!!!
You like sex or you interested in results? If you use C++ I would strongly recommend using Qt or boost, they have http, xml and collections to use. The HTTP is 20% of the app. There are lots of XML stuff, parsing it into "easily" usable collections, convenient memory management and robust callbacks. C and C++ do not like amateurs. I think even C++ pros have headache writing bots in C/C++. Try node.js + betfair-sports-api. You can make your first bot in an hour.

Quote:
I now program everything in Python and find it about 100 times more productive.
That's a very strong exagerration. I think 3-5 times is more reasonable. My rough estimate is if I need two months to make a C++ bot then it will be two weeks using node+betfair-sports-api.

PS I would strongly suggest not to use gSoap, it is just a trouble maker
  #30  
Old 04-24-2012, 12:30 PM
totally_skint totally_skint is offline
Member
 
Join Date: Feb 2010
Posts: 52
Default

Yes I have given up on gSOAP. I was looking at the boost asio library today and that looks like it could be a way forward. Unfortunately I have to use C++ as all of my analysis and mathematical routines are written in C++ otherwise I would completely transer to another setup. Nevertheless, I will take a look at Node.js
Post Reply

Tags
betfari api c++

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 11:16 AM.


BETFAIR® and the BETFAIR LOGO are registered trade marks of The Sporting Exchange Limited. Data on Betfair website(s) (including pricing data) is protected by © and database rights. It may not be used for any purpose without a licence. © The Sporting Exchange Limited. All rights reserved.