|
|
|
|
@ -6,7 +6,7 @@ import ATrade (libatrade_gitrev,
@@ -6,7 +6,7 @@ import ATrade (libatrade_gitrev,
|
|
|
|
|
import ATrade.Broker.Protocol (NotificationSqnum (NotificationSqnum)) |
|
|
|
|
import ATrade.Broker.Server (startBrokerServer, |
|
|
|
|
stopBrokerServer) |
|
|
|
|
import ATrade.Broker.TradeSinks.MQTTTradeSink (withMQTTTradeSink) |
|
|
|
|
import ATrade.Broker.TradeSinks.GotifyTradeSink (withGotifyTradeSink) |
|
|
|
|
import ATrade.Broker.TradeSinks.ZMQTradeSink (withZMQTradeSink) |
|
|
|
|
import ATrade.Logging (Message (..), Severity (Debug, Error, Info, Trace, Warning), |
|
|
|
|
fmtMessage, logWith) |
|
|
|
|
@ -71,9 +71,7 @@ main = do
@@ -71,9 +71,7 @@ main = do
|
|
|
|
|
defaultServerSecurityParams) |
|
|
|
|
stopQuoteSourceServer $ \_ -> withTickerInfoServer logger ctx (tisEndpoint cfg) $ \tisH -> do |
|
|
|
|
withZMQTradeSink ctx (tradesinkDashboard cfg) logger $ \tsDashboard -> |
|
|
|
|
case parseURI (T.unpack $ mqttUri cfg) of |
|
|
|
|
Just uri -> do |
|
|
|
|
withMQTTTradeSink uri mqttTradeSinkTopic logger $ \tsMqtt -> do |
|
|
|
|
withGotifyTradeSink (T.unpack $ gotifyUri cfg) (T.unpack $ gotifyToken cfg) logger $ \tsGotify -> do |
|
|
|
|
txml <- Connector.start logger cfg qssChannel tisH |
|
|
|
|
bracket (startBrokerServer |
|
|
|
|
[Connector.makeBrokerBackend txml (account cfg)] |
|
|
|
|
@ -81,7 +79,7 @@ main = do
@@ -81,7 +79,7 @@ main = do
|
|
|
|
|
(brokerEndpoint cfg) |
|
|
|
|
(brokerNotificationsEndpoint cfg) |
|
|
|
|
(NotificationSqnum 1) |
|
|
|
|
[tsDashboard, tsMqtt] |
|
|
|
|
[tsDashboard, tsGotify] |
|
|
|
|
defaultServerSecurityParams |
|
|
|
|
logger) (\x -> do |
|
|
|
|
stopBrokerServer x |
|
|
|
|
@ -89,9 +87,6 @@ main = do
@@ -89,9 +87,6 @@ main = do
|
|
|
|
|
Connector.stop txml) $ \_ -> do |
|
|
|
|
withHistoryProviderServer ctx (historyProviderEndpoint cfg) txml tisH logger id $ \_ -> do |
|
|
|
|
forever $ threadDelay 1000000 |
|
|
|
|
Nothing -> log Warning "main" "Can't parse MQTT URI" |
|
|
|
|
log Info "main" "Shutting down" |
|
|
|
|
where |
|
|
|
|
mqttTradeSinkTopic = "/atrade/trades" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|