Announcement

Collapse
No announcement yet.

Next version of the Betfair API - JSON

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Next version of the Betfair API - JSON

    Hi All,

    I have created a private google group to manage any collaborators and contributions on the next version of the Betfair Ruby Gem.

    In addition we will also be building a new SDK to utilise the gem and build trading/betting bots with possibly a web based interface to create and manage these.

    Also trying to create a Ruby community thing within this wider Betfair Developers Community.

    If you are a Rubyist and wish to get involved either ask for an invite via


    or email me

    lukeb at lukebyrne dot com

    Hope to get some more collaborators.

    Cheers,

    Luke

  • #2
    The new Betfair API will open several new prospects that could be difficult or impossible before.

    Point one. Using SOAP V6 API without a library was a difficult thing. Now I need no "library" to access BF. The Betfair python examples show how to use a new API in library-less style. What the library do is just adds "jsonrpc":"2.0", "id":something, "method" : "xxx" and adds two HTTP headers - X-Application and X-Authenticate. Lib is still convenient to forget that stuff but a lib is a thin layer now and can be done in a couple of days with a single guy.

    Point two. To make a Betfair web application there is no need in PHP, Ruby, Python or Perl. One needs just browser, HTML and JavaScript. Browser can connect to Betfair itself and invoking any call is a couple of lines in JavaScript. No intermediate server needed.

    How to connect BF from browser's HTML:
    Code:
    $.ajax("https://beta-api.betfair.com/json-rpc", 
       { type:"POST", 
          headers: {"X-Application":"xxx", "X-Authentication":"yyy"},
          data: {jsonrpc:"2.0", id:nextid++, method:"name", params: {...} }
    }).done( function() {
       // result handler
       alert("Invocation is done");
    }) ;
    Using $.ajaxSetup we can put pretty static headers that are common among all the calls.

    My understanding is we can say goodbye to server coding completely for BF web applications. New BF API can be treated as AJAX service, JSON is a native JavaScript format. In fact, JSON is nothing but a serialized JavaScript object and no language understands JSON better than JavaScript.

    Yes, I am the author of Betfair lib too, but I do aware the value of our work is much devaluated
    Last edited by AlgoTrader; 21-12-2012, 10:15 AM.
    Betfair Bots Made Easy
    https://github.com/AlgoTrader/betfair

    Comment


    • #3
      Hi Luke

      I'm interested, will email you.

      Best

      Chris

      Comment


      • #4
        Hi Chris,

        Have I added you to the group yet?

        Cheers,

        Luke

        Comment


        • #5
          Not sure what kind of SDK you were talking about. If it's something like
          session.placeOrders(...);
          Then it is pretty out of interest.

          I desperatly need SDK with functions like this:
          market.getSelectionThatWillWin();
          market.getTrueProbabilityForSelection(selectionId) ;

          To be serious, the problem is everybody discuss API details but nobody discuss trading strategies and secrets. I think, nobody wants to discuss trading secrets.

          My Christmas trading secret: in the old SOAP API we have no selectionIds in getAllMarkets response. When placing 1.01 we need do it really fast. Invoking getMarket or getMarketProfitAndLoss is 10-15ms at best. I use RAM cached database (redis) to map selection names into selection ids, so it takes ~1ms to get the selectionIds for the selection names (extracted from getAllMarkets's menuPath). Fortunately the new API has no such problems.
          Betfair Bots Made Easy
          https://github.com/AlgoTrader/betfair

          Comment


          • #6
            Hi Luke.

            Yes thanks.

            Best

            Chris

            Comment


            • #7
              Please stop posting off topic

              Dear AlgoTrader,

              You will notice that the topic of this thread is for people who are interested in Ruby and developing things for the Betfair API using Ruby.

              I applaud the efforts in your Node work for the Betfair API, I have looked at your code base and it looks good (although I know nothing about Node, and no, that isn't an invitation to tell me the virtues of it).

              Your wiki is a little lacking towards the end on the topics are the most interesting to people, such as placing and cancelling bets.


              If you look at the "SDK" https://github.com/lukebyrne/betfair_sdk (I have loosely called it that because I didn't know what else to call it) I have provided code on how to create bots using the Ruby Betfair Gem that quite a few of the Ruby community on this forum helped with.

              I provided a couple of obvious ones such as "Lay the Favourite". It might not be great but it has helped some people getting into Betfair botting and provided off forum discussion about botting strategies.

              I am definitely interested in your Node implementation if there is at least one simple bot I could implement and play around with, perhaps the 'Lay the Favourite' for example.

              Please note this isn't an a slight or criticism towards you or your work, nor a request for more info on the number milliseconds it takes to implement a keepAlive request 4000 times. Just a simple man's observations.

              If I can provide some guidance on my experience in trying to get some take up for your work within this forum (and in turn get the trading tips and SDK methods you so desperately desire):

              1. Provide some solid examples of how to implement your API code with a simple bot
              2. Foster relationships with people who are interested in the language you program in, its too hard
              to try and convert people.
              3. Stay on topic in threads and don't interject unless its absolutely necessary. If necessary add to the conversation rather than trying to steer it towards discussion of your library

              I wish you all the best for the New Year and your botting success on Betfair.

              Kind regards,

              Luke

              PS - You are welcome to come to Ruby if you like, its awesome!

              Comment


              • #8
                I absolutly have no desire to bring happiness to the people around the world. I also don't care how many people use Node.js and how they succeed. I just do what I need and share it with the community. There is no point in promoting the free lib. Why to care about? The Betfair API for Node.js will never bring me any money. Python, Ruby, Node.js, perl - they all quite good for building simple Betfair apps and technology is out of interest. Placing bets is easy. The new Betfair API is even much easier. What is difficult is to build an app that makes bets and increase the balance.

                PS What is the purpose of your attemts of building the community? I have 27 stars in github, I won't cry if I had zero, I won't be happy If I had a thousand. The stars mean nothing. The exchange does not care if I have huge IQ, prestigeous university or exellent programming skills. What I learned from trading is that it does not matter what I think about myself, it does matter what number is there in availableBalance field
                Last edited by AlgoTrader; 28-12-2012, 09:58 AM.
                Betfair Bots Made Easy
                https://github.com/AlgoTrader/betfair

                Comment


                • #9
                  As to Ruby. I am a technology unopinionated guy. I am not interested in programming itself, I need things done.

                  API stuff is simple, we have dozens of libs in a dozen of languages. Five years ago I thought that if I had a robust library I could easily build a bot. Oops, nothing can be further from truth. I now have an exellent lib, emulator and I know API with great details. And I still have troubles with stable profit.

                  PS I like Ruby, it's a good language.
                  Last edited by AlgoTrader; 28-12-2012, 09:42 AM.
                  Betfair Bots Made Easy
                  https://github.com/AlgoTrader/betfair

                  Comment


                  • #10
                    Originally posted by AlgoTrader View Post
                    I desperatly need SDK with functions like this:
                    market.getSelectionThatWillWin();
                    market.getTrueProbabilityForSelection(selectionId) ;
                    I'll put it on the backlog. No promises on when we'll be able to deliver that feature though.

                    Comment


                    • #11
                      I'm trying to connect with socket using websocket event machine. Here is the connection code

                      ws = WebSocket::EventMachine::Client.connect('stream-api.betfair.com:443')

                      But getting an error with status code 1002

                      Anyone please help.

                      Thanks.
                      Last edited by Streaming; 16-12-2018, 11:11 AM.

                      Comment

                      Working...
                      X