MCPcopy Create free account
hub / github.com/TalkingData/owl / GetTriggersByStrategyID

Method GetTriggersByStrategyID

controller/mysql.go:90–107  ·  view source on GitHub ↗
(strategy_id int)

Source from the content-addressed store, hash-verified

88}
89
90func (this *db) GetTriggersByStrategyID(strategy_id int) map[string]*types.Trigger {
91 rows, err := this.Query("SELECT `id`, `strategy_id`, `metric`, `tags`, `number`, `index`, `method`, `symbol`, `threshold`, `description` FROM `trigger` WHERE `strategy_id` = ?", strategy_id)
92 if err != nil {
93 lg.Error(err.Error())
94 return nil
95 }
96 defer rows.Close()
97 triggers := make(map[string]*types.Trigger)
98 for rows.Next() {
99 trigger := types.Trigger{}
100 if err := rows.Scan(&trigger.ID, &trigger.StrategyID, &trigger.Metric, &trigger.Tags, &trigger.Number, &trigger.Index, &trigger.Method, &trigger.Symbol, &trigger.Threshold, &trigger.Description); err != nil {
101 lg.Error(err.Error())
102 continue
103 }
104 triggers[trigger.Index] = &trigger
105 }
106 return triggers
107}
108
109func (this *db) GetActions(strategy_id, action_type int) []*types.Action {
110 actions := []*types.Action{}

Callers 1

loadStrategiesForeverMethod · 0.45

Calls 2

QueryMethod · 0.65
CloseMethod · 0.45

Tested by

no test coverage detected