Author Topic: Bets in the queue  (Read 2756 times)

Tags:
  • All members
  • Posts: 28
  • Karma: +0/-0
Bets in the queue
« on: Tue, 09 November, 2010, 20:53 »
I would like to make sure that the amount of backed money at no time exceeds the amount of matched lay bets. That's why my trigger fires (amongst others) under the following condition: "back_matched+back_unmatched < lay_matched".

Unfortunately, it may still happen that at the end there is more money in back bets than in lay bets. As it seems, this is due to the bet delay in in-play markets that occasionaly makes the trigger to place more bets than allowed since back_unmatched does not include bets waiting in the queue, does it?

So, it would be quite useful to have a variable back_in_the_queue so that I could create a condition like this "back_matched+back_unmatched+back_in_the_queue < lay_matched".

Thank you!


  • Élite
  • Posts: 215
  • Karma: +4/-0
*
Re: Bets in the queue
« Reply #1 on: Wed, 10 November, 2010, 00:53 »
alkan,

if the dalay between 2 trigger executions is less than the inplay delay, MFPro does not yet see the new bets on second exexution and fires your bets twice.

Easy solution: ensure that delay between 2 trigger executions is more than inplay delay. (e.g. at least double inplay delay.)

If your strategy needs to send bets very fast:

add a trigger variable "lastbetsent".

initialize this variable with now_time - 1

add this condition to every trigger which change bets:
AND (now_time-lastbetsent)*24*60*60 is greater than 14

after you have sent a bet into the market: set lastbetsent to now_time

7 seconds ist inplay delay in this exmple, can differ in your markets.

 

  • All members
  • Posts: 28
  • Karma: +0/-0
Re: Bets in the queue
« Reply #2 on: Wed, 10 November, 2010, 18:27 »
Thank you for the quick answer!

Yes, I need a trigger that is executed as fast as possible without running the risk to have more backed money than layed.

So, even with your second approach my trigger (and it is only one) would be forced to wait at least twice the delay which is a pity.  

The only really fast solution I can think of is to manually set a variable to the value of current matched and unmatched back bets each time a back bet is placed.

  • Élite
  • Posts: 215
  • Karma: +4/-0
*
Re: Bets in the queue
« Reply #3 on: Wed, 10 November, 2010, 22:23 »
alkan,

you wrote: So, even with your second approach my trigger (and it is only one) would be forced to wait at least twice the delay which is a pity. 

If you use my hint with the "lastbetsent", the first bet is sent quickly. Only the next bet is delayed. But as soon as the delay is over, the trigger fires as fast as possible after all your remaining trigger conditions are true.

Off course you may miss some trading opportunities, but this was the only way that worked for me in inplay markets.

you wrote: The only really fast solution I can think of is to manually set a variable to the value of current matched and unmatched back bets each time a back bet is placed.

The problem with this approach is, that your trigger variables might go out of sync with reality. Consider the possebility, that your bet could not be sent to the market, because of fund or liability limit, or a problem with connection to betfair.

Martin

  • All members
  • Posts: 28
  • Karma: +0/-0
Re: Bets in the queue
« Reply #4 on: Thu, 11 November, 2010, 19:40 »
Thank you again.

You're perfectly right. It seems that there is currently no perfect solution for my problem but the approach with variable lastbetsent would the best one. Maybe in a future release MFPro will include a specific variable for queued bets.  :)

And if you permit, let me ask another question regarding fast trigger execution.
In 14.4 the manual says:

"The conditions of the trigger are checked during each refresh of the market. That means the trigger is evaluated whenever the new data are retrieved from BetFair [...]"

However, even if I set the in-play refresh rate to 0.3 sec (I'm still using MFPro 6.2) my trigger is still executed only every 2 or 3 sec (at least according to the log file). Why is this?


  • Nerd
  • Élite
  • Posts: 589
  • Karma: +27/-1
  • Gender: Male
  • I think I could be on to something here!
*
Re: Bets in the queue
« Reply #5 on: Sun, 14 November, 2010, 20:26 »
However, even if I set the in-play refresh rate to 0.3 sec (I'm still using MFPro 6.2) my trigger is still executed only every 2 or 3 sec (at least according to the log file). Why is this?

2-3 a second is about right!

Remember that you are requesting data (not pinging) from a REMOTE server and the server has to respond and then only do you get the data to evaluate ... this alone could easily add 100-200ms which would explain 2-3 data sets per second. Anyway at 0.3 you will never get more then 3 per second!
Fortune favors the brave!