mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 08:45:16 +00:00
bbgo: initialize position service
This commit is contained in:
parent
e9a25fcc6f
commit
9faaed6892
|
@ -77,6 +77,7 @@ type Environment struct {
|
||||||
OrderService *service.OrderService
|
OrderService *service.OrderService
|
||||||
TradeService *service.TradeService
|
TradeService *service.TradeService
|
||||||
ProfitService *service.ProfitService
|
ProfitService *service.ProfitService
|
||||||
|
PositionService *service.PositionService
|
||||||
BacktestService *service.BacktestService
|
BacktestService *service.BacktestService
|
||||||
RewardService *service.RewardService
|
RewardService *service.RewardService
|
||||||
SyncService *service.SyncService
|
SyncService *service.SyncService
|
||||||
|
@ -172,6 +173,7 @@ func (environ *Environment) ConfigureDatabaseDriver(ctx context.Context, driver
|
||||||
environ.RewardService = &service.RewardService{DB: db}
|
environ.RewardService = &service.RewardService{DB: db}
|
||||||
environ.AccountService = &service.AccountService{DB: db}
|
environ.AccountService = &service.AccountService{DB: db}
|
||||||
environ.ProfitService = &service.ProfitService{DB: db}
|
environ.ProfitService = &service.ProfitService{DB: db}
|
||||||
|
environ.PositionService = &service.PositionService{DB: db}
|
||||||
|
|
||||||
environ.SyncService = &service.SyncService{
|
environ.SyncService = &service.SyncService{
|
||||||
TradeService: environ.TradeService,
|
TradeService: environ.TradeService,
|
||||||
|
@ -579,7 +581,7 @@ func (environ *Environment) RecordProfit(profit types.Profit) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := environ.ProfitService.Insert(profit) ; err != nil {
|
if err := environ.ProfitService.Insert(profit); err != nil {
|
||||||
log.WithError(err).Errorf("can not insert profit record: %+v", profit)
|
log.WithError(err).Errorf("can not insert profit record: %+v", profit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -609,7 +611,6 @@ func (environ *Environment) syncSession(ctx context.Context, session *ExchangeSe
|
||||||
return environ.SyncService.SyncSessionSymbols(ctx, session.Exchange, environ.syncStartTime, symbols...)
|
return environ.SyncService.SyncSessionSymbols(ctx, session.Exchange, environ.syncStartTime, symbols...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (environ *Environment) ConfigureNotificationSystem(userConfig *Config) error {
|
func (environ *Environment) ConfigureNotificationSystem(userConfig *Config) error {
|
||||||
environ.Notifiability = Notifiability{
|
environ.Notifiability = Notifiability{
|
||||||
SymbolChannelRouter: NewPatternChannelRouter(nil),
|
SymbolChannelRouter: NewPatternChannelRouter(nil),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user