|
|
|
@ -9,6 +9,8 @@ import Control.Monad.IO.Class |
|
|
|
import Data.IORef |
|
|
|
import Data.IORef |
|
|
|
import Graphics.UI.Gtk hiding (Action, backspace) |
|
|
|
import Graphics.UI.Gtk hiding (Action, backspace) |
|
|
|
import Control.Concurrent.BoundedChan |
|
|
|
import Control.Concurrent.BoundedChan |
|
|
|
|
|
|
|
import Control.Concurrent.STM |
|
|
|
|
|
|
|
import Control.Concurrent.STM.TBQueue |
|
|
|
import ATrade.Types |
|
|
|
import ATrade.Types |
|
|
|
import QuoteSource.TableParsers.AllParamsTableParser |
|
|
|
import QuoteSource.TableParsers.AllParamsTableParser |
|
|
|
import QuoteSource.TableParser |
|
|
|
import QuoteSource.TableParser |
|
|
|
@ -89,14 +91,15 @@ parseConfig = withObject "object" $ \obj -> do |
|
|
|
tableName = tn, |
|
|
|
tableName = tn, |
|
|
|
tableParams = params } |
|
|
|
tableParams = params } |
|
|
|
|
|
|
|
|
|
|
|
forkBoundedChan :: Int -> BoundedChan Tick -> IO (ThreadId, BoundedChan Tick, BoundedChan QuoteSourceServerData) |
|
|
|
forkBoundedChan :: Int -> TBQueue Tick -> IO (ThreadId, TBQueue Tick, TBQueue QuoteSourceServerData) |
|
|
|
forkBoundedChan size source = do |
|
|
|
forkBoundedChan size source = do |
|
|
|
sink <- newBoundedChan size |
|
|
|
sink <- atomically $ newTBQueue size |
|
|
|
sinkQss <- newBoundedChan size |
|
|
|
sinkQss <- atomically $ newTBQueue size |
|
|
|
tid <- forkIO $ forever $ do |
|
|
|
tid <- forkIO $ forever $ do |
|
|
|
v <- readChan source |
|
|
|
v <- atomically $ readTBQueue source |
|
|
|
tryWriteChan sink v |
|
|
|
atomically $ do |
|
|
|
tryWriteChan sinkQss (QSSTick v) |
|
|
|
writeTBQueue sink v |
|
|
|
|
|
|
|
writeTBQueue sinkQss (QSSTick v) |
|
|
|
|
|
|
|
|
|
|
|
return (tid, sink, sinkQss) |
|
|
|
return (tid, sink, sinkQss) |
|
|
|
|
|
|
|
|
|
|
|
@ -108,7 +111,7 @@ main = do |
|
|
|
config <- readConfig "quik-connector.config.json" |
|
|
|
config <- readConfig "quik-connector.config.json" |
|
|
|
|
|
|
|
|
|
|
|
infoM "main" "Config loaded" |
|
|
|
infoM "main" "Config loaded" |
|
|
|
chan <- newBoundedChan 1000 |
|
|
|
chan <- atomically $ newTBQueue 1000 |
|
|
|
infoM "main" "Starting data import server" |
|
|
|
infoM "main" "Starting data import server" |
|
|
|
dis <- initDataImportServer [MkTableParser $ mkAllParamsTableParser "allparams"] chan "atrade" |
|
|
|
dis <- initDataImportServer [MkTableParser $ mkAllParamsTableParser "allparams"] chan "atrade" |
|
|
|
|
|
|
|
|
|
|
|
|