public void Unsubscribe(IExecutionProvider provider) { provider.PreTestInitEvent -= PreTestInit; provider.PostTestInitEvent -= PostTestInit; provider.PreTestCleanupEvent -= PreTestCleanup; provider.PostTestCleanupEvent -= PostTestCleanup; }
protected StrategyBase(string name, string description) { this.metaStrategyBase = null; this.name = name; this.description = description; this.isEnabled = true; this.isActive = true; this.ReportManager = (StrategyComponentManager.GetComponent("{5E7810DC-C9C1-427f-8CD9-1DFFE26E59B5}", this) as ReportManager); this.MarketManager = (StrategyComponentManager.GetComponent("{849E4CFE-C19E-4d1e-899D-0BB26DB12AAD}", this) as MarketManager); this.portfolio = PortfolioManager.Portfolios[name]; if (this.portfolio == null) { this.portfolio = new Portfolio(name); } this.tester = new LiveTester(this.portfolio); this.stops = new StopList(); this.triggers = new TriggerList(); this.marketDataProvider = null; this.executionProvider = null; this.newsProvider = null; this.executionService = null; this.orders = new OrderTable(); this.global = new Hashtable(); this.activeInstruments = new InstrumentList(); this.barSliceManager = new BarSliceManager(); this.componentTypeList = new List <ComponentType>(); this.componentTypeList.Add(ComponentType.MarketManager); this.componentTypeList.Add(ComponentType.ReportManager); this.activeStops = new Dictionary <Instrument, List <StopBase> >(); this.portfolios = new Dictionary <Instrument, Portfolio>(); this.testers = new Dictionary <Instrument, LiveTester>(); this.statisticsPerInstrumentEnabled = false; }
public void Subscribe(IExecutionProvider provider) { provider.PreTestInitEvent += this.PreTestInit; provider.PostTestInitEvent += this.PostTestInit; provider.PreTestCleanupEvent += this.PreTestCleanup; provider.PostTestCleanupEvent += this.PostTestCleanup; }
protected void SetupTestWithBreakpoint(int line) { _breakpointProvider = new BreakpointProvider(); _breakpointProvider.ToggleBreakpointAt(LocationOfSourceFile, line); new BreakpointMediator(_vm, _breakpointProvider); ExecutionProvider = new ExecutionProvider(_vm); }
public void Add(IExecutionProvider provider) { if (!this.providers.Contains(provider)) { this.providers.Add(provider); } }
internal IExecutionProvider GetExecutionProvider(Instrument instrument) { IExecutionProvider executionProvider = null; if (instrument.ExecutionProvider != null) { executionProvider = instrument.ExecutionProvider; } if (executionProvider == null && this.ExecutionProvider != null) { executionProvider = this.ExecutionProvider; } if (this.Mode != StrategyMode.Live) { if (executionProvider != null && executionProvider is SellSideStrategy) { return(executionProvider); } return(this.framework.providerManager.executionSimulator); } else { if (executionProvider != null) { return(executionProvider); } return(this.framework.ExecutionProvider); } }
public Order(Order order) { Id = order.Id; ClId = order.ClId; AlgoId = order.AlgoId; ProviderOrderId = order.ProviderOrderId; ProviderId = order.ProviderId; PortfolioId = order.PortfolioId; StrategyId = order.StrategyId; InstrumentId = order.InstrumentId; TransactTime = order.TransactTime; DateTime = order.DateTime; Instrument = order.Instrument; provider = order.Provider; Portfolio = order.Portfolio; Status = order.Status; Side = order.Side; Type = order.Type; TimeInForce = order.TimeInForce; ExpireTime = order.ExpireTime; Price = order.Price; StopPx = order.StopPx; AvgPx = order.AvgPx; Qty = order.Qty; CumQty = order.CumQty; MinQty = order.MinQty; PegDifference = order.pegDifference; ExecInst = order.execInst; Text = order.Text; Account = order.Account; ClientID = order.ClientID; Commands = order.Commands; Reports = order.Reports; Messages = order.Messages; }
public Order(Order order) : base() { this.id = -1; this.oCA = ""; this.text = ""; this.id = order.id; this.providerId = order.providerId; this.portfolioId = order.portfolioId; this.transactTime = order.transactTime; this.dateTime = order.dateTime; this.instrument = order.instrument; this.provider = order.provider; this.portfolio = order.portfolio; this.status = order.status; this.side = order.side; this.type = order.type; this.timeInForce = order.timeInForce; this.price = order.price; this.stopPx = order.stopPx; this.avgPx = order.avgPx; this.qty = order.qty; this.cumQty = order.cumQty; this.text = order.text; this.commands = order.commands; this.reports = order.reports; this.messages = order.messages; }
protected void Init(IMarketDataProvider marketDataProvider, IExecutionProvider executionProvider, Portfolio portfolio, bool asyncEventProcessing) { this.marketDataProvider = marketDataProvider; this.executionProvider = executionProvider; this.portfolio = portfolio; this.eventQueue.Enabled = asyncEventProcessing; }
protected StrategyBase(string name, string description) { this.metaStrategyBase = (MetaStrategyBase)null; this.name = name; this.description = description; this.isEnabled = true; this.isActive = true; this.ReportManager = StrategyComponentManager.GetComponent("getcom", (object)this) as ReportManager; this.MarketManager = StrategyComponentManager.GetComponent("getcom", (object)this) as MarketManager; this.portfolio = PortfolioManager.Portfolios[name]; if (this.portfolio == null) { this.portfolio = new Portfolio(name); } this.tester = new LiveTester(this.portfolio); this.stops = new StopList(); this.triggers = new TriggerList(); this.marketDataProvider = (IMarketDataProvider)null; this.executionProvider = (IExecutionProvider)null; this.newsProvider = (INewsProvider)null; this.executionService = (IExecutionService)null; this.orders = new OrderTable(); this.global = new Hashtable(); this.activeInstruments = new InstrumentList(); this.barSliceManager = new BarSliceManager(); this.componentTypeList = new List <ComponentType>(); this.componentTypeList.Add(ComponentType.MarketManager); this.componentTypeList.Add(ComponentType.ReportManager); this.activeStops = new Dictionary <Instrument, List <StopBase> >(); this.portfolios = new Dictionary <Instrument, Portfolio>(); this.testers = new Dictionary <Instrument, LiveTester>(); this.statisticsPerInstrumentEnabled = false; }
public void Unsubscribe(IExecutionProvider provider) { provider.OnClientInitializedEvent -= OnClientInitialized; provider.OnRequestTimeoutEvent -= OnRequestTimeout; provider.OnMakingRequestEvent -= OnMakingRequest; provider.OnRequestMadeEvent -= OnRequestMade; provider.OnRequestFailedEvent -= OnRequestFailed; }
public void Subscribe(IExecutionProvider provider) { provider.TestInstantiatedEvent += TestInstantiated; provider.PreTestInitEvent += PreTestInit; provider.PostTestInitEvent += PostTestInit; provider.PreTestCleanupEvent += PreTestCleanup; provider.PostTestCleanupEvent += PostTestCleanup; }
public LocalsWindow(IDebuggerSession session, IExecutionProvider executionProvider) { this.session = session; this.executionProvider = executionProvider; this.executionProvider.Suspended += (thread) => { QueueUserWorkItem (() => pendingFrame = thread.GetFrames ().FirstOrDefault()); }; }
public void Unsubscribe(IExecutionProvider provider) { provider.TestInstantiatedEvent -= this.TestInstantiated; provider.PreTestInitEvent -= this.PreTestInit; provider.PostTestInitEvent -= this.PostTestInit; provider.PreTestCleanupEvent -= this.PreTestCleanup; provider.PostTestCleanupEvent -= this.PostTestCleanup; }
public LocalsWindow(IDebuggerSession session, IExecutionProvider executionProvider) { this.session = session; this.executionProvider = executionProvider; this.executionProvider.Suspended += (thread) => { QueueUserWorkItem(() => pendingFrame = thread.GetFrames().FirstOrDefault()); }; }
public void Subscribe(IExecutionProvider provider) { provider.TestInstantiatedEvent += this.TestInstantiated; provider.PreTestInitEvent += this.PreTestInit; provider.PostTestInitEvent += this.PostTestInit; provider.PreTestCleanupEvent += this.PreTestCleanup; provider.PostTestCleanupEvent += this.PostTestCleanup; }
public CallstackWindow(IDebuggerSession session, IExecutionProvider executionProvider, IThreadProvider threadProvider, ISourceNavigator sourceNavigator) { this.session = session; this.executionProvider = executionProvider; this.threadProvider = threadProvider; this.executionProvider.Suspended += (thread) => pendingFrames = thread.GetFrames ();; this.sourceNavigator = sourceNavigator; }
public CallStackDisplay(IDebuggerSession session, IExecutionProvider executionProvider, IThreadProvider threadProvider, ISourceNavigator sourceNavigator) { this.session = session; this.executionProvider = executionProvider; this.threadProvider = threadProvider; this.executionProvider.Suspended += RefreshFrames; this.sourceNavigator = sourceNavigator; }
private static void InitializeTestExecutionBehaviours(IExecutionProvider testExecutionProvider) { var observers = UnityContainerFactory.GetCurrentContainer().ResolveAll <ITestBehaviourObserver>(); foreach (var observer in observers) { observer.Subscribe(testExecutionProvider); } }
public CallstackWindow(IDebuggerSession session, IExecutionProvider executionProvider, IThreadProvider threadProvider, ISourceNavigator sourceNavigator) { this.session = session; this.executionProvider = executionProvider; this.threadProvider = threadProvider; this.executionProvider.Suspended += (thread) => pendingFrames = thread.GetFrames();; this.sourceNavigator = sourceNavigator; }
public TrailingStopOrder(IExecutionProvider provider, Portfolio portfolio, Instrument instrument, Side side, double qty, double delta) : base() { this.OrdType = OrdType.TrailingStop; this.Provider = provider; this.Portfolio = portfolio; this.Instrument = instrument; this.Side = side; this.OrderQty = qty; this.TrailingAmt = delta; }
public MarketOrder(IExecutionProvider provider, Portfolio portfolio, Instrument instrument, Side side, double qty, string text) : base() { this.OrdType = OrdType.Market; this.Provider = provider; this.Portfolio = portfolio; this.Instrument = instrument; this.Side = side; this.OrderQty = qty; this.Text = text; }
public void AddInstrument(Instrument instrument, IMarketDataProvider marketDataProvider, IExecutionProvider executionProvider) { if (!this.cYRAR9UWJy.Contains(instrument)) this.cYRAR9UWJy.Add(instrument); this.nxTAjlViDK[instrument] = marketDataProvider == null ? this.strategyMarketDataProvider : marketDataProvider; if (executionProvider != null) this.utDAWNS3ic[instrument] = executionProvider; else this.utDAWNS3ic[instrument] = this.strategyExecutionProvider; }
public DebuggerSession(IVirtualMachine virtualMachine, IExecutionProvider executionProvider, ITypeProvider typeProvider, IThreadProvider threadProvider, IBreakpointProvider breakpointProvider) { VM = virtualMachine; ExecutionProvider = executionProvider; ThreadProvider = threadProvider; TypeProvider = typeProvider; BreakpointProvider = breakpointProvider; }
public DebuggerSession(IVirtualMachine vm, ITypeProvider typeProvider, IExecutionProvider executionProvider, IThreadProvider threadProvider, IBreakpointProvider breakpointProvider) { this.typeProvider = typeProvider; this.executionProvider = executionProvider; this.threadProvider = threadProvider; this.breakpointProvider = breakpointProvider; this.vm = vm; }
public ConfigurationInfo(string portfolioName, byte marketDataProviderId, byte executionProviderId) { this.portfolio = PortfolioManager.Portfolios[portfolioName]; if (this.portfolio == null) this.portfolio = new Portfolio(portfolioName); this.marketDataProvider = ProviderManager.MarketDataProviders[marketDataProviderId]; this.executionProvider = ProviderManager.ExecutionProviders[executionProviderId]; this.marketDataProviderId = this.marketDataProvider == null ? marketDataProviderId : (byte)0; this.executionProviderId = this.executionProvider == null ? executionProviderId : (byte)0; }
public StopLimitOrder(IExecutionProvider provider, Portfolio portfolio, Instrument instrument, Side side, double qty, double price, double stopPx) : base() { this.OrdType = OrdType.StopLimit; this.Provider = provider; this.Portfolio = portfolio; this.Instrument = instrument; this.Side = side; this.OrderQty = qty; this.Price = price; this.StopPx = stopPx; }
static public void UserInputProviderId(out IDataProvider dataProvider, out IExecutionProvider executionProvider, ProviderManager pm) { string providerId = Interaction.InputBox("輸入交易所代號", "", "89");//89=deribit by user define dataProvider = pm.GetDataProvider(int.Parse(providerId)); executionProvider = pm.GetExecutionProvider(int.Parse(providerId)); if (dataProvider == null || executionProvider == null) { throw new Exception("provider is null"); } }
static ProviderManager() { ProviderManager.dataLock = new object(); ProviderManager.executionProviders = new ExecutionProviderList(); ProviderManager.marketDataProviders = new MarketDataProviderList(); ProviderManager.instrumentProviders = new InstrumentProviderList(); ProviderManager.historicalDataProviders = new HistoricalDataProviderList(); ProviderManager.marketDataProvider = null; ProviderManager.executionProvider = null; ProviderManager.errors = new ProviderErrorCollection(); }
public TrailingStopLimitOrder(IExecutionProvider provider, Portfolio portfolio, Instrument instrument, Side side, double qty, double delta, double stopPrice, double limitPrice) : base() { this.OrdType = OrdType.TrailingStopLimit; this.Provider = provider; this.Portfolio = portfolio; this.Instrument = instrument; this.Side = side; this.OrderQty = qty; this.TrailingAmt = delta; this.StopPx = stopPrice; this.Price = limitPrice; }
internal void Refresh() { if (this.marketDataProvider == null) { this.marketDataProvider = ProviderManager.MarketDataProviders[this.marketDataProviderId]; } if (this.executionProvider != null) { return; } this.executionProvider = ProviderManager.ExecutionProviders[this.executionProviderId]; }
public ConfigurationInfo(string portfolioName, byte marketDataProviderId, byte executionProviderId) { this.portfolio = PortfolioManager.Portfolios[portfolioName]; if (this.portfolio == null) { this.portfolio = new Portfolio(portfolioName); } this.marketDataProvider = ProviderManager.MarketDataProviders[marketDataProviderId]; this.executionProvider = ProviderManager.ExecutionProviders[executionProviderId]; this.marketDataProviderId = this.marketDataProvider == null ? marketDataProviderId : (byte)0; this.executionProviderId = this.executionProvider == null ? executionProviderId : (byte)0; }
internal void RegisterStrategy(Strategy strategy, InstrumentList instruments, int orderRouteId) { strategy.portfolio.Parent = this.portfolio; foreach (Instrument current in instruments) { LinkedList <Strategy> linkedList; if (this.strategiesByInstrument[current.Id] == null) { linkedList = new LinkedList <Strategy>(); this.strategiesByInstrument[current.Id] = linkedList; } else { linkedList = this.strategiesByInstrument[current.Id]; } linkedList.Add(strategy); IdArray <int> idArray; int num; (idArray = this.instrumentCountTable)[num = current.id] = idArray[num] + 1; } Dictionary <IDataProvider, InstrumentList> dictionary = new Dictionary <IDataProvider, InstrumentList>(); foreach (Instrument current2 in instruments) { InstrumentList instrumentList = null; IDataProvider dataProvider = this.GetDataProvider(strategy, current2); IExecutionProvider executionProvider = strategy.GetExecutionProvider(current2); if (dataProvider.Status == ProviderStatus.Disconnected) { dataProvider.Connect(); } if (executionProvider.Status == ProviderStatus.Disconnected) { executionProvider.Connect(); } if (!dictionary.TryGetValue(dataProvider, out instrumentList)) { instrumentList = new InstrumentList(); dictionary[dataProvider] = instrumentList; } instrumentList.Add(current2); } foreach (KeyValuePair <IDataProvider, InstrumentList> current3 in dictionary) { this.framework.strategyManager.RegisterMarketDataRequest(current3.Key, current3.Value); } this.strategyByOrderId[orderRouteId] = strategy; if (this.parent != null) { this.parent.RegisterStrategy(this, instruments, orderRouteId); } }
public Order(IExecutionProvider provider, Instrument instrument, OrderType type, OrderSide side, double qty, double price = 0, double stopPx = 0, TimeInForce timeInForce = TimeInForce.Day, string text = "") : this() { Provider = provider; Instrument = instrument; Type = type; Side = side; Qty = qty; Price = price; StopPx = stopPx; TimeInForce = timeInForce; Text = text; }
public Order(IExecutionProvider provider, Instrument instrument, OrderType type, OrderSide side, double qty, double price = 0.0, double stopPx = 0.0, TimeInForce timeInForce = TimeInForce.Day, string text = "") : this() { this.provider = provider; this.instrument = instrument; this.type = type; this.side = side; this.qty = qty; this.price = price; this.stopPx = stopPx; this.timeInForce = timeInForce; this.text = text; this.portfolio = null; }
public DebuggerSession(IVirtualMachine vm, ITypeProvider typeProvider, IExecutionProvider executionProvider, IThreadProvider threadProvider, IBreakpointProvider breakpointProvider) { this.typeProvider = typeProvider; this.executionProvider = executionProvider; this.threadProvider = threadProvider; this.breakpointProvider = breakpointProvider; this.vm = vm; LogProvider.Debug += s => LogOnDebug(s); LogProvider.Error += s => LogOnError(s); }
public DebuggerSession(IVirtualMachine vm, ITypeProvider typeProvider, IExecutionProvider executionProvider, IThreadProvider threadProvider, IBreakpointProvider breakpointProvider) { this.typeProvider = typeProvider; this.executionProvider = executionProvider; this.threadProvider = threadProvider; this.breakpointProvider = breakpointProvider; this.vm = vm; LogProvider.Debug += s => LogOnDebug (s); LogProvider.Error += s => LogOnError (s); }
public ExecutionWindow(IDebuggerSession session, IExecutionProvider executionProvider) { this.session = session; this.executionProvider = executionProvider; this.executionProvider.Break += location => { if (lastStop == location) { executionProvider.Resume (); return; } lastStop = location; SourceNavigator.ShowSourceLocation (location); }; }
public QuoteMonitorWidget(string providerName) { Build(); var f = Framework.Current; var provider = f.ProviderManager.GetProvider(providerName); this.dataProvider = provider as IDataProvider; this.executionProvider = provider as IExecutionProvider; this.portfolio = new Portfolio(f, "QuoteMonitor"); Name = string.Format("QuoteMonitor [{0}]", providerName); f.EventManager.Dispatcher.Bid += new BidEventHandler(this.OnBid); f.EventManager.Dispatcher.Ask += new AskEventHandler(this.OnAsk); f.EventManager.Dispatcher.Trade += new TradeEventHandler(this.OnTrade); }
public StopOrder(IExecutionProvider provider, Portfolio portfolio, Instrument instrument, Side side, double qty, double stopPx) : this(provider, portfolio, instrument, side, qty, stopPx, null) { }
internal IExecutionProvider GetExecutionProvider(Instrument instrument) { IExecutionProvider executionProvider = null; if (instrument.ExecutionProvider != null) { executionProvider = instrument.ExecutionProvider; } if (executionProvider == null && this.ExecutionProvider != null) { executionProvider = this.ExecutionProvider; } if (this.Mode != StrategyMode.Live) { if (executionProvider != null && executionProvider is SellSideStrategy) { return executionProvider; } return this.framework.providerManager.executionSimulator; } else { if (executionProvider != null) { return executionProvider; } return this.framework.ExecutionProvider; } }
protected StrategyBase(string name, string description) { this.metaStrategyBase = (MetaStrategyBase) null; this.name = name; this.description = description; this.isEnabled = true; this.isActive = true; this.ReportManager = StrategyComponentManager.GetComponent("getcom", (object) this) as ReportManager; this.MarketManager = StrategyComponentManager.GetComponent("getcom", (object) this) as MarketManager; this.portfolio = PortfolioManager.Portfolios[name]; if (this.portfolio == null) this.portfolio = new Portfolio(name); this.tester = new LiveTester(this.portfolio); this.stops = new StopList(); this.triggers = new TriggerList(); this.marketDataProvider = (IMarketDataProvider) null; this.executionProvider = (IExecutionProvider) null; this.newsProvider = (INewsProvider) null; this.executionService = (IExecutionService) null; this.orders = new OrderTable(); this.global = new Hashtable(); this.activeInstruments = new InstrumentList(); this.barSliceManager = new BarSliceManager(); this.componentTypeList = new List<ComponentType>(); this.componentTypeList.Add(ComponentType.MarketManager); this.componentTypeList.Add(ComponentType.ReportManager); this.activeStops = new Dictionary<Instrument, List<StopBase>>(); this.portfolios = new Dictionary<Instrument, Portfolio>(); this.testers = new Dictionary<Instrument, LiveTester>(); this.statisticsPerInstrumentEnabled = false; }
public Order SellPegged(IExecutionProvider provider, Instrument instrument, double qty, double offset, string text = "") { Order order = new Order(provider, this.Portfolio, instrument, OrderType.Pegged, OrderSide.Sell, qty, 0.0, 0.0, TimeInForce.Day, 0, ""); order.StrategyId = this.Id; order.StopPx = offset; order.Text = text; this.Send(order); return order; }
private void SetRawExecutionProvider(IExecutionProvider executionProvider) { this.executionProvider = executionProvider; }
internal void Refresh() { if (this.marketDataProvider == null) this.marketDataProvider = ProviderManager.MarketDataProviders[this.marketDataProviderId]; if (this.executionProvider != null) return; this.executionProvider = ProviderManager.ExecutionProviders[this.executionProviderId]; }
public Order Buy(IExecutionProvider provider, Instrument instrument, double qty, string text = "") { Order order = new Order(provider, this.Portfolio, instrument, OrderType.Market, OrderSide.Buy, qty, 0.0, 0.0, TimeInForce.Day, 0, ""); order.StrategyId = this.Id; order.Text = text; this.Send(order); return order; }
public Order Sell(IExecutionProvider provider, Instrument instrument, OrderType type, double qty, double price, double stopPx, string text = "") { Order order = new Order(provider, this.Portfolio, instrument, type, OrderSide.Sell, qty, price, stopPx, TimeInForce.Day, 0, ""); order.StrategyId = Id; order.Text = text; this.Send(order); return order; }
public ExecutionCommand(ExecutionCommand command) { this.id = command.id; this.providerId = command.providerId; this.portfolioId = command.portfolioId; this.transactTime = command.transactTime; this.dateTime = command.dateTime; this.instrument = command.instrument; this.provider = command.provider; this.portfolio = command.portfolio; this.side = command.side; this.orderType = command.OrdType; this.timeInForce = command.timeInForce; this.price = command.price; this.stopPx = command.stopPx; this.qty = command.qty; this.oCA = command.oCA; this.text = command.text; }
internal ExecutionProvider(IExecutionProvider provider) : base(provider) { this.provider = provider; }
public LimitOrder(IExecutionProvider provider, Portfolio portfolio, Instrument instrument, Side side, double qty, double price) : this(provider, portfolio, instrument, side, qty, price, null) { }
public Order SellStopLimit(IExecutionProvider provider, Instrument instrument, double qty, double stopPx, double price, string text = "") { Order order = new Order(provider, this.Portfolio, instrument, OrderType.StopLimit, OrderSide.Sell, qty, 0.0, 0.0, TimeInForce.Day, 0, ""); order.StrategyId = this.Id; order.Text = text; order.StopPx = stopPx; order.Price = price; this.Send(order); return order; }