Skip to content

Conversation

@kbearXD
Copy link
Collaborator

@kbearXD kbearXD commented Oct 20, 2025

No description provided.

Copy link
Contributor

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

Introduces the new XVS strategy implementing volume breakout entries and engulfing/pivot-based exits, and registers it in the builtin strategies.

  • Adds full strategy implementation (parameter validation, subscriptions, entry/exit logic, indicators).
  • Registers the strategy in builtin.go for automatic loading.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
pkg/strategy/xvs/strategy.go Implements the XVS strategy with entry (volume + EMA filter) and exit (pivot high + engulfing) logic.
pkg/cmd/strategy/builtin.go Registers the new XVS strategy for inclusion in the strategy set.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

return
}

if kline.GetClose().Compare(kline.GetOpen()) < 0 {
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

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

The condition assigns lastGreenKline when the candle is red (close < open), contradicting the intent to store a green candle for later engulfing exit checks. Change the comparison to > 0 so only green candles are stored: if kline.GetClose().Compare(kline.GetOpen()) > 0 { s.lastGreenKline = kline }.

Suggested change
if kline.GetClose().Compare(kline.GetOpen()) < 0 {
if kline.GetClose().Compare(kline.GetOpen()) > 0 {

Copilot uses AI. Check for mistakes.
Comment on lines +392 to +397
bbgo.Notify("Found %s volume breakout: volume %s, quote volume %s, price %s",
s.Symbol,
kline.Volume.String(),
kline.QuoteVolume.String(),
closePrice.String(),
kline)
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

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

The format string has four %s verbs but five arguments are passed; the extra kline argument will produce a %!(EXTRA ...) formatting artifact. Remove the unused kline parameter or add a %s (or %v) verb for it (e.g. append ", kline %v" to the format string and keep the argument).

Copilot uses AI. Check for mistakes.
Comment on lines +424 to +427
bbgo.Notify("Submitting %s market buy order with quantity %s",
s.Symbol,
s.Quantity.String(),
orderForm)
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

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

The notification always says "market buy order" even when orderForm.Type was switched to limit, and it logs s.Quantity instead of the actual quantity variable (which may come from scaling). Use orderForm.Type and orderForm.Quantity.String() to ensure accurate reporting, and update the format string accordingly.

Suggested change
bbgo.Notify("Submitting %s market buy order with quantity %s",
s.Symbol,
s.Quantity.String(),
orderForm)
bbgo.Notify("Submitting %s %s buy order with quantity %s",
s.Symbol,
orderForm.Type,
orderForm.Quantity.String())

Copilot uses AI. Check for mistakes.
// Validate validates the validity of strategy parameters
func (s *Strategy) Validate() error {
if s.Quantity.IsZero() && s.ScaleQuantity == nil {
return fmt.Errorf("quantity or scaleQuantity can not be zero")
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

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

Corrected wording from "can not" to "cannot".

Suggested change
return fmt.Errorf("quantity or scaleQuantity can not be zero")
return fmt.Errorf("quantity or scaleQuantity cannot be zero")

Copilot uses AI. Check for mistakes.
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.

2 participants