Skip to content

Conversation

c9s
Copy link
Owner

@c9s c9s commented May 24, 2025

No description provided.

@c9s c9s changed the title FEATURE: [xmaker] support fiat synthetic hedge WIP: FEATURE: [xmaker] support fiat synthetic hedge May 24, 2025
@c9s c9s force-pushed the c9s/xmaker/fiat-synthetic-hedge branch from def3b45 to 55dda8f Compare May 29, 2025 08:14
@c9s c9s force-pushed the c9s/xmaker/fiat-synthetic-hedge branch from 55dda8f to 90bd98c Compare May 30, 2025 07:27
@c9s c9s force-pushed the c9s/xmaker/fiat-synthetic-hedge branch from 1643f61 to aac0464 Compare June 3, 2025 04:32
@c9s c9s force-pushed the c9s/xmaker/fiat-synthetic-hedge branch from 7cb8f17 to f400740 Compare June 3, 2025 05:11
"github.com/c9s/bbgo/pkg/types"
)

type PositionExposure struct {
Copy link
Owner Author

Choose a reason for hiding this comment

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

can be pulled out to the core types package

@c9s c9s changed the title WIP: FEATURE: [xmaker] support fiat synthetic hedge FEATURE: [xmaker] support fiat synthetic hedge Jun 3, 2025

func (m *PositionExposure) Close(delta fixedpoint.Value) {
m.pending.Add(delta)
m.net.Add(delta)
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about use Sub ? I find it use Close(Number(-1)) in the test function, but somehow it confused me at the first time.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Open() and Close() are paired

Copy link
Owner Author

Choose a reason for hiding this comment

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

because it's "open position" and "close position"

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the process for xmaker is Open -> Cover -> Close

Currently the flow will be the following

  1. maker market receive BUY 1 TRADE -> Open(1)
  2. hedge market place SELL 1 ORDER -> Cover(1)
  3. hedge market receive SELL 1 TRADE -> Close(-1)

Both 2 and 3 are SELL side in the hedge market, but the delta are different (1 and -1). Somehow, it confuse me.

@c9s c9s requested a review from kbearXD June 5, 2025 08:00
@c9s c9s enabled auto-merge June 5, 2025 09:12
@c9s c9s merged commit 40a8391 into main Jun 5, 2025
3 checks passed
@c9s c9s deleted the c9s/xmaker/fiat-synthetic-hedge branch June 5, 2025 09:20
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