betcode-org / flumine

flūmine - Betting trading framework
MIT License
173 stars 60 forks source link

place_order intermittently failing with INVALID_CUSTOMER_ORDER_REF #721

Closed andrewl36 closed 10 months ago

andrewl36 commented 10 months ago

place_order is intermittently failing with:

{"asctime": "2023-11-11 15:25:56,077", "levelname": "INFO", "message": "Order Place: FAILURE", "bet_id": null, "order_id": "1072113949238803678", "status": "FAILURE", "error_code": "INVALID_CUSTOMER_ORDER_REF"}

eg.

{"asctime": "2023-11-11 15:36:27,470", "levelname": "INFO", "message": "execute_place", "trading_function": "place", "elapsed_time": 0.04289555549621582, "response": {"customerRef": "6895902bcff244f399e876a2681865ee", "status": "FAILURE", "errorCode": "BET_ACTION_ERROR", "marketId": "1.221015979", "instructionReports": [{"status": "FAILURE", "errorCode": "INVALID_CUSTOMER_ORDER_REF", "instruction": {"selectionId": 10627289, "handicap": 0.0, "limitOrder": {"size": 6.59, "price": 12.0, "persistenceType": "LAPSE"}, "customerOrderRef": "653232d17db55-1096362547267675917", "orderType": "LIMIT", "side": "LAY"}}]}, "order_package": {"id": "6895902b-cff2-44f3-99e8-76a2681865ee", "client": "<flumine.clients.betfairclient.BetfairClient object at 0xffffb6d03c40>", "market_id": "1.221015979", "orders": ["1096362547267675917"], "order_count": 1, "package_type": "Place", "customer_strategy_ref": "AAAA", "bet_delay": 0, "market_version": null, "retry": true, "retry_count": 0, "async": false}}

It looks like this recent change to use uuid4().time rather than uuid1().time, uuid4().time sometimes returns 19 chars. https://github.com/betcode-org/flumine/commit/c9598216206bb9bf523e7721d412b1ef1f54e759