// helper stuff

        /// <summary>
        /// shutdown a response entirely, flat all positions and notify user
        /// </summary>
        /// <param name="_pt"></param>
        /// <param name="gt"></param>
        public void shutdown(PositionTracker _pt, GenericTrackerI gt)
        {
            if (!isValid)
            {
                return;
            }
            D("ShutdownTime");
            isValid = false;
            bool ShutdownFlat = _pt != null;
            bool usegt        = gt != null;

            if (ShutdownFlat)
            {
                D("flatting positions at shutdown.");
                foreach (Position p in _pt)
                {
                    if (usegt && (gt.getindex(p.symbol) < 0))
                    {
                        continue;
                    }
                    Order o = new MarketOrderFlat(p);
                    D("flat order: " + o.ToString());
                    sendorder(o);
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// creates a tickwatcher and polls specificed millseconds
 /// if timer has expired, sends alert.
 /// Background polling occurs in addition to tick-induced time checks.
 /// </summary>
 /// <param name="BackgroundPollIntervalms">Value in millseconds to wait between checks.  0 = disable background checks</param>
 public TickWatcher(int BackgroundPollIntervalms, GenericTrackerI symboltracker)
 {
     _ast     = symboltracker;
     _pollint = (long)Math.Abs(BackgroundPollIntervalms);
     if (_pollint != 0)
     {
         Start();
     }
 }
        // helper stuff

        /// <summary>
        /// shutdown a response entirely, flat all positions and notify user
        /// </summary>
        /// <param name="_pt"></param>
        /// <param name="gt"></param>
        public void shutdown(PositionTracker _pt, GenericTrackerI gt)
        {
            send_event(MimeType.shutdown, "foo", "boo".ToJson());

            if (!isValid) return;
            D("ShutdownTime");
            isValid = false;
            bool ShutdownFlat = _pt != null;
            bool usegt = gt != null;
            if (ShutdownFlat)
            {

                D("flatting positions at shutdown.");
                foreach (Position p in _pt)
                {
                    if (usegt && (gt.getindex(p.symbol) < 0)) continue;
                    Order o = new MarketOrderFlat(p);
                    D("flat order: " + o.ToString());
                    sendorder(o);
                }
            }
        }
Beispiel #4
0
 /// <summary>
 /// creates a tickwatcher and polls specificed millseconds
 /// if timer has expired, sends alert.
 /// Background polling occurs in addition to tick-induced time checks.
 /// </summary>
 /// <param name="BackgroundPollIntervalms">Value in millseconds to wait between checks.  0 = disable background checks</param>
 public TickWatcher(int BackgroundPollIntervalms, GenericTrackerI symboltracker)
 {
     _ast = symboltracker;
     _pollint = (long)Math.Abs(BackgroundPollIntervalms);
     if (_pollint != 0)
         Start();
 }
Beispiel #5
0
 public TickWatcher(GenericTrackerI symboltracker) : this(DEFAULTPOLLINT, symboltracker) { }
Beispiel #6
0
 public TickWatcher(bool islive, GenericTrackerI symtracker) : this(islive ? DEFAULTPOLLINT : 0, symtracker) { }
Beispiel #7
0
 public TickWatcher(GenericTrackerI symboltracker) : this(DEFAULTPOLLINT, symboltracker)
 {
 }
Beispiel #8
0
 public TickWatcher(bool islive, GenericTrackerI symtracker) : this(islive ? DEFAULTPOLLINT : 0, symtracker)
 {
 }