Betfair API-NG

Post Reply
xitian
Posts: 457
Joined: Fri Jul 08, 2011 2:08 pm

Which modification are you referring to there, Peter? There's a few things mentioned.

- Potential to place bets smaller than £2 if payout >£10
Useful if you often trade at higher priced odds and want to hedge more accurately.

- customerStrategyRef
Potentially crucial for tracking different strategies using one account without getting into a mess if API goes tits up.

- Streaming API
For very time sensitive strategies you'd expect this to be a huge benefit. Hard to really measure in P&L terms though. For me I can't run two concurrent versions of my strategies (one with streaming and the other with traditional polling) because they'd compete with eachother. And backtest simulations show a positive increase in P&L but it's hard to accurately simulate such fast moving markets. I'm planning to move everything to streaming eventually just because it "makes sense".

In terms of whether the Streaming API is easy to implement for you depends entirely on how your code is structured. The API itself is more complex than the polling one though, as you have to get your head around keeping your cache of data up to date through changes you receive. Keeping the performance up while avoiding synchronisation issues is part of the challenge. Probably a simple task for a good programmer though!

On a separate note - Has anyone who's using the streaming API noticed that sometimes there's a drift in the Publish Time of the update messages. I compute the "lag" as the difference between message Publish Time and my server time, and find on some days this difference slowly increases throughout the day to several hundred milliseconds more compared to at the start of the day. Now it could be that the server clock (either my end or Betfair end) is simply drifting, or it could be that my message updates are getting slower and slower. Sometimes it happens, sometimes it doesn't though.

If anyone else has noticed this then I might ask the BDP team about it.
PeterLe
Posts: 3715
Joined: Wed Apr 15, 2009 3:19 pm

Hi Liam,

Ive really been focussing on my time this last twelve months. I decided that I would drop the manual trading completely and just use automation only
I set it up mid morning and thats that. I want to spend more time doing other things nowadays rather than be bound to my desk!

I did enjoy the C# programming course (took on UDEMY - excellent), and I can now edit my already built programs and get by. However, employing someone else to do it makes sense if its anything more than that. The guys out there can have it done whilst Im searching Google on how to do it!

Hi James,
Not seen you around for a while (think it was since you entered the VR world!), hope things are going well for you!

Im not too worried about the sub £2 bets. I can use betangel/Excel for that and it has severed me well over the years.

- CustomerStrategyRef
Not too worried about that either James. I have more than one account and I have a way of identifying which strategy triggered if there are more than one strategy running on a single account too.

- Streaming API
This is the bit that really interests me. We’re all looking for low latency with the fastest data possible; whilst it is a bit of an arms race if there is the slightest chance it will improve things; then it must be pursued and proven. 1ms is along time in this game as you know.
That last sentence you wrote (I'm planning to move everything to streaming eventually just because it "makes sense”) really resonants with me.
Ill wait a while, but I will look to adopt this too in the coming months

Thanks for the replies

Regards
Peter
xitian
Posts: 457
Joined: Fri Jul 08, 2011 2:08 pm

PeterLe wrote:Not seen you around for a while (think it was since you entered the VR world!)
Haha! Nah, I've been following the forum as I always do. It's helpful for keeping track of anything important happening, but I often don't have anything useful to add.

Let me update that other thread on my VR experiences ;)
Wainwright
Posts: 108
Joined: Mon Jan 23, 2012 1:10 pm

Xitian - I haven't looked at publish time vs m/c time so can't comment unfortunately. The comparison I did was to record data from the same markets using polling & streaming and then look (manually) at when changes in the order book were indicated by each (timestamped locally). Spot checking different markets over the course of about a week it was clear that streaming updates were quicker (10s of milliseconds on average).

Funnily enough P&L does seem to trail off toward the end of the day compared to the beginning since it's been live though. I've been putting this down to natural variance but maybe I should re-run the tests and check !!

Peter - I'd recommend if you're going to get someone to build a streaming API solution for you then you might as well get them to think multi-strategy & build customerStrategyRef in from the start, that way it will be more efficient from the outset and the number of strategies you can run won't be limited. It'll be interesting to see if BF will start to give a breakdown of P&L by strategy ref, it would make a lot of sense.
PeterLe
Posts: 3715
Joined: Wed Apr 15, 2009 3:19 pm

Wainwright wrote: Peter - I'd recommend ...
Thankyou Ill bear that in mind
Regards
Peter
xitian
Posts: 457
Joined: Fri Jul 08, 2011 2:08 pm

Wainwright wrote:It'll be interesting to see if BF will start to give a breakdown of P&L by strategy ref, it would make a lot of sense.
OMG, that would be my dream... As LinusP pointed out, they only mentioned customerStrategyRef being returned in the Streaming API which doesn't help retrieving the list later on after settlement.

Alternatively I've been considering asking them for a master/sub account set up. Didn't someone on here mention that one of the big syndicates has like 17 accounts or something?
LinusP
Posts: 1873
Joined: Mon Jul 02, 2012 10:45 pm

I hate the politics when it comes to multiple accounts, seems to come down to who you know.

Xitian, are you confident that you are processing your sockets quick enough as betfair is a lot more active in the evening/afternoon.
xitian
Posts: 457
Joined: Fri Jul 08, 2011 2:08 pm

LinusP wrote:Xitian, are you confident that you are processing your sockets quick enough as betfair is a lot more active in the evening/afternoon.
Hmm.. That's a good question. I'm fairly confident that I am. If I do get a clock drift then it seems to increase pretty constantly through the day, and if I don't get it at the start of the day then I don't get it at all.

As far as I've seen it's not related to the number of markets I'm subscribed to either, or whether a race is in-play.

I guess I need to repeat what Wainwright has done and compare polling against streaming at the same time over a period of a few days.
LinusP
Posts: 1873
Joined: Mon Jul 02, 2012 10:45 pm

As of Monday, Fill Kill bets available as well:
Fill or Kill bets
By setting the optional parameter ‘TimeInForce’ on a limitOrder submission to the value ‘FILL_OR_KILL’ and optionally passing a minFillSize value, the Exchange will only match the order if at least the specified minFillSize can be matched (if passed) or the whole order matched (if not). Any order which cannot be so matched, and any remaining unmatched part of the order (if minFillSize is specified) will be immediately cancelled.
Please note: the matching algorithm for Fill or Kill orders behaves slightly differently to that for standard limit orders. Whereas the price on a limit order represents the lowest price at which any fragment should be matched, the price on a Fill or Kill order represents the lower limit of the Volume Weighted Average Price (“VWAP”) for the entire volume matched. So, for instance, a Fill or Kill order with price = 5.4 and size = 10 might be matched as £2 @ 5.5, £6 @ 5.4 and £2 @ 5.3.
User avatar
Euler
Posts: 24816
Joined: Wed Nov 10, 2010 1:39 pm
Location: Bet Angel HQ

It's amazing how many features they have taken from the trading community.
LinusP
Posts: 1873
Joined: Mon Jul 02, 2012 10:45 pm

xitian wrote:
Wainwright wrote:It'll be interesting to see if BF will start to give a breakdown of P&L by strategy ref, it would make a lot of sense.
OMG, that would be my dream... As LinusP pointed out, they only mentioned customerStrategyRef being returned in the Streaming API which doesn't help retrieving the list later on after settlement.

Alternatively I've been considering asking them for a master/sub account set up. Didn't someone on here mention that one of the big syndicates has like 17 accounts or something?
CustomerStrategyRef has appeared in currentOrders and clearedOrders docs:

http://docs.developer.betfair.com/docs/ ... aredOrders

Looks like you can even use it as a search parameter which is awesome!
xitian
Posts: 457
Joined: Fri Jul 08, 2011 2:08 pm

Yay! Finally! Gotta start making use of it and fix all my dodgy order tracking code.

Thanks for spotting that!
LinusP
Posts: 1873
Joined: Mon Jul 02, 2012 10:45 pm

Removal of AUS endpoint, haven't given developers much time to implement. The removal of the AUS wallet is really really really annoying :x

https://forum.bdp.betfair.com/showthread.php?t=3246
User avatar
jimibt
Posts: 3675
Joined: Mon Nov 30, 2015 6:42 pm
Location: Narnia

LinusP wrote:Removal of AUS endpoint, haven't given developers much time to implement. The removal of the AUS wallet is really really really annoying :x

https://forum.bdp.betfair.com/showthread.php?t=3246
not sure if i'm totally up to speed on the implications here. does that mean that my safety net code (code that pushes funds in realtime from the UK wallet to the AUS wallet during the days racing) will no longer be functional?? i.e. will all the good work that i've undertaken to ensure that i have limited exposure via the UK wallet be rendered totally useless??
User avatar
Euler
Posts: 24816
Joined: Wed Nov 10, 2010 1:39 pm
Location: Bet Angel HQ

Yes!
Post Reply

Return to “Betfair Exchange API”