I am using betfairlightwieght in python for connecting to Betfair exchange API. First let me highlight what I want to accomplish
- I want to track whenever a new order is placed on a particular market using my account
- If the order is placed from 5 minutes before the market starts up to 30 seconds in play, I would like to get the details of this order and copy this order on other exchanges
To achieve the above-mentioned target, I need to be aware of new orders and the information on the market, precisely when it goes in-play. My idea was to start multiple order streams one for each market. This way, I could periodically check the status of markets if they have gone in-play and when to stop copying orders onto other exchanges. However, it seems impossible to filter the order stream with market id by looking at the documentation. Is there any neat solution that I can use to perform this task?
My second concern is the discovery of new orders.
- How do I know that a particular
ocevent corresponds to a new order? - I would also like to find its bet id, price and size.
- I would also like to see if it was a back bet or a lay bet.
Can anyone please guide where can I get answers to these questions? Do I have to call the Web API in the callback of the order stream to fetch the complete details? I do know that the order stream and runner id is returned by the streaming API but not the bet id or order id as shown below
{'op': 'ocm', 'id': 1, 'clk': 'ANgEAPsFAIMFANsFALcF', 'pt': 1691152809440,
'oc': [
{'fullImage': True,
'id': '1.216676618',
'orc': [
{'fullImage': True,
'id': 772619,
'uo': [
{'id': '315758955164',
'p': 5, 's': 28.57,
'side': 'L', 'status': 'EC',
'pt': 'L', 'ot': 'L', 'pd': 1691152809000, 'md': 1691152809000, 'avp': 4.6,
'sm': 28.57, 'sr': 0, 'sl': 0, 'sc': 0, 'sv': 0, 'rac': '', 'rc': 'REG_GGC', 'rfo': '266843',
'rfs': '83_IPBC2FL'}],
'ml': [[4.6, 28.57]]}]}]}