Example #1
0
        protected DataProviderState dataProviderState;  // current state of our DataProvider ('READY' means the DataProvider is ready to use).

        protected DataProviderBase()
        {
            prop = new KeyValueCollection(PropertyNames);

            tradeCycle         = null;
            previousTradeCycle = null;
            sessionDetail      = null;

            // Assume we are in the READY state. Any data provider that is not in the READY state
            // when it starts up should change the dataProviderState value in its constructor.
            dataProviderState = DataProviderState.READY;
        }
Example #2
0
        /// <summary>
        /// Establish the beginning of a new Trade Cycle. If our current ("working")
        /// trade cycle is null, then we need to create one and add it to our Trade Metrics.
        /// </summary>
        void OpenNewTradeCycle()
        {
            if (tradeCycle == null)
            {
                tradeCycle = new TradeCycleDetail();
                Metrics.AddTradeCycle(tradeCycle);

                // Set this Trade Cycle as the current trade cycle for
                // all of the DataProviders in our trade.
                SetTradeCycleForDataProviders(tradeCycle);
            }
        }
Example #3
0
 /// <summary>
 /// For all DataProviders in this Trade, set the current ("working") trade cycle.
 /// </summary>
 /// <param name="cycle">the TradeCycleDetail object to pass to the DataProviders</param>
 void SetTradeCycleForDataProviders(TradeCycleDetail tc)
 {
     foreach (TradeStep step in tradeSteps.Values)
     {
         foreach (TradeRule rule in step.Rules)
         {
             foreach (RuleCondition condition in rule.Conditions)
             {
                 condition.Value1.DataProvider.TradeDetail = tc;
                 condition.Value2.DataProvider.TradeDetail = tc;
             }
         }
     }
 }
Example #4
0
 /// <summary>
 /// Establish the end of the Trade Cycle. We set our current ("working") trade
 /// cycle to null in order to indicate we are in a state where we have closed
 /// out our open trade cycle.
 /// </summary>
 void CloseTradeCycle()
 {
     SetTradeCycleForDataProviders(null);
     tradeCycle = null;
 }