Skip to content

Commit 71c9b22

Browse files
committed
strategy:irr: clean up
1 parent 614209e commit 71c9b22

File tree

2 files changed

+3
-20
lines changed

2 files changed

+3
-20
lines changed

config/irr.yaml

+1-10
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,8 @@ exchangeStrategies:
2323
symbol: BTCBUSD
2424
# in milliseconds(ms)
2525
hftInterval: 1000
26-
# indicator window
27-
window: 0
28-
# maxima position in USD
29-
amount: 100
26+
# qty per trade
3027
quantity: 0.001
31-
# minProfit pips in USD
32-
pips: 0.0
33-
# alpha1: negative return reversion
34-
NR: true
35-
# alpha2: moving average reversion
36-
MR: true
3728
# Draw pnl
3829
drawGraph: true
3930
graphPNLPath: "./pnl.png"

pkg/strategy/irr/strategy.go

+2-10
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,9 @@ type Strategy struct {
4848
orderExecutor *bbgo.GeneralOrderExecutor
4949

5050
bbgo.QuantityOrAmount
51-
MinProfit float64 `json:"pips"`
5251

53-
Interval int `json:"hftInterval"`
54-
NR bool `json:"NR"`
55-
MR bool `json:"MR"`
52+
Interval int `json:"hftInterval"`
5653

57-
// for back-test
58-
Nrr *NRR
59-
Ma *indicator.SMA
6054
// realtime book ticker to submit order
6155
obBuyPrice uint64
6256
obSellPrice uint64
@@ -399,9 +393,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
399393
log.Infof("box ended at price: %f with time length: %d", boxClosePrice, boxCounter)
400394
// box ending, should re-balance position
401395
nirr := fixedpoint.NewFromFloat(((boxOpenPrice - boxClosePrice) / boxOpenPrice) / (float64(boxCounter) + 1))
402-
qty := s.QuantityOrAmount.CalculateQuantity(fixedpoint.Value(boxClosePrice))
403-
qty = qty.Mul(nirr.Abs().Div(fixedpoint.NewFromInt(1000)))
404-
log.Infof("Alpha: %f with Diff Qty: %f", nirr.Float64(), qty.Float64())
396+
log.Infof("Alpha: %f", nirr.Float64())
405397
if nirr.Float64() < 0 {
406398
_, err := s.orderExecutor.SubmitOrders(context.Background(), types.SubmitOrder{
407399
Symbol: s.Symbol,

0 commit comments

Comments
 (0)