feat: subscribe to RabbitMQ trade signals and notify by rules
Consume configurable queues, format signals (including period), share NotifyService with HTTP, and drop duplicate bodies within 1h.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package tradesignal
|
||||
|
||||
import "aiaa-notification-service/internal/config"
|
||||
|
||||
func Apply(signal *Signal, override *config.StrategyOverride) *Signal {
|
||||
if override == nil {
|
||||
return signal
|
||||
}
|
||||
|
||||
out := *signal
|
||||
if signal.Quantity != nil {
|
||||
q := *signal.Quantity
|
||||
out.Quantity = &q
|
||||
}
|
||||
|
||||
if out.Quantity != nil && *out.Quantity > 0 {
|
||||
multiplier := override.QuantityMultiplierFor(out.Action)
|
||||
if multiplier != 1 {
|
||||
q := *out.Quantity * multiplier
|
||||
out.Quantity = &q
|
||||
}
|
||||
}
|
||||
|
||||
if override.Leverage != nil && *override.Leverage > 0 {
|
||||
out.Leverage = *override.Leverage
|
||||
}
|
||||
|
||||
return &out
|
||||
}
|
||||
Reference in New Issue
Block a user