Article

Horse Racing Photo Finish Bot

From Market Feeder forum (in Russian so make your own translation for the rest replies in the forum):

Is it possible to implement a trigger for horse racing, which will work exclusively when the race is suspended at the end and opens again (usually because of the uncertainty in the winner)?

Market Feeder support refused to build such script saying it is hard to test such trigger, strange as when you write your code it should work, otherwise you wrote bad code.

Bfexplorer Solution:

First you need to realize what happens when race is reopening again.

At the moment race is started the market is suspended, so status goes from Open to Suspended, after SP bets are matched the market is reopen so market status goes from Suspended to Open, and in-play status is set.

At the end of the race the market is suspended again till winner is known and all matched bets are settled the market goes from Suspended status to Closed and winner selection/s are set by Winner flag.

If the winner of the race must be declared by photo finish, the race is reopened again till photo finish procedure is known.

So what should implement our trigger code?

PhotoFinishBot.fsx

At the moment of turning the race at in-play the code sets notification handler for MarketStatus, when market status changes its state again from Suspended to Open we know that photo finish procedure starts, have a look at line 33, at the moment we set:

triggerStatus <- TriggerStatus.MarketReopenAtInPlay

(line 35) and when bot trigger is executed in lines 49 – 52 we can execute our strategy. In my code I just report: "Market has been reopened at in-play."