Is this possible?

Discussion regarding the spreadsheet functionality of Bet Angel.
Post Reply
mazdaq100
Posts: 12
Joined: Sat Aug 01, 2009 9:37 am

Just wondering if it would be possible to write a spreadsheet which would interact with Betangel to do the following:

-check every horse race 5 minutes before the off;
-lay the favourite for a set liability if the odds on the favourite are below X and there are 2 other horses in the race which have odds below Y

I would want to be able to set this up in the morning and just leave it to place the bets during the afternoon.

Is this possible? If so, is Excel the best way to do this? Can anyone give me any pointers on how to do this?

Thanks.
mazdaq100
Posts: 12
Joined: Sat Aug 01, 2009 9:37 am

OK, I've worked out how to automatically load each horse race into Guardian and then into the BetAngel_Multiple spreadsheet. And I think I can work out a formula to identify whether my conditions have been met.

But how do I get it to automatically identify the favourite and place a lay bet if the conditions have been met?
mazdaq100
Posts: 12
Joined: Sat Aug 01, 2009 9:37 am

I'm almost there with figuring this out. The last problem I need to solve is how to automatically delete "PLACED" from the Status cells when the next race is loaded up.

I am trying to write a code to delete the Status cells when B1 (which displays the race details) changes. At the moment I have the following:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("B1")) Is Nothing Then
Application.EnableEvents = False
Range("O6,O9,O11,O13,O15,O17,O19,O21,O23,O25,O27,O29,O31,O33,O35,O37,O39,O41,O43,O45,O47,O49,O51,O53,O55,O57,O59,O61,O63,O65,O67").Select
Selection.ClearContents
End If
Application.EnableEvents = True
End Sub


But at the moment, it is deleting the Status cells over and over, so multiple bets are being placed.

Can anyone with a better knowledge of Excel than me tell what is wrong with above code? I need to amend it so it deletes the Status cells once when the new race loads up and then not again until the next race.
Mug
Posts: 182
Joined: Wed Mar 31, 2010 9:53 am

I'm not an Excel expert but I would think you want to put some timing into the code to only get it to clear the cell every X seconds or something? If you clear straight away Bet Angel is going to dump 50 billions orders into the market so it would seem to make sense to only clear now and again or to some sort of cycle?
mazdaq100
Posts: 12
Joined: Sat Aug 01, 2009 9:37 am

Hi

Thanks for your reply. Yes I've been thinking about using time to delay it. I'm also considering using a macro instead to delete the status cells once every 5 minutes.

The macro works but i'm struggling to work out how to run it every 5 minutes. If anyone has some advice, I'd really appreciate it.

Thanks.
nigelk
Posts: 469
Joined: Wed Apr 15, 2009 11:00 pm

You could always store the race name/type in sheet 2, and check it against the one that is showing on the Bet Angel sheet. If it's the same, do nothing, if it's different, clear the status cells.

Private Sub Worksheet_Change(ByVal Target As Range)

If IsEmpty(Sheets("sheet2").Range("b1")) Then
Sheets("sheet2").Range("b1") = Sheets("Bet Angel").Range("b1")
End If

If Sheets("sheet2").Range("b1") <> Sheets("Bet Angel").Range("b1") Then

Application.EnableEvents = False

Range("O6,O9,O11,O13,O15,O17,O19,O21,O23,O25,O27,O29,O31,O33,O35,O37,O39,O41,O43,O45
,O47,O49,O51,O53,O55,O57,O59,O61,O63,O65,O67").ClearContents

Sheets("sheet2").Range("b1") = Range("b1")

End If

Application.EnableEvents = True

End Sub


The first "if" checks to see if sheet2 is empty,if it is, put the race name in.

Second "if" , checks if name matches/does not match

If it does, do nothing
If it's different, clear the statuts cells, then put the current name showing into sheet 2

Hope it helps.
Nigel
nigelk
Posts: 469
Joined: Wed Apr 15, 2009 11:00 pm

A slightly quicker way to clear all those 'placed' indicators and without having to stipulate all of the cells.

Private Sub Worksheet_Change(ByVal Target As Range)

If IsEmpty(Sheets("sheet2").Range("b1")) Then
Sheets("sheet2").Range("b1") = Sheets("Bet Angel").Range("b1")
End If

If Sheets("sheet2").Range("b1") <> Sheets("Bet Angel").Range("b1") Then
Application.EnableEvents = False

Cells.Replace What:="Placed", Replacement:="", LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False


Sheets("sheet2").Range("b1") = Range("b1")

End If
Application.EnableEvents = True
End Sub

Of course, if you have a horse called "Placed" it'll clear that as well, but we can't have everything!
mazdaq100
Posts: 12
Joined: Sat Aug 01, 2009 9:37 am

Thanks Nigel, used your first method and it works like a dream! It was doing my head in, I had found a bodged way round it but it was by no means perfect whereas this way is.

Thanks again, really appreciate it.
Post Reply

Return to “Bet Angel - Spreadsheet / Excel chat”