Suggestions : Get data from external REST API in Guardian Automation

Help improve Bet Angel.
Post Reply
inchiaro10
Posts: 4
Joined: Sat Feb 01, 2020 6:19 pm

Tue Jun 30, 2020 9:44 am

Integrate the use of external REST APIs during Guardian automation rules.

This works would be fantastic as it could open numerous scenarios. If I only think about football this could:
1) Rules based on football statistics (H2H, Standings)
2) Rules based on statistics in football play (ex ball possession, short on goal, momentum etc)
3) Absolute precision on the rules based on the correct score
4) Rules based on bookmaker odds or on odds trand.
5) Complex mathematical rules for defining strategies (ex using mathjs)

I believe this feature outperforms any other sports trading software on the market, taking BetAngel to a much higher level.

User avatar
jimibt
Posts: 2391
Joined: Mon Nov 30, 2015 6:42 pm

Tue Jun 30, 2020 10:48 am

inchiaro10 wrote:
Tue Jun 30, 2020 9:44 am
Integrate the use of external REST APIs during Guardian automation rules.

This works would be fantastic as it could open numerous scenarios. If I only think about football this could:
1) Rules based on football statistics (H2H, Standings)
2) Rules based on statistics in football play (ex ball possession, short on goal, momentum etc)
3) Absolute precision on the rules based on the correct score
4) Rules based on bookmaker odds or on odds trand.
5) Complex mathematical rules for defining strategies (ex using mathjs)

I believe this feature outperforms any other sports trading software on the market, taking BetAngel to a much higher level.
yes, this would be a great addition, tho it would of course require the return value(s) to be stongly typed in order for BA to use them.

in the meantime, you can actually use VBA to do this very task. I use it as a workaround in quite a few places and it works well. let me know if you need to me to add any further info to get you going..

[edit - 10:56] -here's the 1st version of the code that i could locate that does this type of thing. the function is called based on certain conditions inside the BA Excel template being met. I have various parameters that get populated as contained within a Criteria sheet. You can see the code replacing these into the URL, which is contained on the criteria sheet and looks a bit like this:

http://resturl/racing/?marketid={1}&lbx={2}&pix={3} .... etc, etc

Code: Select all

Private Sub REST_Data_From_URL()
    Dim wsSource As Worksheet, wsCriteria As Worksheet
    Dim destCell As Range
    Dim URL As String, marketid As String
    Dim wsBaSheet As Worksheet
    'url params
    Dim lbx As String, pix As String, pav3 As String
    Dim dsrmin As String, dsrmax As String, racecountmin As String, testjockey As String
    Dim oddmin As String, oddsmax As String, positions As String

    Set wsBaSheet = Worksheets("Bet Angel")
    Set wsCriteria = Worksheets("Criteria")
    
    marketid = wsBaSheet.Range("A1").Value
    URL = wsCriteria.Range("B1").Value
    
    ' replace the paramters
    racecountmin = wsCriteria.Range("B5").Value
    lbx = wsCriteria.Range("B6").Value
    pix = wsCriteria.Range("B7").Value
    pav3 = wsCriteria.Range("B8").Value
    dsrmin = wsCriteria.Range("B9").Value
    dsrmax = wsCriteria.Range("B10").Value
    testjockey = wsCriteria.Range("B11").Value
    oddsmin = wsCriteria.Range("B12").Value
    oddsmax = wsCriteria.Range("B13").Value
    positions = wsCriteria.Range("B14").Value
    ' update URL
    URL = Replace(URL, "{1}", marketid)
    URL = Replace(URL, "{2}", racecountmin)
    URL = Replace(URL, "{3}", lbx)
    URL = Replace(URL, "{4}", pix)
    URL = Replace(URL, "{5}", dsrmin)
    URL = Replace(URL, "{6}", dsrmax)
    URL = Replace(URL, "{7}", pav3)
    URL = Replace(URL, "{8}", testjockey)
    URL = Replace(URL, "{9}", oddsmin)
    URL = Replace(URL, "{10}", oddsmax)
    URL = Replace(URL, "{11}", positions)
     
    wsCriteria.Range("B16").Value = URL
    
    Set wsSource = Worksheets("BetData")

    wsSource.Activate
    wsSource.UsedRange.ClearContents
    wsSource.Range("A2").Select
    Set destCell = wsSource.Range("A1")
    
    On Error Resume Next
    With destCell.Parent.QueryTables.Add(Connection:="TEXT;" & URL, Destination:=destCell)
        .TextFileStartRow = 1
        .TextFileParseType = xlDelimited
        .TextFileCommaDelimiter = True
        .Refresh BackgroundQuery:=True
    End With
    On Error GoTo 0
    wsBaSheet.Activate
End Sub


inchiaro10
Posts: 4
Joined: Sat Feb 01, 2020 6:19 pm

Wed Jul 01, 2020 8:45 am

jimibt wrote:
Tue Jun 30, 2020 10:48 am
inchiaro10 wrote:
Tue Jun 30, 2020 9:44 am
Integrate the use of external REST APIs during Guardian automation rules.

This works would be fantastic as it could open numerous scenarios. If I only think about football this could:
1) Rules based on football statistics (H2H, Standings)
2) Rules based on statistics in football play (ex ball possession, short on goal, momentum etc)
3) Absolute precision on the rules based on the correct score
4) Rules based on bookmaker odds or on odds trand.
5) Complex mathematical rules for defining strategies (ex using mathjs)

I believe this feature outperforms any other sports trading software on the market, taking BetAngel to a much higher level.
yes, this would be a great addition, tho it would of course require the return value(s) to be stongly typed in order for BA to use them.

in the meantime, you can actually use VBA to do this very task. I use it as a workaround in quite a few places and it works well. let me know if you need to me to add any further info to get you going..

[edit - 10:56] -here's the 1st version of the code that i could locate that does this type of thing. the function is called based on certain conditions inside the BA Excel template being met. I have various parameters that get populated as contained within a Criteria sheet. You can see the code replacing these into the URL, which is contained on the criteria sheet and looks a bit like this:

http://resturl/racing/?marketid={1}&lbx={2}&pix={3} .... etc, etc

Code: Select all

Private Sub REST_Data_From_URL()
    Dim wsSource As Worksheet, wsCriteria As Worksheet
    Dim destCell As Range
    Dim URL As String, marketid As String
    Dim wsBaSheet As Worksheet
    'url params
    Dim lbx As String, pix As String, pav3 As String
    Dim dsrmin As String, dsrmax As String, racecountmin As String, testjockey As String
    Dim oddmin As String, oddsmax As String, positions As String

    Set wsBaSheet = Worksheets("Bet Angel")
    Set wsCriteria = Worksheets("Criteria")
    
    marketid = wsBaSheet.Range("A1").Value
    URL = wsCriteria.Range("B1").Value
    
    ' replace the paramters
    racecountmin = wsCriteria.Range("B5").Value
    lbx = wsCriteria.Range("B6").Value
    pix = wsCriteria.Range("B7").Value
    pav3 = wsCriteria.Range("B8").Value
    dsrmin = wsCriteria.Range("B9").Value
    dsrmax = wsCriteria.Range("B10").Value
    testjockey = wsCriteria.Range("B11").Value
    oddsmin = wsCriteria.Range("B12").Value
    oddsmax = wsCriteria.Range("B13").Value
    positions = wsCriteria.Range("B14").Value
    ' update URL
    URL = Replace(URL, "{1}", marketid)
    URL = Replace(URL, "{2}", racecountmin)
    URL = Replace(URL, "{3}", lbx)
    URL = Replace(URL, "{4}", pix)
    URL = Replace(URL, "{5}", dsrmin)
    URL = Replace(URL, "{6}", dsrmax)
    URL = Replace(URL, "{7}", pav3)
    URL = Replace(URL, "{8}", testjockey)
    URL = Replace(URL, "{9}", oddsmin)
    URL = Replace(URL, "{10}", oddsmax)
    URL = Replace(URL, "{11}", positions)
     
    wsCriteria.Range("B16").Value = URL
    
    Set wsSource = Worksheets("BetData")

    wsSource.Activate
    wsSource.UsedRange.ClearContents
    wsSource.Range("A2").Select
    Set destCell = wsSource.Range("A1")
    
    On Error Resume Next
    With destCell.Parent.QueryTables.Add(Connection:="TEXT;" & URL, Destination:=destCell)
        .TextFileStartRow = 1
        .TextFileParseType = xlDelimited
        .TextFileCommaDelimiter = True
        .Refresh BackgroundQuery:=True
    End With
    On Error GoTo 0
    wsBaSheet.Activate
End Sub


Thanks for the reply jimibt, unfortunately I understand very little about VBA
I hope developers can bring the call to REST api in Guardian, it has enormous potential.

User avatar
jimibt
Posts: 2391
Joined: Mon Nov 30, 2015 6:42 pm

Wed Jul 01, 2020 9:15 am

inchiaro10 wrote:
Wed Jul 01, 2020 8:45 am
Thanks for the reply jimibt, unfortunately I understand very little about VBA
I hope developers can bring the call to REST api in Guardian, it has enormous potential.
i think adding that type of functionality without having to use vba would of course be amazing but i do foresee difficulites in implementing it insofar as targetting the output generically in the current guardian environment (i.e. the output would need to conform to a standard and a new way to interpret the data and factor it into the mix would need to be analysed and an engine built to support it). would be incredible tho!!

as i said, in the meantime you can always *fake it* using code similar to the above ;)

inchiaro10
Posts: 4
Joined: Sat Feb 01, 2020 6:19 pm

Wed Jul 01, 2020 2:34 pm

jimibt wrote:
Wed Jul 01, 2020 9:15 am
inchiaro10 wrote:
Wed Jul 01, 2020 8:45 am
Thanks for the reply jimibt, unfortunately I understand very little about VBA
I hope developers can bring the call to REST api in Guardian, it has enormous potential.
i think adding that type of functionality without having to use vba would of course be amazing but i do foresee difficulites in implementing it insofar as targetting the output generically in the current guardian environment (i.e. the output would need to conform to a standard and a new way to interpret the data and factor it into the mix would need to be analysed and an engine built to support it). would be incredible tho!!

as i said, in the meantime you can always *fake it* using code similar to the above ;)

I think BetAngel already manages the API Rest to interface with those of Betfair.
JSON parsing should be implemented in Guardian and the store in variables (which Guardian already does)

Post Reply

Return to “Suggestions”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 0 guests