Forum Article

Mirror movement

 

Hi,

I'm have serious lag issues, for example this routine from a simple cancel bet to place bet takes about 1 second.  The code is as follows

| TriggerStatus.CancelLayTrade ->
  status <- TriggerStatus.PlaceLayTrade
  let tradeUnmatchedL = _selection.Bets |> getUnmatchedBetsByBetType BetType.Lay
  TriggerResult.CancelBets (Some tradeUnmatchedL, onBetsCancelledBack)

| TriggerStatus.PlaceLayTrade ->
  status <- TriggerStatus.Initialize
  let stake = defaultArg (botTriggerParameters.GetParameter<float>("Stake")) 2.0
  let bet = [ SelectionBetOrder.Create(_selection, BetType.Lay,selection.ToLay.FirstBestPrice.Price, stake)]
  TriggerResult.PlaceBets (bet, PersistenceType.Lapse, onBetsPlaced)

Is there a problem with this code? 

Basically is it possible to "mirror" a position if it changes rapidly, eg the toLay first  position is moving away from our bet so we want to cancel/move our bet to stay at first position.

Thanks

  • Add Your Comment

    +

    Please login to your bfexplorer account, if you want to add a comment to this article.

Comments ( 5 )


  • Betfair Bot
    4.11.2019 8:57:13

    I had already answered such question.

  • peteresgate@outlook.com
    4.11.2019 15:22:10

    Would you mind linking the article?  I can't find it.

    Thanks

  • Betfair Bot
    4.11.2019 16:39:32

    Your bot code is executed in market update event, so if your active market refresh rate is set to 250 ms, then your bot is executed every 250 ms. For passive markets (default 10s) or markets added to bot executor tool the default settings is 1 second.

    It means that when time is critical factor for your bot execution then you must set reasonable values for market update interval.

    If you are using streaming for data update (that is relevant only for active and passive markets in Bet Event View and Open Markets view), then as updates are really streamed only when changes are detected, your bot can be executed in heart beat event only, set for active market to 1s and for passive markets to 15 seconds, keep that in mind!

    Why is it implemented this way?

    Well, because bot reacts on market data changes, and there is no reason to execute a bot when there are no market data changes.

  • peteresgate@outlook.com
    5.11.2019 8:36:36

    That's great thanks   Can the market interval be changed via code?

  • Betfair Bot
    5.11.2019 9:07:36

    No