Difference in prices as ticks in Excel

Please post any questions regarding the program here.

Moderator: 2020vision

Difference in prices as ticks in Excel

Postby doris_day » Tue Jul 12, 2011 3:30 pm

I know about Gary's plus and minusTicks. Is there any way I can convert the following into tick values ? (PriceA-PriceB)

The answer is probably staring me in the face :)
'He was looking for the card so high and wild he'd never need to deal another' - Leonard Cohen
User avatar
doris_day
 
Posts: 968
Joined: Fri Nov 02, 2007 12:34 am

Postby osknows » Tue Jul 12, 2011 3:48 pm

There are 735 ticks in total. One way to do it is to list them in a column and use MATCH to find the row of each price. Then just minus one row from the other to find the tick difference.
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby mak » Tue Jul 12, 2011 4:07 pm

Probably I haven't understand right the question so my answer is wrong also :D

but there is a function GetTicks (don't remember right now the member - again probably was the Captain)

I am almost certain that you know about it
anyway here it is

Option Explicit

Function getOddsStepUp(ByVal odds As Currency) As Currency

Dim oddsInc As Currency
Select Case odds
Case 1 To 1.99
oddsInc = 0.01
Case 2 To 2.98
oddsInc = 0.02
Case 3 To 3.95
oddsInc = 0.05
Case 4 To 5.9
oddsInc = 0.1
Case 6 To 9.8
oddsInc = 0.2
Case 10 To 19.5
oddsInc = 0.5
Case 20 To 29
oddsInc = 1
Case 30 To 48
oddsInc = 2
Case 50 To 95
oddsInc = 5
Case 100 To 1000
oddsInc = 10
End Select
getOddsStepUp = oddsInc
End Function

Function getOddsStepDown(ByVal odds As Currency) As Currency
Dim oddsInc As Currency
Select Case odds
Case 1.01 To 2
oddsInc = 0.01
Case 2.02 To 3
oddsInc = 0.02
Case 3.05 To 4
oddsInc = 0.05
Case 4.1 To 6
oddsInc = 0.1
Case 6.2 To 10
oddsInc = 0.2
Case 10.5 To 20
oddsInc = 0.5
Case 21 To 30
oddsInc = 1
Case 32 To 50
oddsInc = 2
Case 55 To 100
oddsInc = 5
Case 110 To 1000
oddsInc = 10
End Select

getOddsStepDown = oddsInc
End Function



Function GetTicks(odds1 As Currency, odds2 As Currency) As Single
Dim i As Double
Dim tickCount As Single
Dim thisStep As Double
Dim thisodds As Double

Select Case odds2
Case Is < 1.01, Is > 1000
GoTo Xit
End Select

Select Case odds1
Case Is < 1.01, Is > 1000
GoTo Xit

Case Is < odds2
tickCount = 0
i = odds1
Do While i <> odds2
thisStep = getOddsStepUp(i)
i = i + thisStep
tickCount = tickCount + 1
Loop
GetTicks = tickCount

Case Is > odds2
tickCount = 0
i = odds1
Do While i <> odds2
thisStep = getOddsStepDown(i)
i = i - thisStep
tickCount = tickCount + 1
Loop
GetTicks = tickCount - (tickCount * 2)

Case Is = odds2
GetTicks = 0
End Select

Xit:
End Function



** Hi Os
Long time to "hear" from you
Hope you are fine
mak
 
Posts: 1086
Joined: Tue Jun 30, 2009 8:17 am

Postby osknows » Tue Jul 12, 2011 4:14 pm

I'm wrong about 735 ticks. Not sure what I was thinking there?

I good thanks Mak!
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby doris_day » Tue Jul 12, 2011 4:23 pm

Thanks mak. That works fine....
'He was looking for the card so high and wild he'd never need to deal another' - Leonard Cohen
User avatar
doris_day
 
Posts: 968
Joined: Fri Nov 02, 2007 12:34 am

Postby Captain Sensible » Tue Jul 12, 2011 7:54 pm

mak wrote:Probably I haven't understand right the question so my answer is wrong also :D

but there is a function GetTicks (don't remember right now the member - again probably was the Captain)


I wish it was me mak, I thought it was either osknows or Gary.

I added a routine to convert a value to valid odds increment if needed

Function getValidOdds(ByVal odds As Currency) As Currency
Dim oddsInc As Currency
Select Case odds
Case 1 To 1.99
oddsInc = 0.01
Case 2 To 2.99
oddsInc = 0.02
Case 3 To 3.999
oddsInc = 0.05
Case 4 To 5.9999
oddsInc = 0.1
Case 6 To 9.9999
oddsInc = 0.2
Case 10 To 19.9999
oddsInc = 0.5
Case 20 To 29.99999
oddsInc = 1
Case 30 To 49.999
oddsInc = 2
Case 50 To 99.9999
oddsInc = 5
Case 100 To 1000
oddsInc = 10
End Select
If Math.Round(odds + oddsInc, 2) <= 1000 Then
getValidOdds = Round(odds / oddsInc, 0) * oddsInc
Else
getValidOdds = 1000
End If
End Function
User avatar
Captain Sensible
 
Posts: 2923
Joined: Sat Nov 19, 2005 2:29 pm

Postby mak » Tue Jul 12, 2011 8:26 pm

Thanks Captain
very usefull

Doris there is deferences in tick increments between bf and bq

by the way i am writing with my new samsung galaxy s with android and itt is perfrect

sometimes it feels like laptop

highly recommended :)
mak
 
Posts: 1086
Joined: Tue Jun 30, 2009 8:17 am

Postby osknows » Tue Jul 12, 2011 10:07 pm

It's not my code - most likely Gary's. It's also a lot faster than my earlier suggestion of using a list and MATCH :)
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby dgs2001 » Tue Jul 12, 2011 10:52 pm

:D

I'll own up it was an adaptation of some of Garys code which I originally posted here :-

http://gruss-software.co.uk/forum/viewt ... t=getticks

It has been tidied up since, but I'm still prepared to stand up and claim it :D :D :D

Duncan
User avatar
dgs2001
 
Posts: 334
Joined: Thu Apr 05, 2007 4:53 pm
Location: The Home Of National Hunt

Postby Captain Sensible » Wed Jul 13, 2011 12:43 pm

dgs2001 wrote::D

I'll own up it was an adaptation of some of Garys code which I originally posted here :-

http://gruss-software.co.uk/forum/viewt ... t=getticks

It has been tidied up since, but I'm still prepared to stand up and claim it :D :D :D

Duncan


Nice one Duncan, almost all of my bots use those snippets of code in some way or other these days :)
User avatar
Captain Sensible
 
Posts: 2923
Joined: Sat Nov 19, 2005 2:29 pm


Return to Help

Who is online

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