コード例 #1
0
        } // TryPeriodicBookDrop()

        //
        //
        // *************************************************************
        // ****             StartNewDropArchive()                   ****
        // *************************************************************
        /// <summary>
        /// Create a new complete snapshot and drop in into file.
        /// Called by the FillHub thread, so we know no fills will be being added while we are here.
        /// </summary>
        public void StartNewDropArchive()
        {
            m_FillHub.Log.NewEntry(LogLevel.Major, "Running drop files for account/instrument {0} for {1}!", m_FillHub.Name, AppServices.GetInstance().m_AmbreUserName);

            if (m_FillHub.ListenerTradeSubscriptionFilter == null)
            {
                m_FillHub.Log.NewEntry(LogLevel.Warning, "*****Notice***** The account or instrument filter becomes corrupted because fill listener filter is null now");
                if (!string.IsNullOrEmpty(m_FillHub.m_LastListenAccountFilter))
                {
                    m_FillHub.ResetFillListener();
                }
            }
            else
            {
                if (m_FillHub.ListenerTradeSubscriptionFilter.GetType() != typeof(TradeSubscriptionAccountFilter) && m_FillHub.ListenerTradeSubscriptionFilter.GetType() != typeof(TradeSubscriptionInstrumentFilter))
                {
                    m_FillHub.Log.NewEntry(LogLevel.Warning, "*****Notice***** The account or instrument filter becomes corrupted because fill listener filter has different types from account or instrument filter");
                    if (!string.IsNullOrEmpty(m_FillHub.m_LastListenAccountFilter))
                    {
                        m_FillHub.ResetFillListener();
                    }
                }
            }
            m_FillHub.CheckMakeUpFilterArgs(m_FillHub.m_LastListenAccountFilter);
            string fillHubSnapshot = Stringifiable.Stringify(m_FillHub, m_StringifyOverrideTable);

            if (m_ArcBookWriter != null)
            {
                // Wrap up the current working file, and archive it.
                m_ArcBookWriter.RequestFlushNow();                  // Following procedure as above, make current file up to date...
                if (PushToRepository)                               // Now its up-to-date, push it to the repository group-shared drive.
                {
                    string droppath = string.Format("\\\\fileserver\\Users\\DV_Ambre\\AmbreUsers\\{0}\\Drops\\", AppServices.GetInstance().m_AmbreUserName);
                    string repoPath = DropSimple.GetArchivePath(DropFileStartDateTime, droppath);
                    m_FillHub.Log.NewEntry(LogLevel.Minor, "Sending request to copy to new drop directory:{0}.", repoPath);
                    m_ArcBookWriter.RequestCopyTo(repoPath, string.Empty);  // push current file to new repository now, keep same filename.
                    //m_ArcBookWriter.RequestCopyAllFiles(repoPath, "*FillBooks*");// try to sync all

                    // Also copy the files to old path that is \\\\fileserver\\Users\\dv_bre\\Ambre\\Drops\\ told by Mike.
                    // Temp fix to allow a smooth transition from the old approach to the new approach.
                    droppath = "\\\\fileserver\\Users\\dv_bre\\Ambre\\Drops\\";
                    repoPath = DropSimple.GetArchivePath(DropFileStartDateTime, droppath);
                    m_FillHub.Log.NewEntry(LogLevel.Minor, "Sending request to copy to old drop directory:{0}.", repoPath);
                    m_ArcBookWriter.RequestCopyTo(repoPath, string.Empty);
                }
                // Set new starting time stamp for the new archival file.
                DropFileStartDateTime = m_FillHub.Log.GetTime();                                                                              // This is time stamp of the next archive file to start.
                string archivalPath = DropSimple.GetArchivePath(DropFileStartDateTime, Misty.Lib.Application.AppInfo.GetInstance().DropPath); // Creates starting time stamp (now's date) in arcPath name.
                m_ArcBookWriter.RequestChangeFileName(archivalPath, GetArchiveFileName(DropFileStartDateTime, DropType_FillBook));            // Change current output filename to a new name (thereby ending our writes to the last one).
                m_ArcBookWriter.RequestEnqueue(fillHubSnapshot);                                                                              // initialize the new file with new snapshot
                m_ArcBookWriter.RequestFlushNow();                                                                                            // flush it just in case, so at least some entry is present in file if we crash.
            }
            LastBookDrop = m_FillHub.Log.GetTime();                                                                                           // store the time we last did a snapshot.
        } // DropFillBooks()
コード例 #2
0
ファイル: DropRules.cs プロジェクト: nagyist/mkbiltek.trading
        } // TryPeriodicBookDrop()

        //
        //
        // *************************************************************
        // ****             StartNewDropArchive()                   ****
        // *************************************************************
        /// <summary>
        /// Create a new complete snapshot and drop in into file.
        /// Called by the FillHub thread, so we know no fills will be being added while we are here.
        /// </summary>
        public void StartNewDropArchive()
        {
            string fillHubSnapshot = Stringifiable.Stringify(m_FillHub, m_StringifyOverrideTable);

            // Copy and reinitialize the local file
            if (m_LocalBookWriter != null)
            {
                m_LocalBookWriter.RequestFlushNow();                // Flush queue into the current file, making it up-to-date.
                string fileName = GetLocalFileName();               // Local drop-file name
                string path     = string.Format("{0}Previous\\", GetLocalPath());
                m_LocalBookWriter.RequestMoveTo(path, fileName);    // Move the current drop file to a safe, backup area.
                m_LocalBookWriter.RequestEnqueue(fillHubSnapshot);  // Create a new local drop file, and initialize it w/ snapshot
                m_LocalBookWriter.RequestFlushNow();                // I like to push out the first snapshot immediately...
            }

            // Archive and restart new archival files.
            if (m_ArcBookWriter != null)
            {
                m_ArcBookWriter.RequestFlushNow();                  // Following procedure as above, make current file up to date...
                if (PushToRepository)                               // Now its up-to-date, push it to the repository group-shared drive.
                {
                    string repoPath = GetRepositoryPath(DropFileStartDateTime);
                    m_ArcBookWriter.RequestCopyTo(repoPath, string.Empty);                                                           // push current file to repository now, keep same filename.
                    m_ArcBookWriter.RequestCopyAllFiles(repoPath, string.Format("*{0}", GetArchiveFileNameBase(DropType_FillBook))); // try to sync all
                }
                // Set new starting time stamp for the new archival file.
                DropFileStartDateTime = m_FillHub.Log.GetTime();                                                          // This is time stamp of the next archive file to start.
                string archivalPath = GetArchivePath(DropFileStartDateTime);                                              // Creates starting time stamp (now's date) in arcPath name.
                m_ArcBookWriter.RequestChangeFileName(archivalPath, GetArchiveFileName(DateTime.Now, DropType_FillBook)); // Change current output filename to a new name (thereby ending our writes to the last one).
                m_ArcBookWriter.RequestEnqueue(fillHubSnapshot);                                                          // initialize the new file with new snapshot
                m_ArcBookWriter.RequestFlushNow();                                                                        // flush it just in case.
            }

            // Archive
            if (m_FillWriter != null)
            {
                m_FillWriter.RequestFlushNow();
                string archivalPath = GetArchivePath(DropFileStartDateTime);// Creates starting time stamp (now's date) in arcPath name.
                m_FillWriter.RequestChangeFileName(archivalPath, GetArchiveFileName(DropFileStartDateTime, DropType_Fills));
            }

            // Store the time we did this snapshot.
            LastBookDrop = m_FillHub.Log.GetTime();                 // store the time we last did a snapshot.
        } // DropFillBooks()
コード例 #3
0
        } // TryPeriodicBookDrop()

        //
        //
        // *************************************************************
        // ****             StartNewDropArchive()                   ****
        // *************************************************************
        /// <summary>
        /// Create a new complete snapshot and drop in into file.
        /// Called by the FillHub thread, so we know no fills will be being added while we are here.
        /// </summary>
        public void StartNewDropArchive()
        {
            string fillHubSnapshot = Stringifiable.Stringify(m_FillHub, m_StringifyOverrideTable);

            if (m_ArcBookWriter != null)
            {
                // Wrap up the current working file, and archive it.
                m_ArcBookWriter.RequestFlushNow();                  // Following procedure as above, make current file up to date...
                if (PushToRepository)                               // Now its up-to-date, push it to the repository group-shared drive.
                {
                    string repoPath = DropSimple.GetArchivePath(DropFileStartDateTime, DropRules.BreRepositoryPath);
                    m_ArcBookWriter.RequestCopyTo(repoPath, string.Empty);  // push current file to repository now, keep same filename.
                    //m_ArcBookWriter.RequestCopyAllFiles(repoPath, "*FillBooks*");// try to sync all
                }
                // Set new starting time stamp for the new archival file.
                DropFileStartDateTime = m_FillHub.Log.GetTime();                                                                           // This is time stamp of the next archive file to start.
                string archivalPath = DropSimple.GetArchivePath(DropFileStartDateTime, UV.Lib.Application.AppInfo.GetInstance().DropPath); // Creates starting time stamp (now's date) in arcPath name.
                m_ArcBookWriter.RequestChangeFileName(archivalPath, GetArchiveFileName(DropFileStartDateTime, DropType_FillBook));         // Change current output filename to a new name (thereby ending our writes to the last one).
                m_ArcBookWriter.RequestEnqueue(fillHubSnapshot);                                                                           // initialize the new file with new snapshot
                m_ArcBookWriter.RequestFlushNow();                                                                                         // flush it just in case, so at least some entry is present in file if we crash.
            }
            LastBookDrop = m_FillHub.Log.GetTime();                                                                                        // store the time we last did a snapshot.
        } // DropFillBooks()