Repository navigation
(feat) client methods for bot rate oracle config - #27
Open
cardosofede wants to merge 4 commits into
Open
cardosofede wants to merge 4 commits into
cardosofede wants to merge 4 commits into
Conversation
…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.
Contributor
Author
|
Brought up to date with hummingbot/hummingbot-api#235:
The vendored spec is regenerated from the API branch, so it now includes those paths and the 🤖 Generated with Claude Code |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.ymlin 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_orchestrationgets three methods:get_rate_oracle_sources() -> List[str]:GET /bot-orchestration/rate-oracle/sourcesget_rate_oracle_config(account_name="master_account"):GET /bot-orchestration/rate-oracle/config. Returnsaccount_name,rate_oracle_source,global_tokenandavailable_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:
hummingbot-api-openapi.jsonnow has the two new paths and their schemas. They were generated from the router and models on the API branch, sotest_calls_match_api_specchecks the new calls.pyproject.tomland__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: thehummingbot-apiversion, thehummingbotlibrary version behind it, and whether the image is the published one or something pinned on that box (today: ssh in and readdocker inspect).SystemRouter.get_system_info() -> Dict[str, Any]:GET /system/info, reached asclient.system(new router, wired like the others, sync client included).It returns
api_version,hummingbot_version,docker_available,container(id,name,image,image_id,digestfromRepoDigests,compose_project,compose_working_dir,compose_config_files) andpinned/pinned_reason/override_file. The route is read-only and degrades instead of failing: withoutdocker.sockit answersdocker_available: falsewith a nullcontainerand still reports both versions./system/infois added to the vendored spec in the position the API serves it, sotest_calls_match_api_speccovers this call too. The version stays at 1.5.10.Tests
pytest test: 345 passed.test_the_route_the_call_addresses_is_served, which shows the spec test covers them.🤖 Generated with Claude Code