betangel api - bet persistence

We were all new to Bet Angel once. Ask any question you like here and fellow forum members promise not to laugh. Betfair trading made simple.
Post Reply
Power99
Posts: 4
Joined: Sat Aug 30, 2025 6:37 am

HI,
Guys, Im really struggling and cannot make chatgpt help me.
I am successfully pushing my football bets in-play to betfair via betangel api + python script.
However, I also want these bets to have persistence to stay on the market for eg if goal is scored etc

Can this KEEP bet persistence passed together in the moment bets are pushed?

Or I must push bets, then request via betangel api their id and only then apply KEEP?
What is correct flag by the way for this operation?


Image
sniffer66
Posts: 1841
Joined: Thu May 02, 2019 8:37 am

Its in modify bets, using the MarketId and BetRef

http://localhost:9000/api/betting/v1.0/modifyBets {"marketId":"","async":false,"betsToModify":[{"betRef":"","newAtInplayOption":"KEEP"}]}

So place the bet, get the id and modify it. You can't do it in the same request as placing the bet unfortunately
Power99
Posts: 4
Joined: Sat Aug 30, 2025 6:37 am

sniffer66 wrote:
Sun Nov 23, 2025 9:28 am
Its in modify bets, using the MarketId and BetRef

http://localhost:9000/api/betting/v1.0/modifyBets {"marketId":"","async":false,"betsToModify":[{"betRef":"","newAtInplayOption":"KEEP"}]}

So place the bet, get the id and modify it. You can't do it in the same request as placing the bet unfortunately
Wow, thanks so much, I tried really hard to explain it to chatgpt, it kept sending me lots of code variations... but nothing.
when i showed him your template everything worked!
sniffer66
Posts: 1841
Joined: Thu May 02, 2019 8:37 am

Power99 wrote:
Sun Nov 23, 2025 9:44 am
sniffer66 wrote:
Sun Nov 23, 2025 9:28 am
Its in modify bets, using the MarketId and BetRef

http://localhost:9000/api/betting/v1.0/modifyBets {"marketId":"","async":false,"betsToModify":[{"betRef":"","newAtInplayOption":"KEEP"}]}

So place the bet, get the id and modify it. You can't do it in the same request as placing the bet unfortunately
Wow, thanks so much, I tried really hard to explain it to chatgpt, it kept sending me lots of code variations... but nothing.
when i showed him your template everything worked!
Good stuff. Glad it helped
Power99
Posts: 4
Joined: Sat Aug 30, 2025 6:37 am

In order to make sscript find relevant market I must keep A LOT of markets in Guardian.
So, when bets are pushed to the market, Guardian cannot notify the script about unmatched bets before Guardian updates the market itself.
In busy days, it takes a lot of time for Guardian to update the market\bets info, because of the long queue, so the script cannot set KEEP in play status "fairly quickly".

Is there any way to FORCE Guardian to refresh this particular market\bets info after bets are pushed?
Or is there a better workaround?
sniffer66
Posts: 1841
Joined: Thu May 02, 2019 8:37 am

Power99 wrote:
Sat Nov 29, 2025 4:50 am
In order to make sscript find relevant market I must keep A LOT of markets in Guardian.
So, when bets are pushed to the market, Guardian cannot notify the script about unmatched bets before Guardian updates the market itself.
In busy days, it takes a lot of time for Guardian to update the market\bets info, because of the long queue, so the script cannot set KEEP in play status "fairly quickly".

Is there any way to FORCE Guardian to refresh this particular market\bets info after bets are pushed?
Or is there a better workaround?
A few things you can do to speed things up. Are you streaming with 20ms refresh and do you have Restrict Refresh setup in Guardian so you arent polling matches 3 hours away or before you need to get data from them ?

One other thing I do is set up a text Stored value in my baf that is set when I know the market is never going to be entered i.e 15m in to a match and my rules only trigger prior to that. I name mine "RemoveMe", and then get my code to look for that Stored Value and if set run:

http://localhost:9000/api/guardian/v1.0/removeMarkets {"marketsFilter":{"filter":"SPECIFIED_IDS","ids":[]},"marketStatus":"ANY"}

and just send that marketId in the payload

That keeps Guardian and the Watch List clean, stops unnecessary polling and speeds things up, especially on a busy Saturday
User avatar
jamesedwards
Posts: 4964
Joined: Wed Nov 21, 2018 6:16 pm

Power99 wrote:
Sat Nov 29, 2025 4:50 am
In order to make sscript find relevant market I must keep A LOT of markets in Guardian.
So, when bets are pushed to the market, Guardian cannot notify the script about unmatched bets before Guardian updates the market itself.
In busy days, it takes a lot of time for Guardian to update the market\bets info, because of the long queue, so the script cannot set KEEP in play status "fairly quickly".

Is there any way to FORCE Guardian to refresh this particular market\bets info after bets are pushed?
Or is there a better workaround?
Yes you can set the market to open in a one-click screen or ladder which will prioritise the refresh of that market.
Post Reply

Return to “Bet Angel for newbies / Getting started”