コード例 #1
0
 public BacktestInstrumentServer(Framework framework, string path, bool save, bool useFileName)
     : base(framework)
 {
     Path = path;
     Save = save;
     UseFileName = useFileName;
 }
コード例 #2
0
ファイル: OrderManager.cs プロジェクト: ForTrade/CSharp
 public OrderManager(Framework framework)
 {
     this.framework = framework;
     this.orders = new List<Order>();
     this.oCAGroups = new Dictionary<string, List<Order>>();
     this.next_id = 0;
 }
コード例 #3
0
ファイル: ProviderManager.cs プロジェクト: ForTrade/CSharp
 public ProviderManager(Framework framework, IDataSimulator dataSimulator = null, IExecutionSimulator executionSimulator = null)
 {
     this.framework = framework;
     this.providers = new ProviderList();
     this.settings = new ProviderManagerSettings();
     this.LoadSettings();
     if (dataSimulator == null)
     {
         this.dataSimulator = new DataSimulator(framework);
     }
     else
     {
         this.dataSimulator = dataSimulator;
     }
     this.AddProvider(this.dataSimulator);
     if (executionSimulator == null)
     {
         this.executionSimulator = new ExecutionSimulator(framework);
     }
     else
     {
         this.executionSimulator = executionSimulator;
     }
     this.AddProvider(this.executionSimulator);
 }
コード例 #4
0
ファイル: MetaStrategy.cs プロジェクト: ForTrade/CSharp
		public MetaStrategy(Framework framework, string name) : base(framework, name)
		{
			this.strategiesByInstrument = new IdArray<List<Strategy>>(1000);
			this.strategyById = new IdArray<Strategy>(1000);
			this.strategyByPortfolioId = new IdArray<Strategy>(1000);
			this.strategies = new List<Strategy>();
		}
コード例 #5
0
ファイル: FrameworkControl.cs プロジェクト: 28427328/SQCharts
 public void Init(Framework framework, ControlSettings settings, object[] args)
 {
     this.framework = framework;
     this.settings = settings;
     this.args = args;
     OnInit();
 }
コード例 #6
0
ファイル: MainForm.cs プロジェクト: 28427328/SQCharts
        public MainForm()
        {
            InitComponent();
            var f = new Framework("Demo", true);
            f.IsDisposable = false;
            f.GroupDispatcher = new GroupDispatcher(f);
            this.barChart.Init(f, null, null);
            this.barChart2.Init(f, null, null);
            this.barChart.ResumeUpdates();
            this.barChart2.ResumeUpdates();

            this.timer = new System.Windows.Forms.Timer();
            this.timer.Interval = 500;
            this.timer.Tick += new EventHandler((sender, e) =>
            {
                try
                {
                    this.timer.Stop();
                    barChart.UpdateGUI();
                    barChart2.UpdateGUI();
                    this.timer.Interval = 500;
                    this.timer.Enabled = true;
                }
                catch (Exception)
                {
                }
            });
            this.timer.Start();
        }
コード例 #7
0
ファイル: TTFIX.cs プロジェクト: javagg/Junction
 public TTFIX(Framework framework)
     : base(framework, (QuickFIXApplication)new TTFIXApplication ())
 {
     this.id = 10;
     this.name = "TT FIX";
     this.description = "Trading Technologies FIX Adapter";
     this.url = "www.tradingtechnologies.com";
 }
コード例 #8
0
ファイル: EventBus.cs プロジェクト: ForTrade/CSharp
		public EventBus(Framework framework, EventBusMode mode = EventBusMode.Realtime)
		{
			this.framework = framework;
			this.mode = mode;
			this.dataPipe = new EventPipe(framework, true);
			this.executionPipe = new EventPipe(framework, false);
			this.servicePipe = new EventPipe(framework, false);
		}
コード例 #9
0
		public FileInstrumentServer(Framework framework, string fileName, string host = null) : base(framework)
		{
			if (host == null)
			{
				this.file = new DataFile(fileName, framework.streamerManager);
				return;
			}
			this.file = new NetDataFile(fileName, host, framework.streamerManager);
		}
コード例 #10
0
 public SellSideInstrumentStrategy(Framework framework, string name)
     : base(framework, name)
 {
     this.raiseEvents = false;
     this.strategyByInstrument = new IdArray<List<SellSideInstrumentStrategy>>(1000);
     this.strategyByPortfolio = new IdArray<SellSideInstrumentStrategy>(1000);
     this.strategyBySynthInstrument = new IdArray<SellSideInstrumentStrategy>(1000);
     this.strategies = new List<Strategy>();
 }
コード例 #11
0
ファイル: DataSimulator.cs プロジェクト: ForTrade/CSharp
		public DataSimulator(Framework framework) : base(framework)
		{
			this.id = 1;
			this.name = "DataSimulator";
			this.description = "Default data simulator";
			this.url = "www.smartquant.com";
			this.dateTime1 = DateTime.MinValue;
			this.dateTime2 = DateTime.MaxValue;
		}
コード例 #12
0
 public OrderMap(Framework framework, SingleProvider provider)
     : base(framework, provider)
 {
     externalOrders = new ConcurrentDictionary<string, ExternalOrderRecord>();
     pendingOrders = new ConcurrentDictionary<string, OrderRecord>();
     workingOrders = new Dictionary<string, OrderRecord>();
     orderIDs = new Dictionary<int, string>();
     pendingCancels = new ConcurrentDictionary<string, OrderRecord>();
 }
コード例 #13
0
ファイル: DataManager.cs プロジェクト: ForTrade/CSharp
		public DataManager(Framework framework, DataServer server)
		{
			this.framework = framework;
			this.server = server;
			if (server != null)
			{
				server.Open();
			}
		}
コード例 #14
0
ファイル: GroupDispatcher.cs プロジェクト: ForTrade/CSharp
		public GroupDispatcher(Framework framework)
		{
			this.framework = framework;
			this.listeners = new List<IGroupListener>();
			this.listenerTable = new IdArray<List<IGroupListener>>(1000);
			this.groupByListenerTable = new Dictionary<IGroupListener, List<int>>();
			framework.eventManager.Dispatcher.NewGroup += new GroupEventHandler(this.Dispatcher_NewGroup);
			framework.eventManager.Dispatcher.NewGroupEvent += new GroupEventEventHandler(this.Dispatcher_NewGroupEvent);
			framework.eventManager.Dispatcher.NewGroupUpdate += new GroupUpdateEventHandler(this.Dispatcher_NewGroupUpdate);
			framework.EventManager.Dispatcher.FrameworkCleared += new FrameworkEventHandler(this.Dispatcher_FrameworkCleared);
		}
コード例 #15
0
ファイル: EventDispatcher.cs プロジェクト: ForTrade/CSharp
		public EventDispatcher(Framework framework)
		{
			this.framework = framework;
			if (this.queue != null)
			{
				this.thread = new Thread(new ThreadStart(this.ThreadRun));
				this.thread.IsBackground = true;
				this.thread.Name = "Event Dispatcher Thread";
				this.thread.Start();
			}
		}
コード例 #16
0
ファイル: MainForm.cs プロジェクト: fastquant/fastquant.dll
        public MainForm()
        {
            InitComponent();
            SuspendLayout();
 
            this.orderManager = new SmartQuant.Controls.Orders.OrderManagerWindow();
            this.orderManager.Dock = DockStyle.Fill;
            this.orderManager.Name = "OrderManager";


            TabPage tpage = null;
            tpage = new TabPage();
            tpage.Controls.Add(this.orderManager);
            tpage.Name = this.orderManager.Name;
            tpage.Text = this.orderManager.Name;
            this.tabControl1.Controls.Add(tpage);


            ResumeLayout();

            var f = new Framework("Demo");
            f.IsDisposable = false;
            f.GroupDispatcher = new GroupDispatcher(f);
            this.dataLoader = new DataLoader(f);

            this.barChart.Init(f, null, null);
            this.barChart.ResumeUpdates();

            this.barChart2.Init(f, null, null);
            this.barChart2.ResumeUpdates();

            this.orderManager.Init(this.dataLoader.OrderManagerQueue, true);

            this.timer = new System.Windows.Forms.Timer();
            this.timer.Interval = 500;
            this.timer.Tick += (sender, e) =>
            {
                try
                {
                    this.timer.Stop();
                    this.barChart.UpdateGUI();
                    this.barChart2.UpdateGUI();
                    this.orderManager.UpdateGUI();

                    this.timer.Interval = 500;
                    this.timer.Enabled = true;
                }
                catch (Exception)
                {
                }
            };
            this.timer.Start();
        }
コード例 #17
0
ファイル: Portfolio.cs プロジェクト: ForTrade/CSharp
 public Portfolio(Framework framework, string name = "")
 {
     this.framework = framework;
     this.name = name;
     this.account = new Account(framework);
     this.fills = new FillSeries(name);
     this.positions = new List<Position>();
     this.positionByInstrument = new IdArray<Position>(1000);
     this.pricer = framework.portfolioManager.pricer;
     this.performance = new PortfolioPerformance(this);
     this.statistics = new PortfolioStatistics(this);
 }
コード例 #18
0
ファイル: MLProvider.cs プロジェクト: kandsy/DemoDock
        public MLProvider(Framework framework)
            : base(framework)
        {
            // 不能与已有的重复
            base.id = 55;

            base.name = "MenuLoader";
            base.description = "QuantBox Menu Loader";
            base.url = "www.quantbox.cn";

            _menuPath = Path.Combine(Installation.ConfigDir.FullName, "menu.json");

            menuLoader.LoadConfig(_menuPath);
            menuLoader.LoadOnce();
        }
コード例 #19
0
        public ProviderHost(Framework framework)
            : base(framework)
        {
            Init(100, "API Host");

            ConfigPath = Path.Combine(Installation.ConfigDir.FullName, "API_Host.json");
            ProviderList = new BindingList<ProviderItem>();

            Load(ConfigPath);
            if (ProviderList == null)
                ProviderList = new BindingList<ProviderItem>();

            string applicationDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            Create(ProviderList);

            ProviderList.ListChanged += ProviderList_ListChanged;
        }
コード例 #20
0
ファイル: InstrumentManager.cs プロジェクト: ForTrade/CSharp
		public InstrumentManager(Framework framework, InstrumentServer server)
		{
			this.framework = framework;
			this.server = server;
			this.server.Open();
			this.next_id = -1;
			this.instruments = server.Load();
			for (int i = 0; i < this.instruments.Count; i++)
			{
				this.instruments.GetByIndex(i).isPersistent = true;
				int id = this.instruments.GetByIndex(i).Id;
				if (id > this.next_id)
				{
					this.next_id = id;
				}
			}
			this.next_id++;
		}
コード例 #21
0
ファイル: Program.cs プロジェクト: 28427328/SQCharts
        public MainWindow()
            : base(WindowType.Toplevel)
        {
            this.barChart = new SmartQuant.Controls.BarChart.BarChart();
            this.barChart2 = new SmartQuant.Controls.BarChart.BarChart2();
            this.chart3 = new SmartQuant.FinChart.Chart();
            this.chart3.ActionType = ChartActionType.Cross;
            var nb = new Notebook();
            nb.Add(barChart);
            nb.SetTabLabelText(barChart, "Chart");
            nb.Add(barChart2);
            nb.SetTabLabelText(barChart2, "Chart(Gapless)");
            nb.Add(chart3);
            nb.SetTabLabelText(chart3, "Performance");
            Add(nb);
            SetDefaultSize(624, 362);

            DeleteEvent += (sender, e) =>
            {
                Application.Quit();
                e.RetVal = true;
            };

            var f = new Framework("Demo", true);
            f.IsDisposable = false;
            f.GroupDispatcher = new GroupDispatcher(f);
            this.barChart.Init(f, null, null);
            this.barChart2.Init(f, null, null);
            this.barChart.ResumeUpdates();
            this.barChart2.ResumeUpdates();

            GLib.Timeout.Add(500, new TimeoutHandler(delegate
            {
                barChart.UpdateGUI();
                barChart2.UpdateGUI();
                return true;
            }));

            // Until the framework is created, We cannot show them
            ShowAll();
        }
コード例 #22
0
ファイル: Strategy.cs プロジェクト: ForTrade/CSharp
 public Strategy(Framework framework, string name)
 {
     this.framework = framework;
     this.Name = name;
     this.strategiesByInstrument = new IdArray<LinkedList<Strategy>>(1000);
     this.strategyByOrderId = new IdArray<Strategy>(1000);
     this.strategies = new LinkedList<Strategy>();
     this.status = StrategyStatus.Stopped;
     this.instruments = new InstrumentList();
     this.instrumentCountTable = new IdArray<int>(1000);
     if (framework != null)
     {
         this.portfolio = new Portfolio(framework, this.Name);
         framework.PortfolioManager.Add(this.portfolio);
     }
     this.bars = new BarSeries("", "");
     this.equity = new TimeSeries();
     this.bids = new TickSeries("");
     this.asks = new TickSeries("");
     this.stops = new List<Stop>();
     this.stopsByInstrument = new IdArray<List<Stop>>(1000);
 }
コード例 #23
0
ファイル: Pricer.cs プロジェクト: ForTrade/CSharp
 public Pricer(Framework framework)
 {
     this.framework = framework;
 }
コード例 #24
0
ファイル: CurrencyConverter.cs プロジェクト: ForTrade/CSharp
		public CurrencyConverter(Framework framework)
		{
			this.framework = framework;
		}
コード例 #25
0
ファイル: Pricer.cs プロジェクト: ForTrade/CSharp
 public Pricer(Framework framework)
 {
     this.framework = framework;
 }
コード例 #26
0
ファイル: Provider.cs プロジェクト: zjtan1992/SmartQuant.dll
 public Provider(Framework framework)
 {
     this.framework = framework;
 }
コード例 #27
0
 public FrameworkEventArgs(Framework framework)
 {
     this.Framework = framework;
 }
コード例 #28
0
ファイル: DataImport.cs プロジェクト: ForTrade/CSharp
		public DataImport(Framework framework)
		{
			this.framework = framework;
		}
コード例 #29
0
ファイル: SellSideStrategy.cs プロジェクト: ForTrade/CSharp
 public SellSideStrategy(Framework framework, string name) : base(framework, name)
 {
 }
コード例 #30
0
ファイル: Scenario.cs プロジェクト: ForTrade/CSharp
 public Scenario(Framework framework)
 {
     this.framework = framework;
 }
コード例 #31
0
ファイル: ExecutionSimulator.cs プロジェクト: ForTrade/CSharp
		public ExecutionSimulator(Framework framework) : base(framework)
		{
			this.id = 2;
			this.name = "ExecutionSimulator";
			this.description = "Default execution simulator";
			this.url = "www.smartquant.com";
			this.fillOnQuote = true;
			this.fillOnTrade = true;
			this.fillOnBar = false;
			this.fillMarketOnNext = false;
			this.fillLimitOnNext = false;
			this.fillStopOnNext = false;
			this.fillStopLimitOnNext = false;
			this.fillAtLimitPrice = true;
			this.orders = new IdArray<List<Order>>(1000);
		}
コード例 #32
0
ファイル: DataFilter.cs プロジェクト: ForTrade/CSharp
 public DataFilter(Framework framework)
 {
     this.framework = framework;
 }
コード例 #33
0
 public PerformanceStrategy(Framework framework) : base(framework, "PerformanceStrategy")
 {
 }
コード例 #34
0
 public DataServer(Framework framework)
 {
     this.framework = framework;
     this.tapeMode  = false;
 }
コード例 #35
0
ファイル: PortfolioManager.cs プロジェクト: ForTrade/CSharp
 public PortfolioManager(Framework framework)
 {
     this.framework = framework;
     this.pricer    = new Pricer(framework);
 }
コード例 #36
0
 public Clock(Framework framework, ClockMode mode = ClockMode.Simulation, bool isStandalone = false)
 {
     this.Mode = mode;
     throw new System.NotImplementedException();
 }
コード例 #37
0
ファイル: Framework.cs プロジェクト: ForTrade/CSharp
		public Framework(string name = "", bool createServers = true)
		{
			this.name = name;
			this.LoadConfiguration();
			this.eventBus = new EventBus(this, EventBusMode.Realtime);
			this.clock = new Clock(this, ClockMode.Realtime, false);
			this.eventBus.reminderQueue = this.clock.reminderQueue;
			this.eventServer = new EventServer(this, this.eventBus);
			this.eventManager = new EventManager(this, this.eventBus);
			this.streamerManager = new StreamerManager();
			this.streamerManager.Add(new DataObjectStreamer());
			this.streamerManager.Add(new InstrumentStreamer());
			this.streamerManager.Add(new BidStreamer());
			this.streamerManager.Add(new AskStreamer());
			this.streamerManager.Add(new QuoteStreamer());
			this.streamerManager.Add(new TradeStreamer());
			this.streamerManager.Add(new BarStreamer());
			this.streamerManager.Add(new Level2SnapshotStreamer());
			this.streamerManager.Add(new Level2UpdateStreamer());
			this.streamerManager.Add(new NewsStreamer());
			this.streamerManager.Add(new FundamentalStreamer());
			this.streamerManager.Add(new DataSeriesStreamer());
			if (createServers)
			{
				if (this.configuration.IsInstrumentFileLocal)
				{
					this.instrumentServer = new FileInstrumentServer(this, this.configuration.InstrumentFileName, null);
				}
				else
				{
					this.instrumentServer = new FileInstrumentServer(this, "instruments.quant", this.configuration.InstrumentFileHost);
				}
				this.instrumentManager = new InstrumentManager(this, this.InstrumentServer);
				if (this.configuration.IsDataFileLocal)
				{
					this.dataServer = new FileDataServer(this, this.configuration.DataFileName, null);
				}
				else
				{
					this.dataServer = new FileDataServer(this, "data.quant", this.configuration.DataFileHost);
				}
				this.dataManager = new DataManager(this, this.dataServer);
			}
			this.providerManager = new ProviderManager(this, null, new ExecutionSimulator(this));
			this.eventLoggerManager = new EventLoggerManager();
			this.subscriptionManager = new SubscriptionManager(this);
			this.orderManager = new OrderManager(this);
			this.portfolioManager = new PortfolioManager(this);
			this.strategyManager = new StrategyManager(this);
			this.groupManager = new GroupManager(this);
			this.accountDataManager = new AccountDataManager(this);
			this.currencyConverter = new CurrencyConverter(this);
			this.dataFileManager = new DataFileManager(Installation.DataDir.FullName);
			if (Framework.currentFramework == null)
			{
				Framework.currentFramework = this;
			}
		}
コード例 #38
0
ファイル: Framework.cs プロジェクト: ForTrade/CSharp
		public Framework(string name, EventBus externalBus, InstrumentServer instrumentServer, DataServer dataServer = null)
		{
			this.isExternalDataQueue = true;
			this.name = name;
			this.LoadConfiguration();
			this.clock = new Clock(this, ClockMode.Realtime, false);
			this.eventBus = new EventBus(this, EventBusMode.Realtime);
			this.eventBus.reminderQueue = this.clock.reminderQueue;
			externalBus.Attach(this.eventBus);
			this.eventServer = new EventServer(this, this.eventBus);
			this.eventManager = new EventManager(this, this.eventBus);
			this.streamerManager = new StreamerManager();
			this.streamerManager.Add(new DataObjectStreamer());
			this.streamerManager.Add(new InstrumentStreamer());
			this.streamerManager.Add(new BidStreamer());
			this.streamerManager.Add(new AskStreamer());
			this.streamerManager.Add(new QuoteStreamer());
			this.streamerManager.Add(new TradeStreamer());
			this.streamerManager.Add(new BarStreamer());
			this.streamerManager.Add(new Level2SnapshotStreamer());
			this.streamerManager.Add(new Level2UpdateStreamer());
			this.streamerManager.Add(new NewsStreamer());
			this.streamerManager.Add(new FundamentalStreamer());
			this.streamerManager.Add(new DataSeriesStreamer());
			this.instrumentServer = instrumentServer;
			this.instrumentManager = new InstrumentManager(this, instrumentServer);
			this.dataServer = dataServer;
			this.dataManager = new DataManager(this, dataServer);
			this.providerManager = new ProviderManager(this, null, new ExecutionSimulator(this));
			this.eventLoggerManager = new EventLoggerManager();
			this.orderManager = new OrderManager(this);
			this.portfolioManager = new PortfolioManager(this);
			this.strategyManager = new StrategyManager(this);
			this.groupManager = new GroupManager(this);
			this.currencyConverter = new CurrencyConverter(this);
			this.dataFileManager = new DataFileManager(Installation.DataDir.FullName);
			if (Framework.currentFramework == null)
			{
				Framework.currentFramework = this;
			}
		}
コード例 #39
0
ファイル: EventManager.cs プロジェクト: ForTrade/CSharp
		public EventManager(Framework framework, EventBus bus)
		{
			this.framework = framework;
			this.bus = bus;
			this.factory = new BarFactory(framework);
			this.dispatcher = new EventDispatcher(framework);
			this.handler[107] = new EventManager.OnEventHandler(this.OnSimulatorStart);
			this.handler[108] = new EventManager.OnEventHandler(this.OnSimulatorStop);
			this.handler[109] = new EventManager.OnEventHandler(this.OnSimulatorProgress);
			this.handler[2] = new EventManager.OnEventHandler(this.OnBid);
			this.handler[3] = new EventManager.OnEventHandler(this.OnAsk);
			this.handler[4] = new EventManager.OnEventHandler(this.OnTrade);
			this.handler[6] = new EventManager.OnEventHandler(this.OnBar);
			this.handler[8] = new EventManager.OnEventHandler(this.OnLevel2Snapshot);
			this.handler[9] = new EventManager.OnEventHandler(this.OnLevel2Update);
			this.handler[23] = new EventManager.OnEventHandler(this.OnNews);
			this.handler[22] = new EventManager.OnEventHandler(this.OnFundamental);
			this.handler[13] = new EventManager.OnEventHandler(this.OnExecutionReport);
			this.handler[116] = new EventManager.OnEventHandler(this.OnOrderStatusChanged);
			this.handler[117] = new EventManager.OnEventHandler(this.OnOrderPartiallyFilled);
			this.handler[118] = new EventManager.OnEventHandler(this.OnOrderFilled);
			this.handler[119] = new EventManager.OnEventHandler(this.OnOrderReplaced);
			this.handler[120] = new EventManager.OnEventHandler(this.OnOrderCancelled);
			this.handler[121] = new EventManager.OnEventHandler(this.OnOrderDone);
			this.handler[113] = new EventManager.OnEventHandler(this.OnFill);
			this.handler[110] = new EventManager.OnEventHandler(this.OnPositionOpened);
			this.handler[111] = new EventManager.OnEventHandler(this.OnPositionClosed);
			this.handler[112] = new EventManager.OnEventHandler(this.OnPositionChanged);
			this.handler[15] = new EventManager.OnEventHandler(this.OnReminder);
			this.handler[50] = new EventManager.OnEventHandler(this.OnGroup);
			this.handler[52] = new EventManager.OnEventHandler(this.OnGroupEvent);
			this.handler[130] = new EventManager.OnEventHandler(this.OnHistoricalData);
			this.handler[131] = new EventManager.OnEventHandler(this.OnHistoricalDataEnd);
			this.handler[140] = new EventManager.OnEventHandler(this.OnAccountData);
			if (bus != null)
			{
				this.thread = new Thread(new ThreadStart(this.ThreadRun));
				this.thread.Name = "Event Manager Thread";
				this.thread.IsBackground = true;
				this.thread.Start();
			}
		}
 public SubscriptionManager(Framework framework)
 {
     this.framework     = framework;
     this.subscriptions = new Dictionary <int, Dictionary <Instrument, int> >();
 }