Esempio n. 1
0
        void BtnNuke_Click(object sender, EventArgs e)
        {
            DialogResult DResult = MessageBox.Show("Do you want to wipe out whole data base ?\nAll stored records will be removed.", "Unsafe operation warning !", MessageBoxButtons.YesNo);

            if (DResult == DialogResult.Yes)
            {
                BtnNuke.Enabled = false;
                Methods.Run(() => Manager.ForexArchive.RemoveAll(), null, true, true);
            }
            else
            {
                return;
            }
        }
Esempio n. 2
0
        public Archive()
        {
            ThreadsLoad = new ThreadedMethod(25, System.Threading.ThreadPriority.Highest, 1);
            ThreadsMain = new ThreadedMethod(25, System.Threading.ThreadPriority.Highest, 1);
            ThreadsSave = new ThreadedMethod(25, System.Threading.ThreadPriority.Normal, 1);

            //FileDictionary<TickTime, DealRequest> IODictionary = new FileDictionary<TickTime, DealRequest>(@"C:\k.k", -10);
            //DateTime nnn = (DateTime)IODictionary.Data.First().Value.CreationTime; if (nnn == DateTime.Now) return;
            //StopWatch.Run("IO");
            //for (int i = 0; i < 1000; i++)
            //{
            //    DealRequest DR = new DealRequest();
            //    DR.ASK = 1;
            //    DR.BID = -1;
            //    DR.TFBuySell = true;
            //    DR.CreationTime = (TickTime)TickTime.Now;
            //    IODictionary.Add(DR.CreationTime, DR);


            //    //
            //}
            //double msss = StopWatch.ms("IO");
            //IODictionary.SaveData();
            //if (msss > 100000000)
            //    Asmodat.Foo.nop();

            ThreadsMain.Run(() => this.LoadAll(), null, true, true);
        }
Esempio n. 3
0
        public Archive(KrakenManager Manager)
        {
            this.Manager = Manager;


            Methods.Run(() => this.Initialize(), null);
            Timers.Run(() => this.TimerOrders(), 10000, null, true, true);
        }
Esempio n. 4
0
        public void MonteCarlo(string pair, ServiceConfiguration.TimeFrame frame, int span, int tests)
        {
            if (Methods.Count >= tests + 1)
            {
                return;
            }


            Rate[] Rates = ForexArchive.Data.GetValuesArray <ServiceConfiguration.TimeFrame, DateTime, Rate>(pair, frame); //Manager.ForexArchive.Data[pair][ServiceConfiguration.TimeFrame.DAILY].ValuesArray;// //
            if (Objects.IsNullOrEmpty(Rates) || !ServiceConfiguration.IsSpan(frame))
            {
                return;
            }

            double[] data = Objects.ToArray <double>(RateInfo.Extract(Rates, RateInfo.Properties.CLOSE));
            TestData = data;

            Key = pair + frame + span;
            int[] points = AMath.Random(Rates.Length / 2, Rates.Length - 2 - span, tests);

            if (Objects.IsNullOrEmpty(points) && tests > 0)
            {
                return;
            }

            List <int> indexes = new List <int>();

            indexes.Add(data.Length - 1);
            if (points != null)
            {
                indexes.AddRange(points);
            }
            Indexes = indexes.ToArray();

            if (Objects.IsNullOrEmpty(Indexes))
            {
                return;
            }

            StopSimulations = false;


            foreach (int i in Indexes)
            {
                Methods.Run(() => this.MonteCarlo(data, Key + "idx" + i, span, i), Key + "idx" + i, true, false);
            }
        }
Esempio n. 5
0
        public void StopAll()
        {
            Method.Terminate("main");


            var keys = D2Sockets.Keys;

            try
            {
                ThreadedMethod methods = new ThreadedMethod(keys.Length);

                foreach (string key in keys)
                {
                    methods.Run(() => this.Stop(key), "stop" + key, true, false);
                }

                methods.JoinAll();
            }
            finally
            {
                Method.Terminate(() => StartListening());
            }
        }
Esempio n. 6
0
        //cm sis

        void TimrMain_Elapsed(object sender, ElapsedEventArgs e)
        {
            //Method.Run(() => this.Accept(TcpAsyncCommon.DefaultUID + iAcceptCounter), "Accept", true, false);
            Method.Run(() => Communication(), "Communication", true, false);
        }
Esempio n. 7
0
        // public ThreadedTimers Timers = new ThreadedTimers();

        //public void Feed(ref Manager Manager)
        //{
        //    this.Manager = Manager;
        //    Methods.Run(() => Init(), null);
        //}

        //public void Feed(ref ChartControl Chart)
        //{
        //    this.Chart = Chart;
        //    Methods.Run(() => Init(), null);
        //}


        public void Feed(ref Manager Manager, ref ChartControl Chart)
        {
            this.Manager = Manager;
            this.Chart   = Chart;
            Methods.Run(() => Init(), null);
        }
Esempio n. 8
0
 public void SaveDataRequest(string ID = null)
 {
     ThreadRequest.Run(() => FileDealRequest.Save(DataDealRequest.XmlSerialize()), "Request_IO_" + ID, true, true);
 }