Exemplo n.º 1
0
        public TransactionProcessor(
            IQuoteContext quoteContext,
            Account account,
            ISimulationSettings settings)
        {
            this.quoteContext = quoteContext;
            this.account = account;

            this.delay = settings.Get<TradeDelaySetting>();
            this.commission = settings.Get<CommissionSetting>();

            this.avgPrice = new double[quoteContext.TickerCount];
        }
Exemplo n.º 2
0
        bool ISimulationContext.Initialize(SyncTickers syncTickers, StrategyBase strategy, ISimulationSettings settings)
        {
            this.strategy = strategy;
            this.settings = settings;
            this.syncTickers = syncTickers;
            this.account = new Account(settings.Get<InitialEquitySetting>().Value);
            this.strategy.QuoteContext = this.quoteContext = new QuoteContext(syncTickers);
            this.transactionProcessor = new TransactionProcessor(quoteContext, account, settings);
            this.strategy.WalletContext = this.walletContext = new WalletContext(quoteContext, account, transactionProcessor);

            this.resultQuotes = new List<SimulationResultQuote>();

            return strategy.Initialize();
        }