Draft
Conversation
9908e9d to
0ed46e8
Compare
6bc90e3 to
155cfc8
Compare
- Add comprehensive regression test suite (56 tests) in rust/tests/regression.rs covering safe accessor methods, Value helpers, describe() shape validation, fixture-based comparison, and live network tests - Add manually-maintained safe accessor implementations to Exchange trait: safe_string, safe_integer, safe_float, safe_value, safe_bool, safe_dict, safe_list, safe_number, parse_number, safe_timestamp and all _2/_n variants - Add free helper functions: safe_get, value_to_string_opt, value_to_i64_opt, value_to_f64_opt - Update rustTranspiler.ts with MANUALLY_IMPLEMENTED_METHODS set to skip generating stubs for methods already implemented in the Exchange trait - Add test fixtures in rust/tests/fixtures/ for JS-parity validation - Regenerate all exchange .rs files (safe accessor stubs removed) https://claude.ai/code/session_01KE37uEYUSbY3Ug9yFSjpzZ
Signed-off-by: Herklos <herklos@drakkar.software>
Create shared test helper module (tests/common/mod.rs) with thorough validators for ticker, order book, and OHLCV data modeled after the canonical CCXT TypeScript test suite. Validates prices > 0, volumes >= 0, bid-ask spread, OHLC bounds, timestamp sanity, symbol matching, and sort order for order book entries. Expand pro exchange smoke tests from 27 to 71 exchanges covering okx, bybit, kraken, kucoin, gate, hyperliquid, phemex, dydx, coinbase, and 30+ more. Refactor both test files to use shared validators. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds 57 individual smoke tests covering every pro exchange with the full validation suite (describe, status, ticker, tickers, order_book, ohlcv). Softens status shape check to handle raw exchange response variance. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove RUST_STUB_MODE flag entirely from rustTranspiler.ts
- Exchange-specific methods now get fully transpiled JS→Rust bodies
instead of `{ Value::Undefined }` stubs
- Base Exchange class methods still use stubs (runtime not ready)
- Inherited base methods removed from exchange traits (available via
Exchange supertrait) to avoid E0034 ambiguity
- Fix TryStatement to emit try block inline (catch as comment)
- Add AST visitors: SpreadElement, ArrowFunction, FunctionExpression,
TemplateLiteral, ForOf/ForIn, SwitchStatement
- Fix dispatch call matching (case-insensitive API method names)
- Fix method call generation: use UFCS for overrides, instance calls
for inherited methods
- Add BoolExt trait, From<i32>, From<Value> for serde_json::Value
- Add Precise static methods, Math methods, Array::is_array
- Add runtime stub methods for pre-delimiter Exchange.js functions
(load_markets, omit, iso8601, etc.)
- Fix argument count table for safe* methods and other utilities
- Make Exchange require ValueTrait supertrait for self.get() access
Result: binance.rs goes from 499 stub methods to 0 stubs, with 202
real transpiled functions across 13,477 lines.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
a1f1e2c to
77bda87
Compare
- Remove RUST_STUB_MODE flag entirely from rustTranspiler.ts - Exchange-specific methods get fully transpiled JS→Rust bodies - Base Exchange class methods use stubs (runtime not ready yet) - Inherited base methods removed from exchange traits (via supertrait) - Add AST visitors: SpreadElement, ArrowFunction, TemplateLiteral, ForOf/ForIn, SwitchStatement, Object.keys/JSON.stringify - Fix TryStatement, dispatch matching, UFCS, mutability inference - Add BoolExt, From<i32>, IntoIterator, Not, Promise::all, Precise methods, Math methods, Array::is_array - Add runtime stubs for pre-delimiter Exchange.js functions - Fix argument count table, usize/rvalue paren mismatch - binance.rs: 202 real functions, 0 stubs, compiles clean - All 112 default tests pass Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
c3e8b21 to
3ed2d91
Compare
…(97.6%) Key transpiler fixes: - Fix dispatch function to use self.request() for exchanges without own request override, UFCS only when exchange overrides request - Add pattern-based fallback dispatch detection for API methods not in the explicit apiMethods set (privateGet*, publicPost*, etc.) - Fix HANDWRITTEN_METHODS to conditionally use UFCS or self.request() based on whether the exchange overrides request - Add Value method padding (slice now requires 2 args) - Fix crypto hash identifiers (keccak, secp256k1, etc.) used as values by converting bare references to function calls - Fix error type constructors used in JSON describe objects - Add missing free functions: parse_float, ecdsa, totp, jwt, keccak, shift_1/3/4, decimals, and error type constructors - Add argCounts entries for binaryConcat, ethEncodeStructuredData, etc. - Fix parseToInt argCount (2->1), safeIntegerProduct (3->4) Runtime (exchange.rs) fixes: - Add 60+ utility method stubs to Exchange trait (capitalize, uuid, base16_to_binary, binary_concat, seconds, etc.) - Add Value::pad_start(), Value::reduce(), Value::to_fixed() methods - Upgrade Value::slice() from 1-arg to 2-arg (start, end) - Add usize <-> Value comparison (PartialEq, PartialOrd, Div) - Generate dispatch function for all exchanges (not just those with api) All 112 regression + smoke tests pass. Default build (binance) compiles. https://claude.ai/code/session_01Kts6beu4ZpQQB8cffDwnDm
…xchanges - Transpiler: replace `_ => unimplemented!()` in dispatch with descriptive `panic!()` messages for unknown API methods - exchange.rs: implement 60+ runtime/utility stubs with real logic: - omit/omitZero, iso8601/parse8601, milliseconds/seconds/microseconds - urlencode/rawencode/encodeURIComponent, sortBy/indexBy/filterBy/groupBy - hash (sha256/sha384/sha512/md5/keccak) and hmac with hex/base64 encoding - parseJson, parseTimeframe, precisionFromString, numberToString - uuid/uuid16/uuid22/uuid5, capitalize, randNumber, randomBytes - base16/base58/base64 encoding/decoding, binaryConcat, numberToBE - deepExtend2, keysort, unique, sort, sortBy2, implodeParams - yyyymmdd/ymd/yymmdd date formatting, padStart, isEmpty, toFixed - stringToCharsArray, arraySlice, remove0xPrefix, convertToBigInt - Regenerated all 111 exchange + 78 pro exchange files via --force transpile All 114 tests pass (112 regression + 1 pro + 1 strict smoke). https://claude.ai/code/session_01Kts6beu4ZpQQB8cffDwnDm
- Implement 13 stub methods in exchange.rs with real logic (fetch_markets, get_base_domain_from_url, get_network_code_by_network_url, sign, handle_errors, set_margin_mode, etc.) - Implement ExchangeImpl::init with proper defaults (precisionMode, paddingMode, markets, currencies, symbols, ids) - Fix 393 compilation errors across all 111 exchange files: - Wrap bool/usize values with Value::from() where Value expected - Fix borrow checker issues by splitting compound self expressions - Extract async calls from json!() macro into let bindings - Fix format string errors in panic!() with raw string literals - Change &self to &mut self where mutable access needed - Fix type annotation ambiguities (.into() -> Value::from()) - Add #![allow(non_snake_case)] to all exchange files for PascalCase error constructors - Add smoke tests for 40 previously untested exchanges (both public_data_smoke and pro_public_data) - Add regression tests for new base class methods - All 118 regression tests pass, all smoke tests pass - Full-exchanges build compiles cleanly with zero errors https://claude.ai/code/session_01Kts6beu4ZpQQB8cffDwnDm
Signed-off-by: Herklos <herklos@drakkar.software>
Signed-off-by: Herklos <herklos@drakkar.software>
874c96c to
a0f5c6a
Compare
Signed-off-by: Herklos <herklos@drakkar.software>
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.
Inspired by https://github.com/kizzx2/ccxt-rs and ccxt/ast-transpiler#28
Related to ccxt#2709 and ccxt#24398