Market Streaming question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • geoffw123
    Senior Member
    • Mar 2014
    • 250

    #1

    Market Streaming question

    Hi

    I have got tthe market streaming API working using the Betfair example code. The non steaming API I think is pretty well explained in the docs but this steam stuff in my view is not well documented and is therefore pretty hazy in my understanding.

    I have been perusing some dumped Json of the passed data parameter from the Betfair code.

    At the top level you get Change{} Market{} Snap {} Data structures.

    Change is straightforward, I can see data for the subset of runners where some data item has changed. This can modify the local market cache I have got.

    Looking inside Market{} I can See Market.Snap.MarketDefinition {} and Market.Snap.MarketRunners {}

    Then if I look inside the toplevel Snap structure I also see Snap.MarketDefinition {} and Snap.MarketRunners {}

    These structures contain data for all runners and are quite big, they seem to be a duplicate of what is inside the Market {} structure ?

    Whats going on there, why is there apparently large data structures duplicated in what is passed to my function ?

    Are they current snapshots of all market data at that current moment in time or maybe a snapshot of the market at the time of market subscription ?

    I can post some Json if the above is not clear. Any overview thoughts on this would be very useful please

    Thanks
  • WTPooh
    Member
    • May 2012
    • 88

    #2
    Hi Geoff

    You are probably asking about C# sample and MarketChangedEventArgs class.
    Here is this class definition:

    public class MarketChangedEventArgs : EventArgs
    {
    /// <summary>
    /// The raw change message that was just applied
    /// </summary>
    public MarketChange Change { get; internal set; }

    /// <summary>
    /// The market changed - this is reference invariant
    /// </summary>
    public Market Market { get; internal set; }

    /// <summary>
    /// Takes or returns an existing immutable snap of the market.
    /// </summary>
    public MarketSnap Snap
    {
    get
    {
    return Market.Snap;
    }
    }
    }

    As you can see Snap is just a reference to Market.Snap.
    All you need from this class is a Snap property. It contains already updated snapshot of the market.

    Comment

    • geoffw123
      Senior Member
      • Mar 2014
      • 250

      #3
      Hiya

      Thanks for the msg, ah yes it is just a reference, I had missed that, seems a bit pointless as could just use Market.Snap. I was pondering Betair's design thoughts on this. I had assumed that sending a delta structure of market changes was to minimise traffic to clients. However they seem to be sending a full market image with every delta packet unless I have misread this. That would seem to negate the point of sending a delta message in the first place.

      I am trying to iterate over just the changed runners to try and make my code a bit more optimum, not sure if that is a sensible decision at the moment. I have got some obscure bugs with it presently
      Last edited by geoffw123; 27-07-2019, 05:58 PM.

      Comment

      • WTPooh
        Member
        • May 2012
        • 88

        #4
        They sending you full market image in the first message. Then they sending you only updates.
        Your client creates snapshot of the market and then updates it from delta messages.
        After each update client raises an event and gives you both change message and already updated market snapshot.

        Comment

        • geoffw123
          Senior Member
          • Mar 2014
          • 250

          #5
          Thanks WTPooh That is how I had assumed it should work, but I couldnt find any Betfair docs that gave that overwiew explanation. Your explanation was nice and concise and simple, Betfair should get you writing their Docs for them

          Comment

          • LetsGo
            Senior Member
            • Oct 2018
            • 112

            #6
            geoffw123 are you using streaming events (waiting for the data changes to be sent) or are you in a loop and requesting data?

            Comment

            • geoffw123
              Senior Member
              • Mar 2014
              • 250

              #7
              Hiya

              I am just using their example code pretty much. So I subscribe to a market then use the event mechanism with a handler function to tell me when something changed and update data with MarketChangedEventArgs.

              Comment

              Working...
              X