Skip to content

REFACTOR: move maker tools #1639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package xfixedmaker
package riskcontrol

import (
"github.com/c9s/bbgo/pkg/fixedpoint"
indicatorv2 "github.com/c9s/bbgo/pkg/indicator/v2"
"github.com/c9s/bbgo/pkg/types"
log "github.com/sirupsen/logrus"
)

type OrderPriceRiskControl struct {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xfixedmaker
package riskcontrol

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fixedmaker
package common

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fixedmaker
package common

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion pkg/strategy/fixedmaker/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type Strategy struct {
OrderType types.OrderType `json:"orderType"`
DryRun bool `json:"dryRun"`

InventorySkew InventorySkew `json:"inventorySkew"`
InventorySkew common.InventorySkew `json:"inventorySkew"`

activeOrderBook *bbgo.ActiveOrderBook
}
Expand Down
14 changes: 7 additions & 7 deletions pkg/strategy/xfixedmaker/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

"github.com/c9s/bbgo/pkg/bbgo"
"github.com/c9s/bbgo/pkg/fixedpoint"
"github.com/c9s/bbgo/pkg/risk/riskcontrol"
"github.com/c9s/bbgo/pkg/strategy/common"
"github.com/c9s/bbgo/pkg/strategy/fixedmaker"
"github.com/c9s/bbgo/pkg/types"
)

Expand All @@ -36,14 +36,14 @@ type Strategy struct {
OrderType types.OrderType `json:"orderType"`
DryRun bool `json:"dryRun"`

ReferenceExchange string `json:"referenceExchange"`
ReferencePriceEMA types.IntervalWindow `json:"referencePriceEMA"`
OrderPriceLossThreshold fixedpoint.Value `json:"orderPriceLossThreshold"`
InventorySkew fixedmaker.InventorySkew `json:"inventorySkew"`
ReferenceExchange string `json:"referenceExchange"`
ReferencePriceEMA types.IntervalWindow `json:"referencePriceEMA"`
OrderPriceLossThreshold fixedpoint.Value `json:"orderPriceLossThreshold"`
InventorySkew common.InventorySkew `json:"inventorySkew"`

market types.Market
activeOrderBook *bbgo.ActiveOrderBook
orderPriceRiskControl *OrderPriceRiskControl
orderPriceRiskControl *riskcontrol.OrderPriceRiskControl
}

func (s *Strategy) Defaults() error {
Expand Down Expand Up @@ -121,7 +121,7 @@ func (s *Strategy) CrossRun(ctx context.Context, _ bbgo.OrderExecutionRouter, se

s.Strategy.Initialize(ctx, s.Environment, tradingSession, s.market, ID, s.InstanceID())

s.orderPriceRiskControl = NewOrderPriceRiskControl(
s.orderPriceRiskControl = riskcontrol.NewOrderPriceRiskControl(
referenceSession.Indicators(s.Symbol).EMA(s.ReferencePriceEMA),
s.OrderPriceLossThreshold,
)
Expand Down
Loading