Example #1
0
 public TradeSessionOrchestrator(
     IBvbDataProvider bvbDataProvider,
     ITradeAutomation tradeAutomation,
     ITradeAdvisor tradeAdvisor,
     ILogger <TradeSessionOrchestrator> logger)
 {
     _bvbDataProvider = bvbDataProvider;
     _tradeAutomation = tradeAutomation;
     _tradeAdvisor    = tradeAdvisor;
     _logger          = logger;
 }
Example #2
0
        private void CreateImperaturMarket(ImperaturData SystemData)
        {
            m_oImperaturData = SystemData;

            CreateSystemNotification("Starting the initializing sequence");
            ImperaturGlobal.GetLogWithDirectory(m_oImperaturData.SystemDirectory).Info("Starting the initialize sequence");
            CreateSystemNotification("Creating cache objects");
            ImperaturGlobal.Initialize(m_oImperaturData, InitiateNinjectKernel(), null);


            List <account.AccountCacheType> BusinessAccounts = new List <account.AccountCacheType>();
            List <IAccountInterface>        oLAB             = new List <IAccountInterface>();

            CreateSystemNotification("Loading accounts");
            if (GetAccountHandler().Accounts().Where(a => a.GetAccountType().Equals(account.AccountType.Bank)).Count() == 0)
            {
                //create internalbankaccount for balance transactions
                //start by create the bankaccount
                oLAB.Add(
                    ImperaturGlobal.Kernel.Get <IAccountInterface>(
                        new Ninject.Parameters.ConstructorArgument("Customer", (object)null),
                        new Ninject.Parameters.ConstructorArgument("AccountType", AccountType.Bank),
                        new Ninject.Parameters.ConstructorArgument("AccountName", "INTERNALBANK")
                        )
                    );
            }
            if (GetAccountHandler().Accounts().Where(a => a.GetAccountType().Equals(account.AccountType.House)).Count() == 0)
            {
                //create internalbankaccount for balance transactions
                //start by create the bankaccount
                oLAB.Add(
                    ImperaturGlobal.Kernel.Get <IAccountInterface>(
                        new Ninject.Parameters.ConstructorArgument("Customer", (object)null),
                        new Ninject.Parameters.ConstructorArgument("AccountType", AccountType.House),
                        new Ninject.Parameters.ConstructorArgument("AccountName", "INTERNALHOUSE")
                        )
                    );
            }
            if (oLAB.Count() > 0)
            {
                GetAccountHandler().CreateAccount(oLAB);
            }

            //add all business accounts to cache
            BusinessAccounts = GetAccountHandler().Accounts().Where(a => !a.GetAccountType().Equals(account.AccountType.Customer)).
                               Select(b =>
                                      new account.AccountCacheType
            {
                AccountType = b.GetAccountType(),
                Identifier  = b.Identifier
            }).ToList();

            CreateSystemNotification("Initializing business accounts");
            ImperaturGlobal.InitializeBusinessAccount(BusinessAccounts);

            CreateSystemNotification("Loading instruments and qoutes");
            ImperaturGlobal.Quotes = GetTradeHandler().GetQuotes();

            CreateSystemNotification("Setting events");
            m_oQuoteTimer          = new System.Timers.Timer();
            m_oQuoteTimer.Elapsed += M_oQuoteTimer_Elapsed;
            m_oQuoteTimer.Interval = 1000 * 60 * Convert.ToInt32(m_oImperaturData.QuoteRefreshTime);
            m_oQuoteTimer.Enabled  = true;

            m_oDisplayCurrency = ImperaturGlobal.Kernel.Get <ICurrency>(new Ninject.Parameters.ConstructorArgument("CurrencyCode", m_oImperaturData.SystemCurrency));
            m_oTradeHandler.QuoteUpdateEvent += M_oTradeHandler_QuoteUpdateEvent;

            m_oOrderQueue      = null;
            m_oTradeAutomation = ImperaturGlobal.Kernel.Get <ITradeAutomation>(new Ninject.Parameters.ConstructorArgument("AccountHandler", GetAccountHandler()));

            m_oTradeAutomation.SystemNotificationEvent += M_oTradeAutomation_SystemNotificationEvent;
            OrderQueue.QueueMaintence(m_oAccountHandler);
            ImperaturGlobal.GetLog().Info("End of the initialize sequence");
            m_oAccountHandler.GetProfitPerForecast();
        }