Place double BACK Bet problem

Discussion regarding the spreadsheet functionality of Bet Angel.
Post Reply
rain91
Posts: 124
Joined: Tue Feb 07, 2017 7:11 pm

Hi,
many times i see in log, my excel placed double BACK bets in same time (same second) / same selection.
This is my VBA, where is the problem?

BACK bet placing:

Code: Select all

If Range("CY" & i) = "BACK" And Range("L" & i) = "" And Range("O" & i) = "" Then
Range("L" & i) = "BACK"
Range("M" & i) = Range("CZ" & i)
Range("N" & i) = Range("DA" & i)
End If
Status cell clear (clear cells if L=BACK, O=PLACED and unmatched or matched bets placed)

Code: Select all

If Range("L" & i)= "BACK" And Range("O" & i) = "PLACED" And Range("DC" & i + 1) <> Range("DB" & i + 1) Then
Range("DC" & i + 1) = Range("DB" & i + 1)
Range("L" & i).ClearContents
Range("M" & i).ClearContents
Range("N" & i).ClearContents
Range("O" & i).ClearContents
End If
DB = Current unmatched + matched BETs
DC = Last unmatched + matched BETs
Wolf1877
Posts: 370
Joined: Fri Sep 08, 2017 10:59 am

Your 1st code snippet is loading the Bet Command into columns L:N conditional on columns L and O being blank/clear and column CY containing "BACK"
Your 2nd code snippet is clearing the columns L:O contents when status is confirmed as PLACED and number of matched and unmatched bets has changed

What is stopping your first code snippet running again after the 2nd snippet has run and cleared down cells L:O ?
You dont show how your column CY is changed to something other than BACK to stop the bet retriggering (or what sets column CY to BACK) - thats what you need to focus on.

A possible solution might be to amend your first snippet to something like the following when loading cells L:N so that code can never retrigger until CY is set to BACK again.

Code: Select all

If Range("CY" & i) = "BACK" And Range("L" & i) = "" And Range("O" & i) = "" Then
Range("CY" & i) = "Submitted"  ' < this will stop above condition retriggering until CY is set to BACK again 
Range("L" & i) = "BACK"
Range("M" & i) = Range("CZ" & i)
Range("N" & i) = Range("DA" & i)
End If
rain91
Posts: 124
Joined: Tue Feb 07, 2017 7:11 pm

Hello,
in CY cells i have a Function, so i dont know write a "Submitted" text.
one item from the CY: "=IF(V10=0;"BACK";"").

After the first BACK bet, the "O" cells not cleared until i dont get matched or unmatched bets at right, and if i have umatched bets, i dont get "BACK" in CY cells.

So, i dont understand, why give me double bets in 2 second? (14:28:30 and 14:28:32 unmatched bets, and later matched: 16:03:04
asd.PNG
db.PNG
You do not have the required permissions to view the files attached to this post.
Wolf1877
Posts: 370
Joined: Fri Sep 08, 2017 10:59 am

If you are using an excel function to set cell CY then you cannot use my precise suggestion of assigning "Submitted" into that cell value to prevent your double bet issue. But you could use an unused spare blank cell instead to track bet submission status and then change your bet placement code to check that cell instead.

See image below which is a summary of actual trading activity on Got Trumped and Jimmil captured via my own Excel/Guardian processing at around the time of your double bet issues. (I assume your timings must be CET and mine are GMT). As you can see from my data bets were being matched on those horses at around the time of your double bet issue. You cant take my timings for these trades as 100% accurate to the second but they are accurate to within about 5 seconds as my Guardian was cycling through 40 plus races. I do gather more accurate more accurate data over the last 20 minutes before the off.
Trades.PNG
Looking at your "unmatched bets" on Got Trumped. Just because your bets were "Entirely unmatched" when they reached the market doesnt mean that they were not then matched within a second or two as a bot may have come in to take that money. Your code snippet 2 would reset cells L:O to blank as soon as the bet was placed then when your first bet got matched the unmatched bets column V would be set to 0 again by Bet Angel Guardian and then your bet placement conditions in code snippet 1 would be true again resulting in a 2nd bet being placed whenever code snippet 1 was executed.

I am confident that I have pointed you in the right direction but you do need to figure the fine details of your code logic error out for yourself.
You do not have the required permissions to view the files attached to this post.
rain91
Posts: 124
Joined: Tue Feb 07, 2017 7:11 pm

Hi,

now i have functions in L &M & N cells, and i clear only the "O" cells, if its PLACED. But i have double bets...

condition in L cells: if V10=0, then "BACK"

condition in VBA for clearing PLACED:

...

Code: Select all

If Range("O" & i) = "PLACED" And Range("DC" & i + 1) <> Range("DB" & i + 1) Then
Range("DC" & i + 1) = Range("DB" & i + 1)
Range("O" & i).ClearContents
End If
...
in DB i have a function:
DB=V10

If unmatched BACK cells count is changed, then clear "PLACED"

But i get double BACK in many times. Why?
Thanks.

(in multiple spreadsheet get this problem, single it is good...)

Thank you!
Wolf1877
Posts: 370
Joined: Fri Sep 08, 2017 10:59 am

rain91 wrote:
Tue Jan 14, 2020 1:05 pm
Hi,
many times i see in log, my excel placed double BACK bets in same time (same second) / same selection.
This is my VBA, where is the problem?

BACK bet placing:

Code: Select all

If Range("CY" & i) = "BACK" And Range("L" & i) = "" And Range("O" & i) = "" Then
Range("L" & i) = "BACK"
Range("M" & i) = Range("CZ" & i)
Range("N" & i) = Range("DA" & i)
End If
Status cell clear (clear cells if L=BACK, O=PLACED and unmatched or matched bets placed)

Code: Select all

If Range("L" & i)= "BACK" And Range("O" & i) = "PLACED" And Range("DC" & i + 1) <> Range("DB" & i + 1) Then
Range("DC" & i + 1) = Range("DB" & i + 1)
Range("L" & i).ClearContents
Range("M" & i).ClearContents
Range("N" & i).ClearContents
Range("O" & i).ClearContents
End If
DB = Current unmatched + matched BETs
DC = Last unmatched + matched BETs
rain91 wrote:
Sat Jan 18, 2020 3:05 pm
one item from the CY: "=IF(V10=0;"BACK";"").

After the first BACK bet, the "O" cells not cleared until i dont get matched or unmatched bets at right, and if i have umatched bets, i dont get "BACK" in CY cells.
rain91 wrote:
Tue Jan 21, 2020 10:43 am
in DB i have a function:
DB=V10


If unmatched BACK cells count is changed, then clear "PLACED"

But i get double BACK in many times. Why?
Thanks.

(in multiple spreadsheet get this problem, single it is good...)
Your comments highlighted in blue above contradict themselves.
DB9 (and then DC9) is assigned from V10 (Bet Angel UNMATCHED BETS ONLY as populated by Guardian NOT UNMATCHED + MATCHED BETS).

Your code to clear down cells L9:O9 is dependent on cell V10 (UNMATCHED BETS) changing from its previous value and "PLACED" in O9.


So consider these scenarios before placement of your first bet.

Scenario A
(1) V10 (unmatched bets) is zero, DB9 (copied from V10) is zero, DC9 is zero, L9:O9 are blank. So your CY code Loads a Bet Instruction into cells L9:O9
(2) Guardian sends Bet #1 off to Betfair and it is PLACED but UNMATCHED or part UNMATCHED on initial load. So Guardian loads PLACED into O9 and 1 into V10 (and DB)
(3) DB9 is 1, DC9 is 0 and O9 is PLACED so your L9:O9:cleardown code runs and DC gets set to 1
(4) Within a few seconds (or milliseconds) your bet gets matched in the marketplace. Guardian sets V10 to 0 again (and DB9 to 0)
(5) V10 (unmatched bets) is zero, DB9 (copied from V10) is zero, DC9 is 1 from step(3) above, L9:O9 are blank again (also from 3 above). So your CY code Loads another Bet Instruction into cells L9:O9
(6) Guardian sends Bet #2 off to Betfair etc

Scenario B
(1) V10 (unmatched bets) is zero, DB9 (copied from V10) is zero, DC9 is zero, L9:O9 are blank. So your CY code Loads a Bet Instruction into cells L9:O9
(2) Guardian sends Bet #1 off to Betfair and it is PLACED and FULLY MATCHED on initial load. So Guardian loads PLACED into O9 and 0 into V10 (and DB)
(3) DB9 is 0, DC9 is 0 and O9 is PLACED so your L9:O9:cleardown code DOES NOT RUN because DB9=DC9 - and no further bets are triggered becuase you never clear down L9:O9
Post Reply

Return to “Bet Angel - Spreadsheet / Excel chat”