Skip to content

Conversation

c9s
Copy link
Owner

@c9s c9s commented Apr 21, 2025

  • add covered position metrics
  • use uncovered position to place spread maker order
  • return covered position for any trade

- add covered position metrics
- use uncovered position to place spread maker order
- return covered position for any trade
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the uncovered position logic and improves the readability of logger calls and subscription formatting in the xmaker strategy module. It also updates the spread maker logic to work with the uncovered position and adds new metrics for monitoring covered positions.

  • Reformats multiple logger statements into a multi-line style for improved readability.
  • Introduces new functions to compute covered and uncovered positions.
  • Adjusts the spread maker order logic to use the uncovered position when generating orders.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
pkg/strategy/xmaker/strategy.go Reformatting logger calls; adjusting parameter names and position calculations for hedge logic
pkg/strategy/xmaker/spreadmaker.go Adding a new uncoveredPosition parameter and updating order formation logic
pkg/strategy/xmaker/metrics.go Updates to metrics initialization with formatting consistency
Comments suppressed due to low confidence (2)

pkg/strategy/xmaker/strategy.go:1998

  • [nitpick] The function name 'getUncoverPosition' is slightly inconsistent with the parameter naming 'uncoveredPosition' used elsewhere. Consider renaming it to 'getUncoveredPosition' for clarity and consistency.
func (s *Strategy) getUncoverPosition() fixedpoint.Value {

pkg/strategy/xmaker/spreadmaker.go:91

  • [nitpick] Using 'uncoveredPosition.Neg()' to derive the base value could be confusing. It might help to clarify the intent either with a more descriptive variable name or an inline comment explaining the transformation.
base := uncoveredPosition.Neg()

@c9s c9s force-pushed the c9s/xmaker/fix-uncoveredpos branch from f0b7ef3 to fd419b5 Compare April 21, 2025 08:18
@c9s c9s merged commit a1e84f9 into main Apr 21, 2025
3 checks passed
@c9s c9s deleted the c9s/xmaker/fix-uncoveredpos branch April 21, 2025 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants