Skip to content

[WIP] Fix event ID handling in Bayse bot order placement - #9

Merged
coderhema merged 1 commit into
mainfrom
copilot/fix-event-id-handling-bayse-bot
Apr 11, 2026
Merged

[WIP] Fix event ID handling in Bayse bot order placement#9
coderhema merged 1 commit into
mainfrom
copilot/fix-event-id-handling-bayse-bot

Conversation

Copilot AI commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Original prompt

The Bayse bot is still returning 400 invalid event ID on order placement. Please inspect bot/bayse_client.py, bot/telegram_handler.py, and bot/main.py, then fix the event_id/market_id handling end to end.

Requirements:

  1. Add debug logging in the Bayse client so every order request logs the exact event_id, market_id, and final URL path before the request is sent.
  2. Make the order URL construction robust by normalizing and URL-encoding the event_id and market_id path segments before sending the request.
  3. Remove any fallback that uses market_id as a substitute for event_id or vice versa. The event_id used for /pm/events/{eventId}/markets/{marketId}/orders must come from the canonical stored event context, not the market id.
  4. In Telegram trade-context handling, preserve the canonical event_id across callbacks and text replies, and if event_id is missing, surface a clear error instead of silently sending a malformed order.
  5. Add or update tests so the trade-context resolution keeps event_id stable and order submission uses the canonical event_id.

The bug appears to be a persistence/mismatch issue rather than a Bayse API issue. Please keep the fix minimal and targeted, but make sure it fully closes the mismatch.

@coderhema
coderhema marked this pull request as ready for review April 11, 2026 06:23
@coderhema
coderhema merged commit 5a157cc into main Apr 11, 2026
1 check failed
Copilot AI requested a review from coderhema April 11, 2026 06:23
Copilot stopped work on behalf of coderhema due to an error April 11, 2026 06:23
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

Successfully merging this pull request may close these issues.

2 participants