Recording odds increase/decrease in x seconds

Please post any questions regarding the program here.

Moderator: 2020vision

Recording odds increase/decrease in x seconds

Postby MiniBlueDragon » Sun Oct 13, 2013 5:21 pm

I'm toying with the idea of recording the % increase/decrease in odds over x number of seconds both before the off and in play for a specific runner. I currently use the Worksheet_Change method to track my Max Bank via this code:

'Check current Bank and if it's higher than existing Max Bank, update Max Bank
If Worksheets("Gruss").Range("I2").Value > Worksheets("Gruss").Range("U1").Value Then
Worksheets("Gruss").Range("U1").Value = Worksheets("Gruss").Range("I2").Value
End If

I'm thinking it may be possible to do something similar but for the odds. Any suggestions on how I can tweak the above code (or even if it'll work) please?
MiniBlueDragon
 
Posts: 130
Joined: Tue Jul 05, 2011 1:14 pm
Location: London

Postby MiniBlueDragon » Sun Oct 13, 2013 6:46 pm

Just found this thread so will start using that as a basis and grab odds instead I reckon. :)
MiniBlueDragon
 
Posts: 130
Joined: Tue Jul 05, 2011 1:14 pm
Location: London

Postby MiniBlueDragon » Sun Oct 13, 2013 10:06 pm

MiniBlueDragon
 
Posts: 130
Joined: Tue Jul 05, 2011 1:14 pm
Location: London

Postby MiniBlueDragon » Mon Oct 14, 2013 12:49 pm

OK I'm stuck. The basic code in that example spreadsheet seems to make sense but for some reason it's not working with BA for Betdaq.

Code: Select all
Option Explicit

Dim totalMatched As Variant
Dim totalMatchedDiff(54, 0) As Double
Dim currentMarket As String

Private Sub Worksheet_Change(ByVal Target As Range)
    Dim r As Integer, marketChanged As Boolean
    If Target.Columns.Count = 16 Then
        If [A1] <> currentMarket Then
            currentMarket = [A1]
            marketChanged = True
        Else
            marketChanged = False
        End If
        For r = 5 To 54
            If marketChanged Then
                totalMatchedDiff(r - 5, 0) = 0
            Else
                totalMatchedDiff(r - 5, 0) = Cells(r, 16).Value - totalMatched(r - 4, 1)
            End If
        Next
        totalMatched = Range(Cells(5, 16), Cells(54, 16)).Value
        Application.EnableEvents = False
        Range(Cells(5, 26), Cells(54, 26)) = totalMatchedDiff
        Application.EnableEvents = True
    End If
End Sub
MiniBlueDragon
 
Posts: 130
Joined: Tue Jul 05, 2011 1:14 pm
Location: London

Postby MiniBlueDragon » Thu Oct 24, 2013 7:37 pm

No ideas on this vba gurus? I'm completely stumped. :/
MiniBlueDragon
 
Posts: 130
Joined: Tue Jul 05, 2011 1:14 pm
Location: London

Postby alrodopial » Thu Oct 24, 2013 11:19 pm

BA for Betdaq is a bit different I think, others that use Betdaq will help you tomorrow.
alrodopial
 
Posts: 1384
Joined: Wed Dec 06, 2006 9:59 pm

Postby osknows » Fri Oct 25, 2013 8:44 am

What happens when the code runs in Betdaq? It works okay here?

The variable Dim totalMatchedDiff(54, 0) As Double might throw an error if the type is not a double but apart from that it should work.
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby kiint » Fri Oct 25, 2013 9:00 am

Is it the line:
totalMatchedDiff(r - 5, 0) = Cells(r, 16).Value - totalMatched(r - 4, 1)

First time through it will think the market has changed, hit this line and it won't have had an array assigned to it yet.

Other than that I don't know. What error are you getting? Bit difficult to identify the problem without knowing the symptoms.
kiint
 
Posts: 148
Joined: Tue Feb 23, 2010 12:12 am

Postby MiniBlueDragon » Fri Oct 25, 2013 9:54 am

There's no specific 'error' so that's why I haven't reported one; it just doesn't ever update the "Total matched increase" figures.

I'll run it this morning and report back if there's anything else.
MiniBlueDragon
 
Posts: 130
Joined: Tue Jul 05, 2011 1:14 pm
Location: London

Postby MiniBlueDragon » Fri Oct 25, 2013 10:18 am

Yep as above. I have the spreadsheet logging prices for the first race of the day and £188.78 just got matched on the third selection (from 0 matched) and the "Total matched increase" column just doesn't update. :(
MiniBlueDragon
 
Posts: 130
Joined: Tue Jul 05, 2011 1:14 pm
Location: London

Postby osknows » Fri Oct 25, 2013 10:32 am

Is it doing what you expect?

On the first refresh, as it's a new market then nothing is calculated and output is zero. However, it records the matched amounts ready for the next refresh.

On the second refresh, assuming no changes in matched amount, then it's comparing the same matched amount to the first refresh, therefore zero change.

Whenever there is a change it lasts for a single refresh then resets to zero.
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby MiniBlueDragon » Fri Oct 25, 2013 10:59 am

If I comment out the "Option Explicit" at the beginning after having it running for a while I suddenly get a flood of backed-up information in the "Total amount matched" column but again the "Total matched increase" never changes from 0 at all.

I normally troubleshoot using debug.Print to output variables and see what's happening but even that isn't working with the spreadsheet. :/

Even breakpoints aren't being hit now. :?
MiniBlueDragon
 
Posts: 130
Joined: Tue Jul 05, 2011 1:14 pm
Location: London

Postby osknows » Fri Oct 25, 2013 11:18 am

Not sure what problems you're having. You may need to check the events are firing by using Application.EnableEvents = True


What is it your trying to measure exactly? The current code is calculating the difference in amount matched between each refresh. So if there is no change then it will display 0. If you need to measure the change over a longer period than a single refresh then this code won't do that.
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby MiniBlueDragon » Fri Oct 25, 2013 11:49 am

For now all I want to do is get this speadsheet running and from there I'll be looking into customising it for odds movements.

I know what the spreadsheet is supposed to do and that it's the difference in matched between each refresh but it's never changing for any runner on any refresh at all.

The Application.EnableEvents = False isn't until the bottom of the code and only while it updates the sheet itself so I assume everything else in there before it's switched off, the sheet is updated and it's switched on again should be firing as normal.

I'm wondering if perhaps there's something in there which is Betfair only and that's why it's not working for Betdaq?
MiniBlueDragon
 
Posts: 130
Joined: Tue Jul 05, 2011 1:14 pm
Location: London

Postby osknows » Fri Oct 25, 2013 11:59 am

There's nothing wrong with code, itt works fine in both Betdaq and Betfair here.
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Next

Return to Help

Who is online

Users browsing this forum: No registered users and 29 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.