Multiple bets being placed using placeBet

Please post any questions regarding the program here.

Moderator: 2020vision

Multiple bets being placed using placeBet

Postby rhysw » Thu Sep 24, 2020 4:24 am

I have a spreadsheet that uses placeBet COM function (rather than the Excel triggers) and when I first link it to BA it will place not one bet per selection but two bets. If I press the cancel all button it will then only place one bet per selection (as desired) so it seems this is a bug that occurs when the spreadsheet first connects to BA. Does anyone have any ideas on how to prevent the double bet?
rhysw
 
Posts: 21
Joined: Tue Jun 30, 2020 12:48 pm

Re: Multiple bets being placed using placeBet

Postby Captain Sensible » Thu Sep 24, 2020 9:11 am

If you're using worksheet change/calculate to trigger your code remember that BA sends two updates to excel on each refresh. One for price data and one for bet data.
User avatar
Captain Sensible
 
Posts: 2883
Joined: Sat Nov 19, 2005 2:29 pm

Re: Multiple bets being placed using placeBet

Postby rhysw » Thu Sep 24, 2020 12:33 pm

I did not know this. Is there a way to separate the two updates? Could I just use the ba_pricesUpdated event for placing bets and worksheet change for cancelling bet and greening up?
rhysw
 
Posts: 21
Joined: Tue Jun 30, 2020 12:48 pm

Re: Multiple bets being placed using placeBet

Postby Captain Sensible » Thu Sep 24, 2020 12:44 pm

Most of us simply exit the Worksheet_Change routine if it's not the data refresh we want.

The price data is in the first fresh and covers cell A1:P & whatever you last row is, that is 16 columns so you'll see people putting this in their code

Code: Select all
Private Sub Worksheet_Change(ByVal Target As Range)

[b]If Target.Columns.Count <> 16 Then Exit Sub[/b]
............................rest of code



The second set of data is the bet data, I find this more useful to use as all data is updated by then. The data updated in this set is variable and depends on how many additional columns you have sent to excel like SP , Saddlecloth etc.
User avatar
Captain Sensible
 
Posts: 2883
Joined: Sat Nov 19, 2005 2:29 pm

Re: Multiple bets being placed using placeBet

Postby Captain Sensible » Thu Sep 24, 2020 12:48 pm

If you want to see how many Target.Columns are being sent you can use VBA's debug.print feature and it will output to the intermediate window.

Debug.Print Target.Columns.Address will print the addresses

Debug.Print Target.Columns.Count will give the number of columns updated on each excel dataset, just use the second one which will be 6 or higher depnding on the number of additional columns you have sent to excel

If Target.Columns.Count <> 6 (or whaterver number) Then Exit Sub
User avatar
Captain Sensible
 
Posts: 2883
Joined: Sat Nov 19, 2005 2:29 pm

Re: Multiple bets being placed using placeBet

Postby rhysw » Thu Sep 24, 2020 8:00 pm

I'm using code this at the start of my sheet:

Code: Select all
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Columns.Count = 16 Then
        Application.EnableEvents = False


so wouldn't that contain the price update in the 16 columns? Or should I change it to

Code: Select all
if Target.Columns.Count <> 16 then exit sub


thank you very much for helping me
rhysw
 
Posts: 21
Joined: Tue Jun 30, 2020 12:48 pm

Re: Multiple bets being placed using placeBet

Postby Captain Sensible » Thu Sep 24, 2020 8:10 pm

They'd both do the same thing I just find it easier to do the latter and exit the sub rather than have the code in an if loop.

If that code was already sheet there must be another reason why the sheet is placing two bets.
User avatar
Captain Sensible
 
Posts: 2883
Joined: Sat Nov 19, 2005 2:29 pm

Re: Multiple bets being placed using placeBet

Postby rhysw » Fri Sep 25, 2020 10:54 am

The double betting only occurs when the sheet is first linked to BA, if I cancel them and the sheet re-bets then only 1 bet per selection is place thereafter
rhysw
 
Posts: 21
Joined: Tue Jun 30, 2020 12:48 pm

Re: Multiple bets being placed using placeBet

Postby Captain Sensible » Fri Sep 25, 2020 11:44 am

I'd look at whatever routine is being used to trigger bets then as it's obviously present when the sheet links to BA, maybe data from the previous market whenever the sheet was last saved. That's why a lot of us set variables to ensure bets are only fired on new markets and once or however many times we need.

i.e. once a bet has fired we'd set a variable fired to true then when the market changes reset it to false. Something like

If bet_fired=false and Our_bet_criteria_met=True Then
fire_bets
bet_fired=true
end if

Then when the market changes we'd reset bets_fired=false for the next market.
User avatar
Captain Sensible
 
Posts: 2883
Joined: Sat Nov 19, 2005 2:29 pm

Re: Multiple bets being placed using placeBet

Postby cjones198 » Wed Dec 02, 2020 10:14 pm

this is happening to me, did you ever solve it?
cjones198
 
Posts: 102
Joined: Wed Aug 05, 2020 10:02 pm


Return to Help

Who is online

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

cron