Announcement

Collapse
No announcement yet.

Market start time—Market start time of events are 2 hours out from my local time.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Market start time—Market start time of events are 2 hours out from my local time.

    Hi All,

    When I search for a market, the displayed market start time (market_start_time, marketStartTime) is 2 hours ahead of my local time. Is there a timezone option in the bot, or something I need to change? The race is in the same time zone.

    Example:
    Code:
    for market_catalogue in market_catalogues:
        print(market_catalogue.market_start_time)
        # 2021-08-26 09:06:00         Printed result
        # 2021-08-26 07:06:00         Actual local time
    Thank you for any help provided.

    For reference, I am using betfairlightweight (python).

  • #2
    I had enormous difficulties with this very topic when I started, and the (UK) clocks changing from BST to GMT and back messed things up until I found the solution. Which I can't remember, so I'll look at my big program and see if I can work out how I sorted it...

    Comment


    • #3
      This may be sufficient, but the clocks are changed at 2:00am in the UK (late October and late March) and I'm not certain this code works for events that start between midnight and 1:00am (or 2:00am) on the days of the change. In my program nothing ever started in that time period, so it didn't matter.

      There are three bits of code. It's probably obvious what it's doing. Using VB.NET.

      Code:
      Public TimeOfYear As String ' BST or GMT
      
      ...
      
      If DateTime.Now.IsDaylightSavingTime Then
         TimeOfYear = "BST"
      Else
         TimeOfYear = "GMT"
      End If
      
      ...
      
      Dim getDate As DateTime = Now()
      If TimeOfYear = "BST" Then
         getDate = getDate.AddHours(-1) ' THIS MAY NOT WORK BEFORE 1.00am!!!!!!!!!!!
      End If

      Comment


      • #4
        That doesn't quite answer the question; yes, there is a TimeZone returned on the listEvents call.


        Get a PDF of the documentation here: https://docs.developer.betfair.com/p...pageId=4392320
        Page 96 includes TimeZone codes and options.

        Comment


        • #5
          jabe Thank you very much for the help!

          Comment

          Working...
          X