You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The PR adds convenience accessors Position::to_f64/is_long/is_short and MarketState::best_bid/best_ask with tests, plus a version bump. The Position additions are correct (Currency requires Signed and Into<f64>), but the MarketState additions duplicate existing public API.
Issues
src/market_state.rs:85–95 (major): best_bid() and best_ask() return the identical values already exposed by the public getters bid() and ask() generated by #[getset(get_copy = "pub")] on the bid/ask fields (lines 26–33). This leaves two public names for the same state that can drift apart in documentation and call sites. Remove the new accessors (and their test), or rename the existing getters to best_bid()/best_ask() instead of adding parallel methods.
The PR adds convenience accessors to Position (to_f64, is_long, is_short) and MarketState (best_bid, best_ask), with tests and a version bump to 0.138.4. The logic is correct, but the new public methods duplicate existing public API on both types.
Issues
src/market_state.rs:85-94 (major): best_bid()/best_ask() are exact duplicates of the already-public bid()/ask() copy getters generated by the CopyGetters derive, giving the same field two public names that can diverge later. Fix: remove the new methods and document the existing bid()/ask() getters as the best bid/ask instead.
src/account/position.rs:94-115 (major): is_long()/is_short() duplicate the existing side() method (PositionSide::Long/Short), and to_f64() is just quantity().to_f64(), which callers can already compose from the public quantity() getter and BaseCurrency::to_f64(). Fix: keep side() as the single source of side information and drop the redundant predicates/conversion.
The PR adds a minimal ci devShell that CI now develops against (bypassing creusot/hongdown/cargo-* builds), bumps the version to 0.138.4, and adds Position::{to_f64,is_long,is_short} plus MarketState::{best_bid,best_ask} with tests. No correctness bugs found; the flake ci shell covers every command ci.yml runs (the rust binding correctly shadows pkgs.rust via the enclosing let), and to_f64/is_positive/is_negative compile because Currency has Into<f64> and Signed as supertraits.
Issues
src/market_state.rs:85–96, major: best_bid()/best_ask() duplicate the public bid()/ask() copy getters already generated by getset on the same fields, so the struct now exposes two public names for the same value, and the "best (highest)/(lowest)" doc claim is not enforced since update_state stores a single bid/ask pair. Drop the new methods and keep using the existing bid()/ask() accessors.
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
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.
No description provided.