Skip to content

(feat) client methods for bot rate oracle config - #27

Open
cardosofede wants to merge 4 commits into
mainfrom
feat/bot-rate-oracle-config
Open

cardosofede wants to merge 4 commits into
mainfrom
feat/bot-rate-oracle-config

Conversation

@cardosofede

@cardosofede cardosofede commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Why

hummingbot/hummingbot-api#235 adds endpoints to configure the rate oracle of deployed bots (not the API's own pricing). Bots still run hummingbot's RateOracle from the conf_client.yml in their credentials profile, and until now nothing let a client read or change that source or global token. This PR adds the client side.

This must merge and be released together with hummingbot/hummingbot-api#235. Against an API without it, these methods return 404.

What

client.bot_orchestration gets three methods:

  • get_rate_oracle_sources() -> List[str]: GET /bot-orchestration/rate-oracle/sources
  • get_rate_oracle_config(account_name="master_account"): GET /bot-orchestration/rate-oracle/config. Returns account_name, rate_oracle_source, global_token and available_sources.
  • update_rate_oracle_config(account_name="master_account", rate_oracle_source=None, global_token_name=None, global_token_symbol=None): PUT /bot-orchestration/rate-oracle/config. Sends {rate_oracle_source: {name}, global_token: {global_token_name, global_token_symbol}} and leaves out any field that is None.

Also in this PR:

  • The vendored hummingbot-api-openapi.json now has the two new paths and their schemas. They were generated from the router and models on the API branch, so test_calls_match_api_spec checks the new calls.
  • The README's Bot Orchestration method list includes the new methods.
  • The version is bumped to 1.5.10 in both pyproject.toml and __version__. __version__ had been left at 1.5.8 by the 1.5.9 bump.

Also: client.system.get_system_info()

hummingbot/hummingbot-api#235 also adds GET /system/info, so a dashboard's Settings → Server panel can say what a server runs, not just which one it is talking to: the hummingbot-api version, the hummingbot library version behind it, and whether the image is the published one or something pinned on that box (today: ssh in and read docker inspect).

  • SystemRouter.get_system_info() -> Dict[str, Any]: GET /system/info, reached as client.system (new router, wired like the others, sync client included).

It returns api_version, hummingbot_version, docker_available, container (id, name, image, image_id, digest from RepoDigests, compose_project, compose_working_dir, compose_config_files) and pinned / pinned_reason / override_file. The route is read-only and degrades instead of failing: without docker.sock it answers docker_available: false with a null container and still reports both versions.

/system/info is added to the vendored spec in the position the API serves it, so test_calls_match_api_spec covers this call too. The version stays at 1.5.10.

Tests

  • pytest test: 345 passed.
  • With the spec from main, the three new calls fail test_the_route_the_call_addresses_is_served, which shows the spec test covers them.
  • A stubbed-router check confirmed the path, query and nested body each method sends.

🤖 Generated with Claude Code

…o 1.5.10

hummingbot-api#235 adds /bot-orchestration/rate-oracle/{sources,config}: deployed bots
still run hummingbot's RateOracle from the conf_client.yml of their credentials profile,
and these routes read and persist that source and global token.

- get_rate_oracle_sources()
- get_rate_oracle_config(account_name="master_account")
- update_rate_oracle_config(account_name="master_account", rate_oracle_source=None,
  global_token_name=None, global_token_symbol=None) -> PUT with only the fields given

The vendored openapi spec gains the two paths and their schemas (generated from the
API branch's router and models), so test_calls_match_api_spec covers the new calls.
__version__ had been left at 1.5.8 by the 1.5.9 bump; both now read 1.5.10.
hummingbot-api#235 adds GET /system/info: the API reports its own version, the
hummingbot library version behind it, and its own container as seen through the
mounted docker.sock (image, RepoDigests digest, compose project/working_dir/
config_files), plus whether that image is pinned -- built locally, or brought up with
a compose override file, which is then named. A dashboard's server panel can then say
what a server runs without anyone ssh-ing in to read `docker inspect`.

- SystemRouter.get_system_info() -> Dict[str, Any], reached as client.system

The route is read-only and degrades rather than failing: without docker.sock it answers
docker_available False with a null container and still reports both versions.

The vendored openapi spec gains /system/info (generated from the API branch's router)
in the position the API serves it, so test_calls_match_api_spec covers the new call.
Version left at 1.5.10, which this branch already bumped to.
…config

hummingbot-api now persists rate_limits_share_pct with the rest of a credentials
profile's client defaults, so a caller can set the share of each exchange's API rate
limit one bot instance may spend -- the knob that matters once several bots deploy from
the same account and start tripping the exchange's limiter.

Optional and omitted from the body when None, like every other field on this call, so a
caller that only changes the oracle source still sends only the oracle source. The API
enforces 0 < pct <= 100 (hummingbot's own ClientConfigMap bound, which the bot re-checks
when it reads the file back at startup) and answers 422 otherwise; the docstring says so
rather than duplicating the check here, where it would drift.

get_system_info's docstring gains market_data, the MARKET_DATA_* tunables as the API
process resolved them. Reported, never writable: the API's env_file is not mounted into
its container, so it cannot rewrite its own .env.

The vendored openapi spec is refreshed from the API branch these calls target, which is
the documented way to adopt an API change. Purely additive at the path level -- it also
picks up /performance/latest and /performance/history, which that branch already serves
and this spec had not been refreshed since.
…cked against

hummingbot-api can now replace its own container with the published image, so a server
that has drifted months behind can be upgraded without ssh. Three calls on client.system:

  get_upgrade_preflight()                     what it would cost, and whether it may run
  start_upgrade(acknowledge_executor_loss)    pull and hand the recreate to a helper
  get_upgrade_status()                        follow it, including across the restart

acknowledge_executor_loss defaults to False and is sent explicitly rather than omitted,
because the server treats an absent acknowledgement as consent withheld and refuses with
409. Defaulting it to True here would turn "I forgot the flag" into "close every running
executor as SYSTEM_CLEANUP", which is the one mistake this parameter exists to prevent.
The docstrings say what a refusal means -- nothing was pulled and nothing was changed --
so a caller that sees the 409 knows the server is exactly as it was and can offer the
acknowledgement rather than retry blindly.

The preflight is documented as never failing on a daemon problem: an unreachable Docker
daemon, a container the API cannot place, a registry it cannot read all come back as
can_upgrade False with a blocked_reason meant to be shown verbatim. A caller that treats
that as an error would render "this server's image is pinned by docker-compose.override.yml"
as an outage.

The vendored openapi spec gains the three routes, generated from the API branch's router
in the position it serves them, so test_calls_match_api_spec covers all three calls and
the one body key. Version left at 1.5.10.
@cardosofede

Copy link
Copy Markdown
Contributor Author

Brought up to date with hummingbot/hummingbot-api#235:

  • 64bc3f8: rate_limits_share_pct on update_rate_oracle_config().
  • a0c397f: get_upgrade_preflight(), start_upgrade() and get_upgrade_status() for the three /system/upgrade* routes.

The vendored spec is regenerated from the API branch, so it now includes those paths and the /performance/* paths from main. It is also pretty-printed instead of minified, which accounts for the size of the diff and keeps later spec diffs readable. 351 tests pass.

🤖 Generated with Claude Code

This branch has not been deployed

No deployments
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