Fill-or-kill and ways to make sure a bet is matched

This is an example on how to make sure your bet is fully matched, plus to implement the "Fill-or-kill" rule.

Right-click here to download the trigger file.

There are four blocks in the file.

Block 1, "User variables"

Here you can put any variables that you'll be using in the triggers. The single variable in the example is "time_sec", the number of seconds that should have passed since the moment of placing a bet before you'll need to cancel or match it. In the example it is equal to 10 sec.

Block 2, "Repetitive attempts to match a bet at the current price"

The triggers here will cancel and re-place your bet (or what is left of it) at the current offered price. If the price has changed while the bet was being sent to BetFair, the trigger will repeat its attempt after the time specified in time_sec and so on.

Block 3, "Compulsory matching at any price available"

These triggers, unlike the one in the previous block, will update the price of the unmatched bet, rather than cancelling and re-placing it. For back bets the new price will be 1.01, for lay bets it'll be something that is determined by a setting called "When laying at "best" price offer a price that is ... ticks above the current lay price" in "Betting Options". This will guarantee that unmatched bets will be matched, though it's impossible to predict at what exactly price.

Block 4, "Fill or kill"

The triggers in this block perform the standard FOK: they will cancel any unmatched bets after a certain time has passed since you placed them.

Here is an example of what FOK does:

Please pay attention that we disabled two blocks, as only one of them should run at a time.

All triggers are repeated at a maximum frequency of 1 sec. If your refresh rate is even higher, edit this figure yourself, only remember that it can't be less than the frequency at which your bets are updated from BetFair.

How to test the triggers

Open the file, activate the block that you want to test (for example, "Fill or kill") and the block with the user variable. Deactivate other blocks (set their "Repeat Block" field to "never").

Save the triggers and close the window. Add a couple of markets to "My Markets". Start refreshing one of them. Place unmatched bets of both types randomly and see what will happen to them.

If you have not heard of BetFair yet or do not have an account, register today and get £20 free. Use the link below:
New customers only, bet up to €/£20 on the Exchange and if your first bet loses, we’ll refund you €/£20 in Cash. Bet must be placed in first 7 days of account opening. T&Cs apply.
Gamble responsibly! Always be aware that betting is NOT risk-free. You must be 18+ years old before you try gambling, but even as an adult, withhold from spending money in an ill-judged manner. Our company does not encourage you to prefer gambling over other meaningful activities. If gambling is affecting your life or the lives of people close to you, please contact GamCare
 
© 2005-2023 WellDone Creative Software. All rights reserved. Terms and conditions.
BetFair® and the BetFair Logo are registered trade marks of Flutter Entertainment plc. Gamble responsibly.