Author Topic: test mode- why are bets matched more slowly in test mode than in real mode  (Read 9894 times)

Tags:
  • All members
  • Posts: 15
Have you ever wondered why bets placed in test mode are matched more slowly than in real mode?

In a nutshell
Test Mode is comparing Back and Lay prices against the unmatched bet whereas it could be checking Last Traded Price and volume and Market Volume.The latter would give more accurate results.

Check out the following scenario

Lets say you back a fav for $100 @ 2
in the following market.
                                     1.9 1.96 1.98  2.02 2.04 2.1 (back_price3 - lay_price3)
  volume =.80  last_traded = 1.98 market_volume = $100


1 refresh after bet placed the market reads
                                     1.9 1.96 1.98  2.02 2.04 2.1 (back_price3 - lay_price3)
  volume =.80  last_traded = 2 market_volume = $200

in Test Mode the formula is
                            back_price < bu_price
                              1.98         <  2.00               = bet unmatched

in Real MODE the formula is
                              last_traded  >= bu_price
                                2                >=   2             =bet matched
                   
     How much is matched?
      the formula is
                    *assuming a $1 back bet generates $1 of market volume

         (market_volume*volume -market(previous)*volume(previous)   
                           
                          ($200* .8)       -                    ($100*.8)
                            $160            -                           $80                          = $80

 so matched amount (bm_backa) = 80, and unmatched amount (bu_backa) =20
           

several refreshes later the market price leaps above 2 ...
the market reads
                                     2 2.04 2.1  2.12 2.2 2.3 (back_price3 - lay_price3)
  volume =.80  last_traded = 2.12 market_volume = $400

in Test Mode the formula is
                            back_price > bu_price
                              2.1           > 2.00               = bet matched @ back_price
                             
AT 2.1 back_price !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 this is a mega serious bug with Test mode.
    As the bet was placed before the market reached 2.1 (back_price)
        the matched price should be 2  (bu_backp)

        Applying a formula involving (now_time>bu_backtime = bu_price) will correct this error but for now be aware that the test program generates false profits.
       

In Real Mode
                  MAXV(back_price,last_traded) > bu_price
                                MAXV(2.1,2.12)          >  2
                                                   2.12        >  2
AND       
    market_volume*volume - market_volume(prev)*volume(prev) >bu_backa       
            400*.8                    -                        200*.8                        > 20
             320                        -                         160                            > 20
                                    = bet matched.

So that's  why.


Happy punting.
Apples999.

(Note:The same with lay bets also)

In real mode the formula is
                      last_traded = bu_backprice  







  • Tim Vetrov
  • Administrator
  • Posts: 4875
  • Gender: Male
*
Let me explain how the test mode works and how MF pro simulates the exchange.
It supposes that the current "best" price has an unlimited amount to match. So whatever you place £1 or £10000 it'll be matched if the price (and only the price) is suitable to match. You can't change the offer on the market with your test bet as well as you can't change the prices.
Then to check if the price is suitable right now it must refresh the market. To simulate real mode it must wait for the current bets refreshing request results (as it's in real mode). So it doesn't "match" your bets until both of these requests have been arrived. So for the best speed results you need to set the current bets refreshing interval to "Simultaneously with the market refresh" but it may cause the requests limit exceeding if your market refresh rate say 0.5 sec.
Proud to be 🇺🇦
I'm happy to help Monday - Friday, 08:00-18:00 GMT
Буду рад помочь с понедельника по пятницу, 08:00-18:00 GMT

  • All members
  • Posts: 15
And therein lies the reason why
     
              - an Inplay betting bot will always win the "Trigger Battle"
                         (Yet fail dismally in Real Mode)

               - why back bets placed @ 2  are matched at 2.1 


               - why lay bets placed @ 2 are matched 1.9

               -  why Triggers work in Test Mode and lose real money on Betfair

So take heed .. until WellDoneSoft rewrite the software be very very skeptical of all Test Mode results.


         


              -           

  • All members
  • Posts: 15
Almost 3 months now since

 WellDoneSoft had their attention was drawn
 to this software problem!!!!!
 (Both here and in private correspondence)

 and still no software revision in sight!!! ::)

Guess I'll have to be patient


And go Punting instead. :P
(No point building triggers I can't test)

Happy Punting :-*
Apples999






  • All members
  • Posts: 15
WellDoneSoft wrote:

Because MF pro is not the exchange.
To match bets program has to get the last prices from BetFair.
And yes, we are going to make it faster in 7th version.
Anyway the test mode never can be as good as real, sorry.

....


To which my reply is:

Matching Test bets with the last prices from BetFair is perfect!

What's not perfect are the couple of lines of code that
in essence read

  back_price >= bu_backp =bet matched @ back_price
  lay_price <= bu_layp =bet matched @ lay_price

These lines of code cause errors and need removing.
   (The errors are detailed in the start-up message)

The code should in essence read.

  MAXV(back_price,last_traded) >= bu_backp     = bet matched @ bu_backp
  MINV(lay_price,last_traded)    <= bu_layp  = bet matched @ bu_layp

I fail to see the big deal about changing a few lines of code

Surely Oxa can fix this relatively quickly.

The result would be a vastly improved Test Mode (Nil errors)
 for which I all the other MFPro customers would be most appeciative

Happy Punting

Apples999



  • Tim Vetrov
  • Administrator
  • Posts: 4875
  • Gender: Male
*
Why do you think the unmatched bets are matched at the price they were sent? As I know they matched at the current price.
Could you please explain what does last_traded deal with matching routine? This is the price already matched...
Proud to be 🇺🇦
I'm happy to help Monday - Friday, 08:00-18:00 GMT
Буду рад помочь с понедельника по пятницу, 08:00-18:00 GMT

  • All members
  • Posts: 15
Hmm... I obviously failing here,

Perhaps a Trigger will explain it better.
        (As it seems I'm having no success)

Action:               Lay
Price:                 1.49
Amount:             100
Markets:             Horse
Selections:         All Selections
Conditions:        None
Market Status:   In-play
Trigger Name:    Loose $49 per race
Execute:            once per selection


The Trigger does loose $49 per race (real mode);
but watch what it does in Test Mode.

Perhaps with the evidence right before your eyes you'll

 A.   Accept that there is a bug with Test mode.

 B.   Understand the size of the problem
       (and why the bug needs fixing in days not weeks)

 C.   Actually fix this bug.


As for "last_traded"...

last_traded is an unknown quantity,

In theory including last_traded in the formulas will accomplish
   - faster bet matching
   - more accurate matching
   - a more realistic simulation for greening triggers.

 This is based on the premise that in the real world bets are matched at last_traded
  (last_traded more often than not reaches a price before back_price/lay_price.)

In practice including last_traded is a unknown and may create new problems.



So good luck with the trigger,the BUG and a fast solution.


Apples999

   

  • All members
  • Posts: 905
What are you on about?

Laying the field @1.49 in running will not lose £49 every race, as you are likely to get more than one horse matched.  So you will either lose 49 or make a profit depending on how many are matched.  Running this in test mode may result in greater losses than live mode, since in live mode the matching will be at best price which in many cases will be a lot less then 1.49.  On the other hand test mode will match at 1.49 every time a horse hits this price in the market, however, there may be more matches in test mode as more horses may momentarily hit the required price.

So I agree the results will be different between test mode and live mode, but  don't agree there is any bug - it's just a fact of life.

  • Tim Vetrov
  • Administrator
  • Posts: 4875
  • Gender: Male
*
Thank you, I'll try the trigger as soon any in-play market starts.
I finally met with the guy who's writing the test mode routine and he agree with you but just partially:

MINV (back_price, last_traded) >= bu_backp = bet matched @ last_traded
MAXV (lay_price, last_traded) <= bu_layp = bet matched @ last_traded

It's possible (and nobody except BetFair knows how it is) that your bet was the first in queue (if I understand your point) but was matched not @ the placed price but @ the opposite "better" price.
Proud to be 🇺🇦
I'm happy to help Monday - Friday, 08:00-18:00 GMT
Буду рад помочь с понедельника по пятницу, 08:00-18:00 GMT

  • Tim Vetrov
  • Administrator
  • Posts: 4875
  • Gender: Male
*
Apples999,

What should I learn from these bets?
Proud to be 🇺🇦
I'm happy to help Monday - Friday, 08:00-18:00 GMT
Буду рад помочь с понедельника по пятницу, 08:00-18:00 GMT

  • All members
  • Posts: 905
As I thought quite a few races produced profit. so Apples trigger has the wrong title ::)

  • All members
  • Posts: 15
Hmm...
Sometimes it makes a little.So kill me.

Still, Test Mode is WRONG!!!

Take a look at the first 3 bets.

They were matched at 1.28 1.40 1.10
(Even you were expecting 1.49)
 That's a loss of $78
       
In Real mode they'll read 1.49 1.49 1.49 (They'll all read 1.49)
 That's a loss of $147

So within three bets Test Balance is out by $69.


 The more bets the bigger the problem.

And it's not just In-play markets,
 It's all markets,both back and lay, all the time.

I'm just glad that people are finally waking up to the problem.
Now they might just save some money,
 whilst WellDoneSoft works out how to fix the bug.

Happy punting

Apples999


  • All members
  • Posts: 905
Sorry Apples but you're mistaken.  In live mode when laying in play, the bet is likely to be matched at a lower price than the order was placed at, since the horse may have improved its position, and Betfair's matching engine will match at best price. This is what Welldonesoft has demonstrated in his test.

Your argument is the wrong way round. 

Test mode can never be a system that duplicates exactly what will occur in the live market and IMO is only suitable for checking that your triggers are functioning correctly.   Perhaps Welldone should simply clarify this fact so that people don't expect it to exactly mirror the live market.  Also if you keep using the API in test mode and don't place live bets, Betfair will soon close your account.

  • All members
  • Posts: 15
Gee,

 Rubold have you read Betfair betting rules !!

Of particular note is the rule that:
       bets are matched first to existing bets
           (i.e first come first served at the price of the existing bet)

The trigger (lose $49 per race) always places its bet FIRST (LAY $100 @ 1.49.)
At the start of In-Play.(Any arguments so far!!)

 Later during In-Play a horse improves position and
   its corresponding price drops beneath 1.49 (lets say to 1.10).

Under Betfair rules the LAY $100 @ 1.49 is an existing bet,
 (it existed prior to any BACK bet of 1.10.)

Therefore the LAY 100 @ 1.49 will always be matched @ 1.49.

So "Untitled.png" (a list of Test bets) should've contained
               a pageful of bets matched @ 1.49.
               (and not matched values of 1.28 1.40 1.10 etc)

That's as clear as it gets.


Either you understand that Test Mode,
 
      has major problems,
      gives false results (So we can't test triggers properly)
      and needs fixing pronto

 or you'll never understand.




As for the future of Test Mode:
Who can say but the inclusion of amounts is just around the corner.
(Sure will make a big difference to greening triggers)

My Betfair account is over 10yrs old and won't be closing it anytime soon.

Happy Punting

Apples999


  • All members
  • Posts: 905
Firstly, Welldonesoft hasn't stated whether these are test bets, or live bets, so we are all a bit in the dark here.

Secondly, yes if you place lay orders @ 1.49 in the market queue to be matched in running by using the keep function before the race start, or just after start of event, they should all be matched at the exact price of the order.  I see that your trigger just specifies In-Play so I assume these orders will be added to the queue at the start of the event.

My normal method is to fire the orders in when the lay price is equal to the desired price, in which case the bets are usually matched at a lower price due to the horse improving its position and the best price matching engine.

I agree that if Welldone has followed your exact trigger then all bets should be matched at 1.49 in live mode and test mode should be the same, so if not, then you have a valid point, but I don't think there is an easy answer to the problem

 

Please note, BetFair is seems to be currently OFFLINE