Skip to content

fix(main): read balance instead of nonexistent balance_dollars field - #1

Open
mikepapierz-web wants to merge 1 commit into
yllvar:mainfrom
mikepapierz-web:main
Open

fix(main): read balance instead of nonexistent balance_dollars field#1
mikepapierz-web wants to merge 1 commit into
yllvar:mainfrom
mikepapierz-web:main

Conversation

@mikepapierz-web

Copy link
Copy Markdown

Summary

  • main.py checked for a balance_dollars key in the /portfolio/balance response to size the bot's bankroll off the live account balance
  • Kalshi's API does not return that field -- it returns balance as integer cents (confirmed against a live account, and against this repo's own bot_state.py, which already reads raw.get("balance") correctly elsewhere)
  • Because the check always failed, the bot silently fell back to the hardcoded BANKROLL config default on every run instead of ever using the real account balance for position sizing

Fix

  • Check 'balance' in balance_response and convert cents to dollars, matching the convention already used in bot_state.py

Test plan

  • Verified live against a real Kalshi account that /portfolio/balance returns balance (cents), not balance_dollars
  • Confirmed the corrected field name matches the pattern already used elsewhere in this repo (bot_state.py:43)

Kalshi's /portfolio/balance response has no balance_dollars key, only
balance (integer cents). The stale field check always failed, so the
bot silently fell back to the hardcoded BANKROLL default instead of
sizing off the live account balance.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

1 participant