Fix Cython compilation error in LimitOrder age methods#376
Open
jamsturg wants to merge 1 commit intoCoinAlpha:developmentfrom
Open
Fix Cython compilation error in LimitOrder age methods#376jamsturg wants to merge 1 commit intoCoinAlpha:developmentfrom
jamsturg wants to merge 1 commit intoCoinAlpha:developmentfrom
Conversation
- Changed return type from long long to double for c_age() and c_age_til() methods - Updated variable declarations to use double instead of long long for age_seconds - Fixed return value in c_age_til() to return -1.0 instead of -1 for consistency - Updated age() and age_til() public methods to cast double results to int This resolves the Cython compilation error: 'Cannot convert 'double' to Python object unless type is correctly specified' The underlying calculation already returns a double value (division by 1e6), so the type declarations now match the actual return type.
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.
Description
This PR fixes a Cython compilation error in the LimitOrder class that was preventing successful compilation of the project.
Problem
The Cython compiler was failing with the error: Cannot convert 'double' to Python object unless type is correctly specified
This occurred in the c_age() and c_age_til() methods of the LimitOrder class, where the return type was declared as long long but the actual calculation returned a double value due to the division by 1e6.
Solution
Files Changed
Testing
The fix resolves the Cython compilation error while maintaining backward compatibility. The public interface continues to return integers as expected, but the internal calculations now properly handle the floating-point arithmetic.
Request for Review
Please review this fix for the Cython compilation issue. The changes are minimal and focused on correcting the type declarations to match the actual return types from the calculations.