Betfair API-NG

Post Reply
User avatar
jimibt
Posts: 3641
Joined: Mon Nov 30, 2015 6:42 pm
Location: Narnia

Dallas wrote:A easy way for anyoine who is worried about this is to use the old school method of putting funds into a market well outside the price but using a simple automation file.

Add Prem Lge title market or similar to guardian

At 12:30 rule places a lay at 1.01 for a liability of 80% (or how ever much you want to safe guard) - at 21:30 it cancels all unmatched bets so returns all money back to your betting bank.

Next morning re-apply the rule to the same market and let it repeat the process
dallas, a worthwhile approach for a single transaction based scenario and definitely a useful tip. the way i use the wallet is that each time i hit a predefined p&l, i transfer the surplus funds out to the AUS wallet. likewise, should the p&l (balance) on the UK wallet drop below a pre-defined threshold, i then effectively close the day by transeferring all funds over to the AUS wallet. this has happened on several occassions. so without an active/dynamic api method, none of this is possible.

fingers xx'd that BF devs (who will be squirming at paddy power's top nobs directive) will push for some compromise until they act in a diligent manner and offer level 1 protection for the active wallet via the api method pencilled to be implemented in FEB 2017 (yes, you read that correctly!)
User avatar
gazuty
Posts: 2547
Joined: Sun Jun 26, 2011 11:03 am
Location: Green land :)

Just catching up on all this. I had noticed there are "test" markets each day in Australia at the moment each morning when I load up markets.
Bet Angel
Bet Angel
Bet Angel
Posts: 3999
Joined: Tue Apr 14, 2009 3:47 pm

The 'test' markets have the AUS country code but are hosted by the UK exchange and use the UK wallet. They seem to work as expected - useful from our development point of view to test that AUS quick picks will still work etc.
LinusP
Posts: 1871
Joined: Mon Jul 02, 2012 10:45 pm

There is some mention of how the new 'async bet placement' will work here:

https://forum.bdp.betfair.com/showthrea ... #post13884
Ok - after further discussion with Betfair, I need to correct/clarify my earlier statement.

It would appear that async bet placement will NOT return a BetId when the call is made.

Instead, it is expected that you will supply a CustomerRef as part of the bet placement call. You will then be able to use the CustomerRef to retrieve the current status of the bet via the standard listCurrentOrders call.

The response received when the bet is placed will re-iterate the bet delay so you know how long to wait in order to query the status of the bet.

Of course, this means that the CustomerRef will have to be persistent, which is another of the changes that are about to be implemented.

If the market suspends during the bet delay period (i.e. between the bet being placed and it hitting the exchange), then the bet will lapse.
As far as I my programs are concerned I don't see the point as it will not prevent the need of a new thread and having a thread running for 200ms compared to 1-8s is meaningless to me. Unless I am missing a benefit this brings?
xitian
Posts: 457
Joined: Fri Jul 08, 2011 2:08 pm

For me I think it might simplify things slightly. I already make my bet placements asynchronous, but have to do that manually using language features and tracking personal betIds to match up when the bet requests eventually complete.

I think Betfair's asynchronous bet placement will work well with their streaming API because you can then use it to fire off a bet with no delay, and then wait for the order status to be reported as soon as it's completed. I won't need to faff with my own asynchronous calls and can use their CustomerRef instead of my own implementation.

I agree that the asynchronous bet placement part isn't that useful though. It's really the CustomerRef that's the handy bit. That and the 'StrategyRef'. Especially when things go tits up and you have to restart a program. At the moment it can be impossible to recover your position and book keeping when starting from zero local information (and in particular when you run multiple strategies on one account).
LinusP
Posts: 1871
Joined: Mon Jul 02, 2012 10:45 pm

Web app example posted on betfairs github:

https://github.com/betfair/sample-web-app-vendor

Any plans for a betangel web app in the future Peter?
User avatar
jimibt
Posts: 3641
Joined: Mon Nov 30, 2015 6:42 pm
Location: Narnia

c# example on github from a few days back... good basic usage example that will no doubt grow:

https://github.com/betfair/stream-api-sample-code
User avatar
Euler
Posts: 24704
Joined: Wed Nov 10, 2010 1:39 pm
Location: Bet Angel HQ

LinusP wrote:Any plans for a betangel web app in the future Peter?
Currently tackling streaming.
User avatar
LeTiss
Posts: 5386
Joined: Fri May 08, 2009 6:04 pm

Euler wrote:
Currently tackling streaming.
Really?

Whilst that would be an extraordinary addition to the software, that must be grossly expensive surely?
User avatar
Euler
Posts: 24704
Joined: Wed Nov 10, 2010 1:39 pm
Location: Bet Angel HQ

LeTiss 4pm wrote:Whilst that would be an extraordinary addition to the software, that must be grossly expensive surely?
Yep, anything to do with the software always is :) It's a bugger to test on Bet Angel as well!
User avatar
Euler
Posts: 24704
Joined: Wed Nov 10, 2010 1:39 pm
Location: Bet Angel HQ

At the end of the day, the software has always been a long-term project for us and subscriptions help fund that longer term goal. But a cash cow, it ain't!
xitian
Posts: 457
Joined: Fri Jul 08, 2011 2:08 pm

Whoop whoop! CustomerStrategyRef and CustomerOrderRef now released.

http://forum.bdp.betfair.com/showthread.php?t=3278

Might be a handy feature if BetAngel would let you tag your bets with different strategy names so that you can compare performance easier. Maybe a bit niche for most people though.
LinusP
Posts: 1871
Joined: Mon Jul 02, 2012 10:45 pm

Async bet placement released tomorrow as well.

Not sure if I a man going to use the new ref attributes, as i handle everything off the betId.
xitian
Posts: 457
Joined: Fri Jul 08, 2011 2:08 pm

For me, it's always been a tricky problem reconciling bets on my end with an ID that isn't available until the bet placement procedure is fully complete (e.g. until 1 second later for in-play racing). During that waiting time, I don't want to be blocking, since I could be trading other runners or races, but I want to know that I have a bet pending. When that bet finally completes all I have is a betId from Betfair, but no easy way to determine what strategy that bet should relate to.

I guess I could have a thread for every horse I'm trading, but then I would end up needing over 1000 threads to trade all runners at once. I also might be trading different strategies on a single runner within one program.

There's the other edge case which has happened before where Betfair matching engine has been hugely bogged down and not returned bets until over 60 seconds later and given a timeout response in the meantime. In this situation I have no betId at all for the actual request, I just have a random bet appearing out of nowhere over 60 seconds later with no way to relate it back to my strategies' positions.

Now, with customerOrderRef and customerStrategyRef, I don't need to worry with betIds so much. I know that any order I place I'm giving them a customerOrderRef, and whenever a bet appears I can match that up to whichever strategy is waiting for it. In effect it's making asynchronous bet placement easier.

I can also restart my programs because although I may have bets for multiple strategies on one runner, through the customerOrderRef and customerStrategyRef I can recover where the program was before the restart. With just a betId, I'm lost unless I'm writing all this info to database or something.
LinusP
Posts: 1871
Joined: Mon Jul 02, 2012 10:45 pm

Interesting to hear how your programs work, as mentioned before I use an event driven framework so I do things slightly differently.

When one of my strategies receives an event that triggers an order it creates an order data structure (size/price/orderType) along with what I call a 'letter', this stores info on how this order should be processed later (fillkill/stop/greening/batching etc.)

The order and the letter get chucked in a queue, when processed in the main handler it starts a new thread to be executed. When the betId is returned the letter which holds the order and any related orders gets stored and is used when processing currentOrders, thread then dies. The order/letter data is then also sent to a RestAPI which I use for reconciliation and tracking profitability per strategy.

I suppose I could create an internal orderId and match it up when processing currentOrders but I am not seeing the benefit at the moment. I only operate in short lived markets, inplay horse racing, so I don't need to rebuild my order book if my programs need to be restarted, although this would be possible using my api.
Post Reply

Return to “Betfair Exchange API”