This repository was archived by the owner on Aug 7, 2026. It is now read-only.
feat(foxbit): add X-FB-CLIENT identification headers - #11
Open
matheus-alcuri-foxbit wants to merge 2 commits into
Open
feat(foxbit): add X-FB-CLIENT identification headers#11matheus-alcuri-foxbit wants to merge 2 commits into
matheus-alcuri-foxbit wants to merge 2 commits into
Conversation
Send X-FB-CLIENT: ccxt and X-FB-CLIENT-VERSION: <ccxt version> on every foxbit REST request so the exchange can identify ccxt-originated traffic. Adds a getCcxtVersion() base helper (hand-written in each language, above the transpile marker) since the library version constant was not reachable from transpiled exchange code, and a testFoxbit broker-id test asserting both headers via last_request_headers in all five languages. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds Foxbit-specific client identification headers to all REST requests, enabling the exchange to attribute CCXT traffic, and introduces a small cross-language base helper to expose the library version for that header value.
Changes:
- Injects
X-FB-CLIENT: ccxtandX-FB-CLIENT-VERSION: <ccxt version>infoxbitREST request signing. - Adds a
getCcxtVersion()/get_ccxt_version()helper across the base classes in TS + transpiled languages. - Extends the brokerId test suite with an offline
testFoxbitassertion that validates both headers vialast_request_headers.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| ts/src/test/tests.ts | Adds testFoxbit() to the brokerId suite and asserts the two Foxbit headers from last_request_headers. |
| ts/src/foxbit.ts | Adds Foxbit client identification headers in sign() for all REST requests. |
| ts/src/base/Exchange.ts | Introduces getCcxtVersion() in the TS base exchange class (used by foxbit.sign()). |
| python/ccxt/base/exchange.py | Adds get_ccxt_version() returning __version__ for Python runtime parity. |
| php/Exchange.php | Adds get_ccxt_version() returning static::VERSION for PHP runtime parity. |
| cs/ccxt/base/Exchange.Misc.cs | Adds getCcxtVersion() returning ccxtVersion for C# runtime parity. |
| go/v4/exchange_metadata.go | Adds GetCcxtVersion() returning Version for Go runtime parity. |
| go/v4/exchange_interface.go | Adds GetCcxtVersion() to ICoreExchange so Go callers/tests can access it uniformly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Addresses Copilot review on the PR: the JSDoc promised a semver string but the JS implementation returns "unknown" when Exchange.ccxtVersion is not initialized (direct module import bypassing the entry point). The fallback is intentional; the doc now states it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
Sends
X-FB-CLIENT: ccxtandX-FB-CLIENT-VERSION: <ccxt version>on every foxbit REST request so the exchange can identify and measure ccxt-originated traffic (client header approach chosen over User-Agent, which users/base code can override).Since the library version constant was not reachable from transpiled exchange code, this adds a
getCcxtVersion()base helper implemented above the transpile marker (hand-written per language: TS/JS, Python, PHP, C#, Go). Headers are injected insign()(same pattern as bybit'sReferer), so they take precedence over userheadersoverrides. AtestFoxbitbroker-id test asserts both headers vialast_request_headersin all five languages.Related: foxbit-group/kepler#2902 (server-side metric), foxbit-group/ccxt-foxbit-tests#18 (E2E tests).
Tests run
npm run lint— pass (0 errors on edited files)npm run tsBuild— passnpm run transpile(Python + PHP) — passnpm run transpileCS+npm run buildCS— pass (dotnet 9, 4 projects, 0 errors)npm run transpileGO+npm run buildGO— pass (v4 + v4/pro)testFoxbit) — passed in JS, Python, PHP, C#, Gotest-base-rest— passed in JS and Python (base was touched)py_compile; PHP viaphp -l(php:8.2 container)fetchTicker BTC/BRLagainst api.foxbit.com.br — request carried both headers, 200 OKNotes
ts/src/**+ hand-written base files (python/ccxt/base/exchange.py,php/Exchange.php,cs/ccxt/base/Exchange.Misc.cs,go/v4/exchange_metadata.go,go/v4/exchange_interface.go). Per-exchange generated files are left to the build automation.__version__,Exchange::VERSION,ccxtVersion,Version), all already bumped byvss.🤖 Generated with Claude Code