mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 06:53:52 +00:00
Merge pull request #1345 from c9s/c9s/fix-market-inject
FIX: [bbgo] check symbol length for injection
This commit is contained in:
commit
6b273eda4d
|
@ -168,7 +168,9 @@ func (trader *Trader) SetRiskControls(riskControls *RiskControls) {
|
||||||
trader.riskControls = riskControls
|
trader.riskControls = riskControls
|
||||||
}
|
}
|
||||||
|
|
||||||
func (trader *Trader) RunSingleExchangeStrategy(ctx context.Context, strategy SingleExchangeStrategy, session *ExchangeSession, orderExecutor OrderExecutor) error {
|
func (trader *Trader) RunSingleExchangeStrategy(
|
||||||
|
ctx context.Context, strategy SingleExchangeStrategy, session *ExchangeSession, orderExecutor OrderExecutor,
|
||||||
|
) error {
|
||||||
if v, ok := strategy.(StrategyValidator); ok {
|
if v, ok := strategy.(StrategyValidator); ok {
|
||||||
if err := v.Validate(); err != nil {
|
if err := v.Validate(); err != nil {
|
||||||
return fmt.Errorf("failed to validate the config: %w", err)
|
return fmt.Errorf("failed to validate the config: %w", err)
|
||||||
|
@ -254,7 +256,7 @@ func (trader *Trader) injectFieldsAndSubscribe(ctx context.Context) error {
|
||||||
log.Errorf("strategy %s does not implement ExchangeSessionSubscriber", strategy.ID())
|
log.Errorf("strategy %s does not implement ExchangeSessionSubscriber", strategy.ID())
|
||||||
}
|
}
|
||||||
|
|
||||||
if symbol, ok := dynamic.LookupSymbolField(rs); ok {
|
if symbol, ok := dynamic.LookupSymbolField(rs); ok && symbol != "" {
|
||||||
log.Infof("found symbol %s based strategy from %s", symbol, rs.Type())
|
log.Infof("found symbol %s based strategy from %s", symbol, rs.Type())
|
||||||
|
|
||||||
if err := session.initSymbol(ctx, trader.environment, symbol); err != nil {
|
if err := session.initSymbol(ctx, trader.environment, symbol); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user