Calculate Hedge Stake

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DrKanye
    Junior Member
    • Oct 2015
    • 12

    #1

    Calculate Hedge Stake

    Hello im trying to write a function which calculates the correct lay stake unfortunately I have it working however it doesn't correctly take into account the commission. Can anybody help?

    Code:
            static public double CalculateHedgeLayStake(double backOdds, double layOdds, double backAmount = 1.0f, double backComission = 5.0f, double layComission = 5.0f)
            {
                double backComissionDecimal = backComission/100.0f;
                double layComissionDecimal = layComission/100.0f;
    
                double backWin = ((backAmount * (backOdds - 1.0f)) * (1.0f - backComissionDecimal));
                double layWin = backAmount * (1.0f - layComissionDecimal);
    
                double backLose = -backAmount;
                double layLose = backAmount * (layOdds-1.0f);
    
                double betWins = backWin - layLose;
                double betLoses = layWin - backLose;
    
                return backAmount + (betWins / layOdds);
            }
  • Franklin1
    Junior Member
    • Mar 2012
    • 91

    #2
    What's comm got to do with it?!

    Code:
     static public double CalculateHedgeLayStake(double backOdds, double layOdds, double backAmount = 1.0f)
            {
                return backAmount * backOdds / layOdds;
            }

    Comment

    • DrKanye
      Junior Member
      • Oct 2015
      • 12

      #3
      Because if you don't include commission you will end up losing on one side more than the other??

      Comment

      • Franklin1
        Junior Member
        • Mar 2012
        • 91

        #4
        Because if you don't include commission you will end up losing on one side more than the other??
        I understood your definition of 'correct lay stake' as: the stake needed to lay off a back bet so that you make the same profit or loss for any outcome

        If you make the same profit or loss for any outcome then you'll pay the same commission on all 'sides'/ outcomes

        Comment

        • DrKanye
          Junior Member
          • Oct 2015
          • 12

          #5
          Originally posted by Franklin1 View Post
          I understood your definition of 'correct lay stake' as: the stake needed to lay off a back bet so that you make the same profit or loss for any outcome

          If you make the same profit or loss for any outcome then you'll pay the same commission on all 'sides'/ outcomes
          Hey franklin yeah! You are right.

          What if the back and lay have different commission rates though? Like if i back on a bookies!

          Does this matter?

          Cheers

          Comment

          • Franklin1
            Junior Member
            • Mar 2012
            • 91

            #6
            if legs are on different markets / exchanges / bookies then everything changes.

            I would probably just base my work on odds net of commission.

            NetOdds = 1 + (ScreenOdds-1)*(1-commRate)

            If you use these then the previous formula I gave will be correct.

            Betfair comm gets much more complicated if you bet on more than one runner-side (bay or lay) in a market.
            Last edited by Franklin1; 18-10-2015, 06:59 PM. Reason: fix

            Comment

            • JayBee
              Junior Member
              • Oct 2010
              • 114

              #7
              Originally posted by DrKanye View Post
              Because if you don't include commission you will end up losing on one side more than the other??
              Not so. Commission is only paid on the profit.

              So long as your position is in profit then only a commission of more than 100% is going to leave you out of pocket.

              If your position is a losing one then there is no commission to pay. Leave commission out of your calculations.

              Read http://www.betfairprotrader.co.uk/20...fair-bots.html for an explanation of greening algorithms.

              Comment

              Working...
              X