Exemplo n.º 1
0
        /// <summary>Reset the simulation back to the start time</summary>
        public void Reset()
        {
            // Reset the account
            Acct.AccountId             = "Simulation";
            Acct.BrokerName            = "Rylogic Ltd";
            Acct.Currency              = "Spon";
            Acct.Balance               = StartingBalance;
            Acct.Equity                = StartingBalance;
            Acct.FreeMargin            = 100.0;
            Acct.IsLive                = false;
            Acct.Leverage              = 500;
            Acct.Margin                = 100.0;
            Acct.UnrealizedGrossProfit = 0.0;
            Acct.UnrealizedNetProfit   = 0.0;

            // Reset trades
            Positions.Clear();
            Pending.Clear();

            // Reset the sim clock
            UtcNow = StartTime;

            // Update the simulated account status
            SendAccountStatus();
            SendCurrentPositions();
            SendPendingPositions();

            // Notify reset
            OnSimReset();
        }
Exemplo n.º 2
0
 public Task Import(Stream xmlData, bool append)
 {
     return(Task.Run(() =>
     {
         var import = EntitySerializer.Deserialize <ToDoItem[]>(xmlData);
         if (append)
         {
             _db.Todo.Save(import);
         }
         else
         {
             _db.Todo.DeleteAll();
             _db.Todo.Save(import);
         }
         _application.CurrentDispatcher.Invoke(() =>
         {
             Pending.Clear();
             Pending.AddRange(_db.Todo.GetUncompleted());
             Completed.Clear();
             Completed.AddRange(_db.Todo.GetCompleteded());
         });
     }));
 }
Exemplo n.º 3
0
 public void Clear()
 {
     CurrentList.Clear();
     Pending.Clear();
 }
Exemplo n.º 4
0
 void IDisposable.Dispose()
 {
     _disposeJobs();
     Pending.Clear();
     Finished.Clear();
 }