MarketBook operation restricts amount of data PLUS how to use LISTS ?

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

    #1

    MarketBook operation restricts amount of data PLUS how to use LISTS ?

    OK I have a problem with the amount of data returned in MarketBook giving me the error code "operation restricts amount of data" blah blah blah like below

    Code:
    Got Response: {"jsonrpc":"2.0","error":{"data":{"exceptionname":"APINGException","APINGException":{"errorDetails":"operation restricts amount of data being returned","errorCode":"TOO_MUCH_DATA","requestUUID":"prdang003-03260452-0000f18993"}}},"id":1}
    A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in System.Windows.Forms.dll
    What I have is my app is a structure which stores MarketCatalog e data and MarketBook data such as:

    Code:
    Public Structure BetfairData
        Dim URL As String
        Dim MarketCatalog As IList(Of MarketCatalogue)
        Dim MarketIds As IList(Of String)      '
        Dim MarketBook As IList(Of MarketBook)
    End Structure
    Basically I was storing say 20 lots of MarketCatalogs and associated MarketBooks such that MarketCatalog(0) and MarketBook(0) had associated data.



    Now I went to increase my return to 100 MarketCatalog to look at the next 4 to 5 hours of upcoming races. This is ok, but when I call for 100 MarketBooks which the 100 different MarketIDs I get a the "to much data error"

    So to me it seems the way around this is to break down the calls into say lots of 10, so I would call MarketBook 10 times asking for 10 lots of data. I could call MarketBook for each individual market ID but this I believe would take a lot longer.

    This is my current code ....

    Code:
    'Get Price MarketBook data
    myBFdata.MarketBook = fnReturnMarketBookData()
    
    
    Public Function fnReturnMarketBookData() As IList(Of MarketBook)
        Dim clientBF As JsonRpcClient = Nothing
        clientBF = New JsonRpcClient(myBFdata.URL, myBFdata.sKeyInUse, myBFdata.sSessionID)
    
        Dim priceData As ISet(Of PriceData) = New HashSet(Of PriceData)()
        priceData.Add(API_NG.TO.PriceData.EX_BEST_OFFERS)                                 'Get best offers from betfair exchange
    
        Dim priceProjection = New PriceProjection()
        priceProjection.PriceData = priceData
    
    
        '################ GET PRICES FOR MARKET(S) SELECTED ################
        fnReturnMarketBookData = clientBF.listMarketBook(myBFdata.MarketIds, priceProjection)
    
        Return fnReturnMarketBookData
    
    End Function

    Being new to VB NET (I am a classic VB guy), I think the answers lies somewhere in being able to use LIST or ARRAYLIST correctly but I need some guidance here.

    Is there someway that I can declare my Full MarketBook and have a tmpMarketBook which is added to MarketBook ie ...

    Code:
    Dim MarketBook As IList(Of MarketBook)   'THIS GROWS AS I RETURN MORE DATA
    Dim tmpMarketBook As IList(Of MarketBook)   
    
    myBFdata.MarketBook = fnReturnMarketBookData( First_10_MarketIDs )
    
    MarketBook.add  (tmpMarketBook )  '?????   hmmm will this work 
    
    
    myBFdata.MarketBook = fnReturnMarketBookData( Second_10_MarketIDs )
    
    MarketBook.add  (tmpMarketBook )  '?????   hmmm will this work

    What does everyone else do ???
    Last edited by Guest; 11-04-2014, 02:41 PM. Reason: Change of initial question
  • Guest

    #2
    Answer in case anyone looking

    I guess the answer is to copy the MarketBook response into a new class. To do this I need to have a clone method in the MarketBook Class shown as the bottom function below. Also note I have included Implements ICloneable.

    Code:
      Public Class MarketBook
            Implements ICloneable
            <JsonProperty(PropertyName:="marketId")> _
            Public Property MarketId() As String
    
            <JsonProperty(PropertyName:="isMarketDataDelayed")> _
            Public Property IsMarketDataDelayed() As Boolean
    
            <JsonProperty(PropertyName:="status")> _
            Public Property Status() As MarketStatus
    
            <JsonProperty(PropertyName:="betDelay")> _
            Public Property BetDelay() As Integer
    
       
            'All other MB properties here have been removed to make example simplier
    
            Public Function Clone() As Object Implements System.ICloneable.Clone
                Return Me.MemberwiseClone
            End Function
    
        End Class

    To get say 10 markets I call
    Code:
         'Get MB responses for Mk IDS passed in (limit to 10 at a time)
         fnReturnMarketBookData = clientBF.listMarketBook(MarketIDsToGet, priceProjection)
    
    
         'Example of copy over the complete MarketBook into say a tmp MB
         Dim tmpMB(50) As MarketBook
         Dim i As Integer
    
         For i = 0 To myBFdata.MarketBook.Count - 1
              tmpMB(i) = myBFdata.MarketBook(i).Clone
         Next i
    Last edited by Guest; 12-04-2014, 03:18 PM.

    Comment

    Working...
    X