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