API NG

Discuss anything related to using the program (eg. triggered betting tactics)

Moderator: 2020vision

Re: API NG

Postby KESIMKESIM » Thu Jul 06, 2017 3:45 pm

Gary/Mark,

I think I have discovered a bug in the API-NG. I'm currently using version 38e.

The problem occurs when there is a NR and bets are voided by Betfair. This happen to me on the 14.00 Haydock race today, where I had 5 lay bets on a NR voided. However, these bets were still being downloaded to Betting Assistant but had been assigned by BA to 5 other horses. They were displayed in the pop up MyBets window on BA with the original voided bet references but now against the wrong horses.

These bets also appeared in the Excel sheet MyBets on the attached workbook but Column B, Selection, was blank.

These bets were not shown on BF when accessed via the website, so BF was showing the correct position.

As an aside, when usingthe ba.getbets commance on a different spreadsheet, these bets were also being returned, so I presume ba.getbets is getting this information from the local cache as opposed to accessing from the API server at BF?

Hope you can have a look into this, as I'll have to swop back to the approved version for the time being.

Many Thanks and Best Regards, Ian
KESIMKESIM
 
Posts: 74
Joined: Thu Nov 26, 2009 3:55 pm
Location: East Yorkshire

Re: API NG

Postby mike » Fri Jul 07, 2017 8:51 pm

Hi Gary,

Thanks for adding the streaming prices functionality. I did some testing today. It seems to work fine to me. Nice to see these fast prices!

I don't understand the exact difference between ALL STREAM ON and FULL STREAM ON, although FULL STREAM ON works fine to me since I can use this command to turn on streaming for a single market within Excel and turning it off by entering a refreshrate-number. It seems to me that streaming does not take a lot of extra CPU capacity, although there were not a lot of matches while i was testing.

It is a pitty that the speed of Excel VBA is limited to 1 core if i am right, otherwise I could make my own VBA code a lot faster. Let's see if i can make my code faster in other ways.

Thanks and best regards,
Marcel
mike
 
Posts: 120
Joined: Sat Dec 30, 2006 2:36 pm

Re: API NG

Postby MarkRussell » Sat Jul 08, 2017 10:17 am

Hi,

Just to clarify the 2 following Excel triggers:-

ALL-STREAM-ON turns on both price streaming and order streaming.

FULL-STREAM-ON sets the streaming to full and only really applies to price streaming as order streaming is always full speed.
With price streaming set to full the prices and/or amounts are updated in the Grid / Excel as soon as they change in the stream.

Regards,
Mark
User avatar
MarkRussell
Site Admin
 
Posts: 1787
Joined: Tue Feb 20, 2007 6:38 pm
Location: Birmingham

Re: API NG

Postby mike » Tue Jul 11, 2017 11:12 am

Hi Mark, thank you for the explanation. Now it is clear to me.

Regards,
Marcel
mike
 
Posts: 120
Joined: Sat Dec 30, 2006 2:36 pm

Re: API NG

Postby KESIMKESIM » Thu Jul 13, 2017 3:55 pm

Gary/Mark,

I reported a bug I had discovered on the API-NG a week ago, see a couple of posts above, but I haven't seen any response. Have you had a chance to look into this?

Thanks and Regards,

Ian
KESIMKESIM
 
Posts: 74
Joined: Thu Nov 26, 2009 3:55 pm
Location: East Yorkshire

Re: API NG

Postby GaryRussell » Thu Jul 13, 2017 4:10 pm

I posted this on bugs reports. I am looking into this. Sorry, but it's not easy to reproduce. I can try and simulate it, but it's not the same as actually capturing the exact same scenario.
User avatar
GaryRussell
Site Admin
 
Posts: 9679
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Re: API NG

Postby mak » Sat Jul 22, 2017 9:02 am

I had a more than 5-6 months to visit the site. Major changes :)
Just realized the new possibilities.
First of all I think it should be a "warning" message in the 1st page of BA that notifies for the changes and the new beta versions etc

Since when "streaming prices" are available in Betfair. March 2017?

I just installed latest version and want to test it in spreadsheets.
Can someone please verify that the following code will work, or I have to make changes?

I just changed to "FULL-STREAM-ON" from 0.2
and FULL-STREAM-OFF from 1

I am not sure that it will move to the next market etc.
Any help will be much appreciated


Option Explicit

Dim marketChanging As Boolean, currentMarket As String

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
'Application.Calculation = xlCalculationManual

Dim BA_Array() As Variant, increment As Long, c As Object, firstaddress As String

If Target.Columns.count = 16 Then


With ThisWorkbook.Sheets(Target.Worksheet.Name)

BA_Array = .Range("A1:BZ55").Value 'read whole block A1:BZ55 Once ONLY (can make as large or small as required)


If BA_Array(2, 59) <= 520 And BA_Array(2, 6) <> "Closed" Then
.Range("Q2").Value = "FULL-STREAM-ON"
Else
.Range("Q2").Value = "FULL-STREAM-OFF"
End If


If BA_Array(2, 5) = "In Play" And BA_Array(2, 6) = "" Then
'do nothing (this is most frequent scenario so stop further IF statements)

ElseIf BA_Array(2, 5) = "In Play" And BA_Array(2, 6) = "Closed" Then
If Not marketChanging Then
marketChanging = True
currentMarket = BA_Array(1, 1)
.Range("Q2").Value = -1
Else
If BA_Array(1, 1) <> currentMarket Then marketChanging = False
End If

ElseIf BA_Array(2, 5) = "In Play" And BA_Array(2, 6) = "Suspended" Then
If Not marketChanging Then
marketChanging = True
currentMarket = BA_Array(1, 1)
.Range("Q2").Value = -1
Else
If BA_Array(1, 1) <> currentMarket Then marketChanging = False
End If

ElseIf BA_Array(2, 5) = "Not In Play" And BA_Array(2, 6) = "Closed" Then
If Not marketChanging Then
marketChanging = True
currentMarket = BA_Array(1, 1)
.Range("Q2").Value = -1
Else
If BA_Array(1, 1) <> currentMarket Then marketChanging = False
End If
End If

....
mak
 
Posts: 1086
Joined: Tue Jun 30, 2009 8:17 am

Re: API NG

Postby alrodopial » Sat Jul 22, 2017 2:08 pm

I think it will still move to the next race
In your code the paragraph before the last one and the one before it they can be combined with something like this
Code: Select all
ElseIf BA_Array(2, 5) = "In Play" And (BA_Array(2, 6) = "Closed" Or BA_Array(2, 6) = "Suspended" ) Then
................
alrodopial
 
Posts: 1353
Joined: Wed Dec 06, 2006 9:59 pm

Re: API NG

Postby mak » Sat Jul 22, 2017 2:19 pm

Geia soy Al;exandre

it moves to next market, but it is not working properly. I don't know where the problem is
but the refresh rate is almost 2 every 2 seconds..
if i delete all the code and just place in q2 = FULL-STREAM-ON
it is updating fast

something is wrong in my code
but I can not fix it..

any help is welcome.

Really OSknows is still here? :)
mak
 
Posts: 1086
Joined: Tue Jun 30, 2009 8:17 am

Re: API NG

Postby mak » Sat Jul 22, 2017 2:23 pm

Al
if you understand my code and can fix it. please do so pal
thanks
mak
 
Posts: 1086
Joined: Tue Jun 30, 2009 8:17 am

Re: API NG

Postby alrodopial » Sat Jul 22, 2017 6:17 pm

I don't see any mistakes in the code
Does the 520 in cell (2,59) is a counter with secs before the official off?
do you want full stream on 520secs before the official off till the actual end of the race or only while in running?
alrodopial
 
Posts: 1353
Joined: Wed Dec 06, 2006 9:59 pm

Re: API NG

Postby mak » Sun Jul 23, 2017 4:24 pm

very confused.
without the code
just 3 spreadsheets
the server cpu usage was 100% and everything stuck

had to use me original version and bots. is this the case? BA was updating very fast but excel was very slow instead..

regarding the coding, yes I need full stream 4-5 min before the start and during the race and then move to the next market
the problem (i think) it was that my code place the "FULL-STREAM-ON every 1 sec (update of excel?) something like this
mak
 
Posts: 1086
Joined: Tue Jun 30, 2009 8:17 am

Re: API NG

Postby Captain Sensible » Sun Jul 23, 2017 4:56 pm

You can always stop it resubmitting the full stream on just by adding another variable to track the status something like


Dim Streaming As Variant

If BA_Array(2, 59) <= 520 And BA_Array(2, 6) <> "Closed" Then
.Range("Q2").Value = "FULL-STREAM-ON"

If Streaming="OFF" Then Streaming="ON"

Else
If Streaming="ON" Then .Range("Q2").Value = "FULL-STREAM-OFF"
Streaming="OFF"



End If
User avatar
Captain Sensible
 
Posts: 2883
Joined: Sat Nov 19, 2005 2:29 pm

Re: API NG

Postby alrodopial » Sun Jul 23, 2017 5:09 pm

I'll give it a try
back tomorrow
alrodopial
 
Posts: 1353
Joined: Wed Dec 06, 2006 9:59 pm

Re: API NG

Postby alrodopial » Sun Jul 23, 2017 6:36 pm

I didn't test it so it will probably have problems
I kept only the variables needed for the current part of code
I placed the "Application.EnableEvents = False" inside the 16 columns update
Tell me if it's working and how is the CPU usage

Code: Select all
Dim marketChanging As Boolean, currentMarket As String, triggerInQ2 As Variant

Private Sub Worksheet_Change(ByVal Target As Range)
   
    If Target.Columns.Count = 16 Then
        Dim BA_Array() As Variant, MyQ2 As Variant
        Application.EnableEvents = False
        With ThisWorkbook.Sheets(Target.Worksheet.Name)
       
            BA_Array = .Range("A1:BZ55").Value ' this read is probably too much for every update while full stream is on
           
            If BA_Array(2, 59) <= 520 And Target(2, 6) <> "Closed" Then
                MyQ2 = "FULL-STREAM-ON"
            Else
                MyQ2 = "FULL-STREAM-OFF"
            End If
           
            If Target(2, 5) = "In Play" And Target(2, 6) = "" Then ' is this If statement needed????
                ' ...........
            ElseIf (Target(2, 5) = "In Play" And Target(2, 6) = "Suspended") Or Target(2, 6) = "Closed" Then
                If Not marketChanging Then
                    marketChanging = True
                    currentMarket = Target(1, 1)
                    MyQ2 = -1
                Else
                    If Target(1, 1) <> currentMarket Then marketChanging = False
                End If
            End If
           
            If triggerInQ2 <> MyQ2 Then
                .Range("Q2").Value = MyQ2
                triggerInQ2 = MyQ2
            End If
            ' ..........
        End With
        ' ..........
        Application.EnableEvents = True
    End If
       
End Sub
alrodopial
 
Posts: 1353
Joined: Wed Dec 06, 2006 9:59 pm

PreviousNext

Return to Discussion

Who is online

Users browsing this forum: No registered users and 13 guests

Sports betting software from Gruss Software


The strength of Gruss Software is that it’s been designed by one of you, a frustrated sports punter, and then developed by listening to dozens of like-minded enthusiasts.

Gruss is owned and run by brothers Gary and Mark Russell. Gary discovered Betfair in 2004 and soon realised that using bespoke software to place bets was much more efficient than merely placing them through the website.

Gary built his own software and then enhanced its features after trialling it through other Betfair users and reacting to their improvement ideas, something that still happens today.

He started making a small monthly charge so he could work on it full-time and then recruited Mark to help develop the products and Gruss Software was born.

We think it’s the best of its kind and so do a lot of our customers. But you can never stand still in this game and we’ll continue to improve the software if any more great ideas emerge.