Cash out function in API-NG?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • coinfreezer
    Junior Member
    • Mar 2014
    • 2

    #1

    Cash out function in API-NG?

    Hi,

    When placing a bet on a football match and it gets matched, the website offers the function to view the current market of the bet and a "Cash out" button which let's you take money earlier before the bet result is final.

    I am trying to replicate this feature from the API but cannot find the correct method. I tried using the cancelOrders method but it seems to work only when the bet is still unmatched.

    I would really appreciate any feedback about this and guidance on how to achieve the "Cash out" feature from the API-NG.

    Thanks in advance!
  • betdynamics
    Junior Member
    • Sep 2010
    • 534

    #2
    There is no "cash-out" function in the API.

    You need to calculate the required bets to cash-out of your current position yourself and then submit the bets to the Exchange.

    Try Googling for "Green Up Calculation" or "Trade out of an existing position on Betfair" (or something like that) to see if you can find out more details.

    Comment

    • AlgoTrader
      Junior Member
      • Mar 2012
      • 243

      #3
      "Green-up" is rather silly name, it can be also "Red-up" if no profit possible.

      The equation is:

      player1Balance + Size*(player1CurrentPrice-1) = player2Balance - Size

      Solving the equation for size we got

      Size = (player2Balance - player1balance)/player1Price

      For example p1Balance=0, p2Balance=100, p1BackPrice=1.10 then size=(100-0)/1.10=90.91

      we will got
      player1: 0+90.91*(1.10-1) = 9,09
      player2: 100-90.91 = 9,09

      You need to solve equation twice for back and lay prices, for lays signs are changed from plus to minus and vice versa.
      Betfair Bots Made Easy

      Comment

      • coinfreezer
        Junior Member
        • Mar 2014
        • 2

        #4
        Thanks for your reply.

        I am quite a newbie with the Back/Lay betting system so I would appreciate a Cashout example in the following scenario:

        When the match Barcelona vs Real Madrid starts, I place a bet of Eur10 on the draw with odds 2.5. After 30 minutes, a Real Madrid player gets a red card so I would like to immediately cashout to stop risking Eur10 and at least recover some Euros back.

        How would I perform this from the API without using the Cashout feature in the website?

        Thanks a lot in advance.

        Comment

        • betdynamics
          Junior Member
          • Sep 2010
          • 534

          #5
          Originally posted by AlgoTrader View Post
          "Green-up" is rather silly name, it can be also "Red-up" if no profit possible.
          That is true, but I was only trying to point at the right direction for Googling the response, so the "red-up" element was immaterial.

          Comment

          Working...
          X