Repository navigation
Conversation
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
Value inverse crypto futures in closed-trade statistics using signed reciprocal prices and the base currency's conversion rate. For BTCUSD, long 100 contracts from 40,000 to 44,000 reports USD 1,000 rather than USD 40,000,000.
Apply the same valuation to FillToFill excursions and drawdown. FlatToFlat and FlatToReduced average settlement values separately from the reported entry and exit prices, so scaling in and taking partial exits use the actual fills. Linear contracts, including DYDX BTCUSD, keep their price-difference calculation.
Related Issue
Fixes #10031.
Motivation and Context
Inverse contracts settle in the base asset. Treating their USD face value as a base-asset quantity makes closed-trade profit and risk statistics incorrect.
Requires Documentation Change
No.
How Has This Been Tested?
Pristine checkout of the exact commit, fresh Release build, .NET 10.0.400, macOS arm64. Python 3.11.15 with the project's pinned NumPy 1.26.4, SciPy 1.13.1 and pandas 2.3.3 dependencies.
ZipBytesReturnsByteArrayWithCorrectLengthexpects 906,121 bytes on macOS but gets 905,693; this also fails with the original TradeBuilder. One run additionally failedMultiThreadReadWriteTest, the otherProcessesOrdersConcurrently. Their test and production files are unchanged; they pass in 15 and 10 isolated original-code runs respectively.Types of changes
Checklist:
bug-<issue#>-<description>.