Polling (Ping)

This page is just about optimizing the API refresh settings for polling (sometimes also known as 'ping'), it does not apply to streaming.

You should aim to always use streaming instead of polling, because streaming is more efficient and potentially faster. Streaming is the default method used by Cymatic in all recent versions. To learn about streaming, you can visit the settings for streaming page instead.  However, if you decide to use polling, then the rest of this page talks just about polling and how to optimize your settings for polling.

Please note the meaning of the terms used in this article:

  • Refresh intervals describes how often you send API calls to Betfair. The values are set using the API Refresh tab in the Settings Window.
  • Durations describes the actual roundtrip time for a call to travel through the internet to Betfair and back to you (i.e. the roundtrip duration)

They are not the same thing!

This article will help you learn how to ensure that prices and bets travel as fast as possible and are updated with high frequency, when using polling.

At the end of this article you will set the API Refresh rates as fast as you can, when using polling. However, and this is important, if you set them too fast you might cause your internet connection to struggle and then the calls will take longer to reach Betfair – resulting in the opposite of what you want.  If you are in the UK then the default refresh intervals will probably work well without any adjustment needed.

API Refresh tab

In the main window of the Cymatic software, go to the File Menu | Settings | API Refresh tab.

To choose Polling (ping) instead of Streaming, click the Polling option near the top left corner of the API Refresh tab page.

You can then choose the actual refresh settings for polling, on the right side of the API Refresh tab page.

If you are not in the UK, then I suggest you start with very slow refresh intervals, as shown below.

Primary Secondary
Prices 3000 3000

API Latency tab

The first setting below defines the threshold at which a warning message will be displayed informing you that the API duration is currently slow.  The second setting defines how long to wait for a response before a message to the exchange times out (this setting general does not need to be changed).

Pause trading if API call duration >= 3500
Timeout - Exchange Service 30000

The numbers shown above for price refresh (API Refresh tab) and the API latency tab settings, should work for everyone, even on very poor internet connections.

The goal at this stage is to choose very slow intervals so that you know you wont be overloading your internet connection. This will enable your API calls to have the fastest possible DURATIONS, because your connection will be stable and not overloaded.  So, now that your connection is stable, observe the API durations displayed across the bottom of the main window (or in the API Monitor). You should now know how fast the durations (round-trip) can be for your connection.

The duration that is achieved varies considerably based on your connection and location, here are some typical values:

Betfair Customers - registered NOT in UK:
(Users report that calls may be diverted via Malta)
Connecting to Betfair from outside the UK 120 - 1000ms

Betfair Customers - registered in UK:
Connecting to Betfair from a UK home broadband: 50 - 200ms
Connecting to Betfair from a VPS in a UK data centre 15 - 25ms

Now gradually choose faster refresh intervals (smaller numbers on the API Refresh tab in the Settings Window) and keep doing it so long as you don’t see the roundtrips taking longer. Eventually you'll get a feel for what the limits are of your connection without causing bottlenecks.

Many users outside the UK find that these numbers work well:

API Refresh tab:
Primary Secondary
Prices 1000 1000

API Latency tab:
Pause trading if API call duration >= 3500
Timeout - Exchange Service 20000

You can also learn how to use the API Monitor to examine the speed of your API calls and whether they are suffering from congestion or are bottlenecking.