@@ -48,15 +48,9 @@ type Strategy struct {
48
48
orderExecutor * bbgo.GeneralOrderExecutor
49
49
50
50
bbgo.QuantityOrAmount
51
- MinProfit float64 `json:"pips"`
52
51
53
- Interval int `json:"hftInterval"`
54
- NR bool `json:"NR"`
55
- MR bool `json:"MR"`
52
+ Interval int `json:"hftInterval"`
56
53
57
- // for back-test
58
- Nrr * NRR
59
- Ma * indicator.SMA
60
54
// realtime book ticker to submit order
61
55
obBuyPrice uint64
62
56
obSellPrice uint64
@@ -399,17 +393,15 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
399
393
log .Infof ("box ended at price: %f with time length: %d" , boxClosePrice , boxCounter )
400
394
// box ending, should re-balance position
401
395
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 ())
405
397
if nirr .Float64 () < 0 {
406
398
_ , err := s .orderExecutor .SubmitOrders (context .Background (), types.SubmitOrder {
407
399
Symbol : s .Symbol ,
408
400
Side : types .SideTypeSell ,
409
401
Quantity : s .Quantity ,
410
402
Type : types .OrderTypeLimitMaker ,
411
403
Price : fixedpoint .NewFromFloat (float64 (s .obSellPrice )),
412
- Tag : "irr re-balance: sell " ,
404
+ Tag : "irrSell " ,
413
405
})
414
406
if err != nil {
415
407
log .WithError (err )
@@ -421,7 +413,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
421
413
Quantity : s .Quantity ,
422
414
Type : types .OrderTypeLimitMaker ,
423
415
Price : fixedpoint .NewFromFloat (float64 (s .obBuyPrice )),
424
- Tag : "irr re-balance: buy " ,
416
+ Tag : "irrBuy " ,
425
417
})
426
418
if err != nil {
427
419
log .WithError (err )
@@ -452,7 +444,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
452
444
for {
453
445
select {
454
446
case <- intervalOpenTicker .C :
455
- time .Sleep (time . Duration ( s . Interval / 10 ) * time .Millisecond )
447
+ time .Sleep (10 * time .Millisecond )
456
448
log .Infof ("kline open time @ %s" , time .Now ().Format ("2006-01-02 15:04:05.000000" ))
457
449
458
450
if s .currentTradePrice > 0 && s .closePrice > 0 {
0 commit comments