예제 #1
0
        // Notes:
        // Each bot uses a different time frame, has different optimisation parameters, etc.
        // This is a base class providing common functionality to all 'Rylobots'.

        /// <summary></summary>
        protected override void OnStart()
        {
            Debug.WriteLine("Rylobot is a {0} bit process".Fmt(Environment.Is64BitProcess?"64":"32"));
            base.OnStart();

            Label = "{0}_{1}".Fmt(GetType().Name, Guid.NewGuid());

            Risk           = 0.1;
            TickNumber     = 0;
            BalanceMinimum = 0;
            EntryCooldown  = 0;

            // Load the global bot settings
            Settings = new Settings(Settings.DefaultFilepath);

            // Create the cache of symbol data
            m_sym_cache = new Cache <string, Symbol> {
                ThreadSafe = true, Mode = CacheMode.StandardCache
            };

            // Create the main instrument
            Instrument = new Instrument(this);

            // Create the account manager and trade creator
            Broker = new Broker(this, Account);

            // Position Managers
            PositionManagers = new List <PositionManager>();

            // Position groups
            PositionSets = new Dictionary <Guid, List <int> >();

            // Stats for the trades
            TradeStats = new TradeStats(this);

            // Create a debugging helper
            Debugging = new Debugging(this);

            base.Positions.Opened += HandlePositionOpened;
            base.Positions.Closed += HandlePositionClosed;
        }
예제 #2
0
 public Predictor(string name, TradeStats stats)
 {
     m_stats     = stats;
     Name        = name;
     Predictions = new Dictionary <int, Prediction>();
 }