Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partially matched order moved with replace_order fails with Violation, but was successfully submitted to Betfair #536

Open
andrewl36 opened this issue Dec 6, 2021 · 3 comments

Comments

@andrewl36
Copy link

I noticed Flumine thought there was a violation, but the 0.76 at 9.2 was submitted to Betfair successfully.
Scenario:

  • place_order
  • (8.33 of 9.09 matched)
  • replace_order at new price
  • Violation
  • (but 0.76 bet does seem to have been submitted to Betfair with no violation)
{"asctime": "2021-12-06 12:38:31,994", "levelname": "INFO", "message": "Order status update: Replacing", "market_id": "1.192007223", "selection_id": 40591700, "handicap": 0, "id": "138580870758044860", "customer_order_ref": "7838b70723767-138580870758044860", "bet_id": "252796883204", "date_time_created": "2021-12-06 12:37:55.804553", "publish_time": "2021-12-06 12:37:55.719000", "market_version": null, "async": false, "trade": {"id": "1505f056-5691-11ec-aefe-1596f5449619", "strategy": "DogValueUKLive", "place_reset_seconds": 0.0, "reset_seconds": 0.0, "orders": ["138580869664600151", "138580870030631170", "138580870394886050", "138580870758044860"], "offset_orders": [], "notes": "", "market_notes": "7.4,10.5,None", "status": "Live", "status_log": "Pending, Live, Pending, Live, Pending, Live, Pending, Live"}, "order_type": {"order_type": "Limit", "price": 9.0, "size": 9.09, "persistence_type": "LAPSE", "time_in_force": null, "min_fill_size": null, "bet_target_type": null, "bet_target_size": null}, "info": {"side": "LAY", "size_matched": 8.33, "size_remaining": 0.7599999999999998, "size_cancelled": 0.0, "size_lapsed": 0.0, "size_voided": 0.0, "average_price_matched": 9}, "responses": {"date_time_placed": "2021-12-06 12:37:55.804701", "elapsed_seconds_executable": null}, "runner_status": null, "status": "Replacing", "status_log": "Pending, Executable, Replacing", "violation_msg": null, "simulated": {"profit": 0.0, "piq": 0.0, "matched": []}, "notes": "593,6,A2", "market_notes": "5.6,15,13"}
{"asctime": "2021-12-06 12:38:31,995", "levelname": "INFO", "message": "Thread pool submit", "trading_function": "execute_replace", "session": "<requests.sessions.Session object at 0x7f70a05f2910>", "latency": 0.0006, "order_package": {"id": "6bc4e258-5691-11ec-aefe-1596f5449619", "client": "<flumine.clients.betfairclient.BetfairClient object at 0x7f70a1fea880>", "market_id": "1.192007223", "orders": ["138580870758044860"], "order_count": 1, "package_type": "Replace", "customer_strategy_ref": "******", "bet_delay": 0, "market_version": null, "retry": true, "retry_count": 0, "async": false}, "thread_pool": {"num_threads": 2, "work_queue_size": 1}}
{"asctime": "2021-12-06 12:38:31,995", "levelname": "INFO", "message": "Latency log", "trading_function": "replace", "session": "<requests.sessions.Session object at 0x7f70a05f2910>", "latency": 0.0007, "order_latency": [36.1912], "order_package": {"id": "6bc4e258-5691-11ec-aefe-1596f5449619", "client": "<flumine.clients.betfairclient.BetfairClient object at 0x7f70a1fea880>", "market_id": "1.192007223", "orders": ["138580870758044860"], "order_count": 1, "package_type": "Replace", "customer_strategy_ref": "******", "bet_delay": 0, "market_version": null, "retry": true, "retry_count": 0, "async": false}, "thread_pool": {"num_threads": 2, "work_queue_size": 0}}
{"asctime": "2021-12-06 12:38:31,996", "levelname": "INFO", "message": "1 order packages executed in transaction", "market_id": "1.192007223", "order_packages": [{"id": "6bc4e258-5691-11ec-aefe-1596f5449619", "client": "<flumine.clients.betfairclient.BetfairClient object at 0x7f70a1fea880>", "market_id": "1.192007223", "orders": ["138580870758044860"], "order_count": 1, "package_type": "Replace", "customer_strategy_ref": "******", "bet_delay": 0, "market_version": null, "retry": true, "retry_count": 0, "async": false}], "transaction_id": 8}
{"asctime": "2021-12-06 12:38:32,252", "levelname": "INFO", "message": "execute_replace", "trading_function": "replace", "elapsed_time": 0.25606608390808105, "response": {"customerRef": "6bc4e258569111ecaefe1596f5449619", "status": "SUCCESS", "marketId": "1.192007223", "instructionReports": [{"status": "SUCCESS", "cancelInstructionReport": {"status": "SUCCESS", "instruction": {"betId": "252796883204"}, "sizeCancelled": 0.76, "cancelledDate": "2021-12-06T12:38:32.000Z"}, "placeInstructionReport": {"status": "SUCCESS", "instruction": {"selectionId": 40591700, "limitOrder": {"size": 0.76, "price": 9.2, "persistenceType": "LAPSE"}, "orderType": "LIMIT", "side": "LAY"}, "betId": "252796925203", "placedDate": "2021-12-06T12:38:32.000Z", "averagePriceMatched": 0.0, "sizeMatched": 0.0, "orderStatus": "EXECUTABLE"}}]}, "order_package": {"id": "6bc4e258-5691-11ec-aefe-1596f5449619", "client": "<flumine.clients.betfairclient.BetfairClient object at 0x7f70a1fea880>", "market_id": "1.192007223", "orders": ["138580870758044860"], "order_count": 1, "package_type": "Replace", "customer_strategy_ref": "******", "bet_delay": 0, "market_version": null, "retry": true, "retry_count": 0, "async": false}}
{"asctime": "2021-12-06 12:38:32,253", "levelname": "INFO", "message": "Trade status update: Pending", "id": "1505f056-5691-11ec-aefe-1596f5449619", "strategy": "DogValueUKLive", "place_reset_seconds": 0.0, "reset_seconds": 0.0, "orders": ["138580869664600151", "138580870030631170", "138580870394886050", "138580870758044860"], "offset_orders": [], "notes": "", "market_notes": "7.4,10.5,None", "status": "Pending", "status_log": "Pending, Live, Pending, Live, Pending, Live, Pending, Live, Pending"}
{"asctime": "2021-12-06 12:38:32,253", "levelname": "INFO", "message": "Order Cancel: SUCCESS", "bet_id": "252796883204", "order_id": "138580870758044860", "status": "SUCCESS", "error_code": null}
{"asctime": "2021-12-06 12:38:32,253", "levelname": "INFO", "message": "Order status update: Execution complete", "market_id": "1.192007223", "selection_id": 40591700, "handicap": 0, "id": "138580870758044860", "customer_order_ref": "7838b70723767-138580870758044860", "bet_id": "252796883204", "date_time_created": "2021-12-06 12:37:55.804553", "publish_time": "2021-12-06 12:37:55.719000", "market_version": null, "async": false, "trade": {"id": "1505f056-5691-11ec-aefe-1596f5449619", "strategy": "DogValueUKLive", "place_reset_seconds": 0.0, "reset_seconds": 0.0, "orders": ["138580869664600151", "138580870030631170", "138580870394886050", "138580870758044860"], "offset_orders": [], "notes": "", "market_notes": "7.4,10.5,None", "status": "Pending", "status_log": "Pending, Live, Pending, Live, Pending, Live, Pending, Live, Pending"}, "order_type": {"order_type": "Limit", "price": 9.0, "size": 9.09, "persistence_type": "LAPSE", "time_in_force": null, "min_fill_size": null, "bet_target_type": null, "bet_target_size": null}, "info": {"side": "LAY", "size_matched": 8.33, "size_remaining": 0.0, "size_cancelled": 0.76, "size_lapsed": 0.0, "size_voided": 0.0, "average_price_matched": 9}, "responses": {"date_time_placed": "2021-12-06 12:37:55.804701", "elapsed_seconds_executable": null}, "runner_status": null, "status": "Execution complete", "status_log": "Pending, Executable, Replacing, Execution complete", "violation_msg": null, "simulated": {"profit": 0.0, "piq": 0.0, "matched": []}, "notes": "593,6,A2", "market_notes": "5.6,15,13"}
{"asctime": "2021-12-06 12:38:32,253", "levelname": "INFO", "message": "Order Replace: SUCCESS", "bet_id": null, "order_id": "138580871122536900", "status": "SUCCESS", "error_code": null}
{"asctime": "2021-12-06 12:38:32,254", "levelname": "INFO", "message": "Order status update: Pending", "market_id": "1.192007223", "selection_id": 40591700, "handicap": 0, "id": "138580871122536900", "customer_order_ref": "7838b70723767-138580871122536900", "bet_id": "252796925203", "date_time_created": "2021-12-06 12:38:32.253759", "publish_time": "2021-12-06 12:38:32.186000", "market_version": null, "async": false, "trade": {"id": "1505f056-5691-11ec-aefe-1596f5449619", "strategy": "DogValueUKLive", "place_reset_seconds": 0.0, "reset_seconds": 0.0, "orders": ["138580869664600151", "138580870030631170", "138580870394886050", "138580870758044860", "138580871122536900"], "offset_orders": [], "notes": "", "market_notes": "7.4,10.5,None", "status": "Pending", "status_log": "Pending, Live, Pending, Live, Pending, Live, Pending, Live, Pending"}, "order_type": {"order_type": "Limit", "price": 9.2, "size": 0.76, "persistence_type": "LAPSE", "time_in_force": null, "min_fill_size": null, "bet_target_type": null, "bet_target_size": null}, "info": {"side": "LAY", "size_matched": 0.0, "size_remaining": 0.76, "size_cancelled": 0.0, "size_lapsed": 0.0, "size_voided": 0.0, "average_price_matched": 0.0}, "responses": {"date_time_placed": "2021-12-06 12:38:32.253906", "elapsed_seconds_executable": null}, "runner_status": null, "status": "Pending", "status_log": "Pending", "violation_msg": null, "simulated": {"profit": 0.0, "piq": 0.0, "matched": []}, "notes": "593,6,A2", "market_notes": null}
{"asctime": "2021-12-06 12:38:32,254", "levelname": "INFO", "message": "Order status update: Executable", "market_id": "1.192007223", "selection_id": 40591700, "handicap": 0, "id": "138580871122536900", "customer_order_ref": "7838b70723767-138580871122536900", "bet_id": "252796925203", "date_time_created": "2021-12-06 12:38:32.253759", "publish_time": "2021-12-06 12:38:32.186000", "market_version": null, "async": false, "trade": {"id": "1505f056-5691-11ec-aefe-1596f5449619", "strategy": "DogValueUKLive", "place_reset_seconds": 0.0, "reset_seconds": 0.0, "orders": ["138580869664600151", "138580870030631170", "138580870394886050", "138580870758044860", "138580871122536900"], "offset_orders": [], "notes": "", "market_notes": "7.4,10.5,None", "status": "Pending", "status_log": "Pending, Live, Pending, Live, Pending, Live, Pending, Live, Pending"}, "order_type": {"order_type": "Limit", "price": 9.2, "size": 0.76, "persistence_type": "LAPSE", "time_in_force": null, "min_fill_size": null, "bet_target_type": null, "bet_target_size": null}, "info": {"side": "LAY", "size_matched": 0.0, "size_remaining": 0.76, "size_cancelled": 0.0, "size_lapsed": 0.0, "size_voided": 0.0, "average_price_matched": 0.0}, "responses": {"date_time_placed": "2021-12-06 12:38:32.253906", "elapsed_seconds_executable": null}, "runner_status": null, "status": "Executable", "status_log": "Pending, Executable", "violation_msg": null, "simulated": {"profit": 0.0, "piq": 0.0, "matched": []}, "notes": "593,6,A2", "market_notes": "7.2,13,9"}
{"asctime": "2021-12-06 12:38:32,254", "levelname": "INFO", "message": "Trade status update: Live", "id": "1505f056-5691-11ec-aefe-1596f5449619", "strategy": "DogValueUKLive", "place_reset_seconds": 0.0, "reset_seconds": 0.0, "orders": ["138580869664600151", "138580870030631170", "138580870394886050", "138580870758044860", "138580871122536900"], "offset_orders": [], "notes": "", "market_notes": "7.4,10.5,None", "status": "Live", "status_log": "Pending, Live, Pending, Live, Pending, Live, Pending, Live, Pending, Live"}
{"asctime": "2021-12-06 12:39:08,358", "levelname": "INFO", "message": "Order status update: Violation", "market_id": "1.192007223", "selection_id": 40591700, "handicap": 0, "id": "138580871122536900", "customer_order_ref": "7838b70723767-138580871122536900", "bet_id": "252796925203", "date_time_created": "2021-12-06 12:38:32.253759", "publish_time": "2021-12-06 12:38:32.186000", "market_version": null, "async": false, "trade": {"id": "1505f056-5691-11ec-aefe-1596f5449619", "strategy": "DogValueUKLive", "place_reset_seconds": 0.0, "reset_seconds": 0.0, "orders": ["138580869664600151", "138580870030631170", "138580870394886050", "138580870758044860", "138580871122536900"], "offset_orders": [], "notes": "", "market_notes": "7.4,10.5,None", "status": "Live", "status_log": "Pending, Live, Pending, Live, Pending, Live, Pending, Live, Pending, Live"}, "order_type": {"order_type": "Limit", "price": 9.2, "size": 0.76, "persistence_type": "LAPSE", "time_in_force": null, "min_fill_size": null, "bet_target_type": null, "bet_target_size": null}, "info": {"side": "LAY", "size_matched": 0.0, "size_remaining": 0.76, "size_cancelled": 0.0, "size_lapsed": 0.0, "size_voided": 0.0, "average_price_matched": 0.0}, "responses": {"date_time_placed": "2021-12-06 12:38:32.253906", "elapsed_seconds_executable": null}, "runner_status": null, "status": "Violation", "status_log": "Pending, Executable, Violation", "violation_msg": null, "simulated": {"profit": 0.0, "piq": 0.0, "matched": []}, "notes": "593,6,A2", "market_notes": "7.2,13,9"}
{"asctime": "2021-12-06 12:39:08,359", "levelname": "WARNING", "message": "Order has violated: ORDER_VALIDATION Error: Order size is less than min bet size (2) or payout (10) for currency", "control": "ORDER_VALIDATION", "error": "Order size is less than min bet size (2) or payout (10) for currency", "order": {"market_id": "1.192007223", "selection_id": 40591700, "handicap": 0, "id": "138580871122536900", "customer_order_ref": "7838b70723767-138580871122536900", "bet_id": "252796925203", "date_time_created": "2021-12-06 12:38:32.253759", "publish_time": "2021-12-06 12:38:32.186000", "market_version": null, "async": false, "trade": {"id": "1505f056-5691-11ec-aefe-1596f5449619", "strategy": "DogValueUKLive", "place_reset_seconds": 0.0, "reset_seconds": 0.0, "orders": ["138580869664600151", "138580870030631170", "138580870394886050", "138580870758044860", "138580871122536900"], "offset_orders": [], "notes": "", "market_notes": "7.4,10.5,None", "status": "Live", "status_log": "Pending, Live, Pending, Live, Pending, Live, Pending, Live, Pending, Live"}, "order_type": {"order_type": "Limit", "price": 9.2, "size": 0.76, "persistence_type": "LAPSE", "time_in_force": null, "min_fill_size": null, "bet_target_type": null, "bet_target_size": null}, "info": {"side": "LAY", "size_matched": 0.0, "size_remaining": 0.76, "size_cancelled": 0.0, "size_lapsed": 0.0, "size_voided": 0.0, "average_price_matched": 0.0}, "responses": {"date_time_placed": "2021-12-06 12:38:32.253906", "elapsed_seconds_executable": null}, "runner_status": null, "status": "Violation", "status_log": "Pending, Executable, Violation", "violation_msg": "Order has violated: ORDER_VALIDATION Error: Order size is less than min bet size (2) or payout (10) for currency", "simulated": {"profit": 0.0, "piq": 0.0, "matched": []}, "notes": "593,6,A2", "market_notes": "7.2,13,9"}}

@andrewl36
Copy link
Author

@liampauling Does the above log indicate it wasn't Flumine that issued the Violation, as it went Executeable? However, why then did betfair show the bet submitted?

@liampauling
Copy link
Member

Very tricky to debug this, it seems everything is valid up until the last two lines, something else (not the first replace) is causing that violation, can you add more logs to your strategy to try and work out what it is?

@andrewl36
Copy link
Author

I'll try and work something out, I only saw the issue by chance and it only happened once yesterday. I'll keep an eye out of Lapse'd bets in betfair, as my strategy should cancel them before the off, but with the above Flumine is not aware of it as it thought it had been a violation...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants