예제 #1
0
파일: Portfolio.cs 프로젝트: heber/FreeOQ
 internal Portfolio(FreeQuant.Instruments.Portfolio portfolio)
 {
   this.portfolio = portfolio;
   this.positions = new PositionList(portfolio.Positions);
   this.transactions = new TransactionList(portfolio.Transactions);
   this.account = new PortfolioAccount(portfolio.Account);
 }
예제 #2
0
		internal BrokerPositionFieldList(FreeQuant.Providers.BrokerPositionField[] fields)
		{
			this.fields = fields;
			this.table = new Dictionary<string, FreeQuant.Providers.BrokerPositionField>();
			foreach (FreeQuant.Providers.BrokerPositionField brokerPositionField in fields)
				this.table.Add(brokerPositionField.Name, brokerPositionField);
		}
예제 #3
0
 public FreeQuant.Data.Bar FilterBarOpen(FreeQuant.Data.Bar bar, string symbol)
 {
   Bar bar1 = this.oqFilter.FilterBarOpen(new Bar(bar), symbol);
   if (bar1 != null)
     return bar1.bar;
   else
     return (FreeQuant.Data.Bar) null;
 }
예제 #4
0
 public FreeQuant.Data.Trade FilterTrade(FreeQuant.Data.Trade trade, string symbol)
 {
   Trade trade1 = this.oqFilter.FilterTrade(new Trade(trade), symbol);
   if (trade1 == null)
     return (FreeQuant.Data.Trade) null;
   else
     return trade1.trade;
 }
예제 #5
0
 public FreeQuant.Data.Quote FilterQuote(FreeQuant.Data.Quote quote, string symbol)
 {
   Quote quote1 = this.oqFilter.FilterQuote(new Quote(quote), symbol);
   if (quote1 == null)
     return (FreeQuant.Data.Quote) null;
   else
     return quote1.quote;
 }
예제 #6
0
		public override double Convert(double amount, FreeQuant.Instruments.Currency fromCurrency, FreeQuant.Instruments.Currency toCurrency)
		{
			if (fromCurrency == toCurrency)
				return amount;
			Instrument instrument1 = InstrumentManager.Instruments[fromCurrency.Code + "_" + toCurrency.Code];
			if (instrument1 != null)
				return amount * this.GetAmount(instrument1, amount);
			Instrument instrument2 = InstrumentManager.Instruments[toCurrency.Code + "_" + fromCurrency.Code];
			if (instrument2 == null)
				return amount;
			else
				return amount / this.GetAmount(instrument2, amount);
		}
예제 #7
0
		internal BrokerAccountFieldList(FreeQuant.Providers.BrokerAccountField[] fields)
		{
			this.fields = fields;
			this.table = new Dictionary<string, Dictionary<string, FreeQuant.Providers.BrokerAccountField>>();
			foreach (FreeQuant.Providers.BrokerAccountField brokerAccountField in fields)
			{
				Dictionary<string, FreeQuant.Providers.BrokerAccountField> dictionary;
				if (!this.table.TryGetValue(brokerAccountField.Name, out dictionary))
				{
					dictionary = new Dictionary<string, FreeQuant.Providers.BrokerAccountField>();
					this.table.Add(brokerAccountField.Name, dictionary);
				}
				dictionary.Add(brokerAccountField.Currency, brokerAccountField);
			}
		}
예제 #8
0
파일: OpenQuant.cs 프로젝트: heber/FreeOQ
		private static void AddPortfolio(FreeQuant.Instruments.Portfolio sq_portfolio)
		{
			Portfolio portfolio = new Portfolio(sq_portfolio);
			Map.OQ_FQ_Portfolio[portfolio] = sq_portfolio;
			Map.FQ_OQ_Portfolio[sq_portfolio] = portfolio;
		}
예제 #9
0
파일: OpenQuant.cs 프로젝트: heber/FreeOQ
//		private static void SQ_OrderManager_OrderListUpdated(object sender, EventArgs e)
//		{
//			OpenQuant.orders.Clear();
//			Map.OQ_FQ_Order.Clear();
//			Map.FQ_OQ_Order.Clear();
//			foreach (SingleOrder order1 in (FIXGroupList) ((InstrumentOrderListTable) OrderManager.Orders).All)
//			{
//				Order order2 = new Order(order1);
//				OpenQuant.orders.Add(order2);
//				Map.OQ_FQ_Order[order2] = order1;
//				Map.FQ_OQ_Order[order1] = order2;
//			}
//		}

        private static void AddInstrument(FreeQuant.Instruments.Instrument fq_instrument)
		{
			Instrument instrument = new Instrument(fq_instrument);
			OpenQuant.instruments.Add(fq_instrument.Symbol, instrument);
			Map.OQ_FQ_Instrument[instrument] = fq_instrument;
			Map.FQ_OQ_Instrument[fq_instrument] = instrument;
		}
예제 #10
0
		internal void cXaFP441d(double obj0, FreeQuant.Instruments.Currency obj1, DateTime obj2, string obj3)
    {
      this.portfolio.Account.Deposit(obj0, obj1, obj2, obj3);
      foreach (Portfolio portfolio in this.portfolios.Values)
        portfolio.Account.Deposit(obj0, obj1, obj2, obj3);
    }
예제 #11
0
 public double Price(FreeQuant.Instruments.Position position)
 {
   return this.pricer.Price(new Position(position));
 }
예제 #12
0
파일: BrokerOrder.cs 프로젝트: heber/FreeOQ
		internal BrokerOrder(FreeQuant.Providers.BrokerOrder brokerOrder)
		{
			this.brokerOrder = brokerOrder;
		}
예제 #13
0
		internal BrokerAccount(FreeQuant.Providers.BrokerAccount brokerAccount)
		{
			this.brokerAccount = brokerAccount;
		}
예제 #14
0
		internal TransactionList(FreeQuant.Instruments.TransactionList transactionList)
		{
			this.transactionList = transactionList;
		}
예제 #15
0
		internal BrokerOrderField(FreeQuant.Providers.BrokerOrderField field)
		{
			this.field = field;
		}
예제 #16
0
		internal static StopStatus Convert(FreeQuant.Trading.StopStatus stopStatus)
		{
			switch (stopStatus)
			{
				case FreeQuant.Trading.StopStatus.Active:
					return StopStatus.Active;
				case FreeQuant.Trading.StopStatus.Executed:
					return StopStatus.Executed;
				case FreeQuant.Trading.StopStatus.Canceled:
					return StopStatus.Canceled;
				default:
					throw new NotImplementedException("Stop status is not supported : " + (object)stopStatus);
			}
		}
예제 #17
0
		internal static IndicatorStyle Convert(FreeQuant.Indicators.EIndicatorStyle indicatorStyle)
		{
			switch (indicatorStyle)
			{
				case FreeQuant.Indicators.EIndicatorStyle.SmartQuant:
					return IndicatorStyle.SmartQuant;
				case FreeQuant.Indicators.EIndicatorStyle.MetaStock:
					return IndicatorStyle.MetaStock;
				case FreeQuant.Indicators.EIndicatorStyle.FreeQuant:
					return IndicatorStyle.FreeQuant;
				case FreeQuant.Indicators.EIndicatorStyle.QuantStudio:
					return IndicatorStyle.QuantStudio;
				default:
					throw new NotImplementedException("Indicator style is not supported: " + indicatorStyle);
			}
		}
예제 #18
0
		public void EmitMarketDepth(FreeQuant.Data.MarketDepth depth, Instrument instrument)
		{
			if (this.WiB4iTUE4w == null)
				return;
			this.WiB4iTUE4w((object)this, new MarketDepthEventArgs(depth, (IFIXInstrument)instrument, (IMarketDataProvider)this));
		}
예제 #19
0
파일: Quote.cs 프로젝트: heber/FreeOQ
 internal Quote(FreeQuant.Data.Quote quote)
 {
   this.quote = quote;
 }
예제 #20
0
 internal OrderBookEntry(FreeQuant.Data.OrderBookEntry entry)
 {
   this.entry = entry;
 }
예제 #21
0
파일: Bar.cs 프로젝트: heber/FreeOQ
		internal Bar(FreeQuant.Data.Bar bar)
		{
			this.bar = bar;
		}
예제 #22
0
 internal ProviderError(FreeQuant.Providers.ProviderError error)
 {
   this.error = error;
 }
예제 #23
0
 internal PositionList(FreeQuant.Instruments.PositionList positionList)
 {
   this.positionList = positionList;
 }
예제 #24
0
		internal static BarType Convert(FreeQuant.Data.BarType barType)
		{
			switch (barType)
			{
				case FreeQuant.Data.BarType.Time:
					return BarType.Time;
				case FreeQuant.Data.BarType.Tick:
					return BarType.Tick;
				case FreeQuant.Data.BarType.Volume:
					return BarType.Volume;
				case FreeQuant.Data.BarType.Range:
					return BarType.Range;
				default:
					throw new ArgumentException(string.Format("Unsupported BarType - {0}", barType));
			}
		}
예제 #25
0
 internal void qZcLyn7Uf(double obj0, FreeQuant.Instruments.Currency obj1, DateTime obj2, string obj3)
 {
   this.portfolio.Account.Withdraw(obj0, obj1, obj2, obj3);
   foreach (Portfolio portfolio in this.portfolios.Values)
     portfolio.Account.Withdraw(obj0, obj1, obj2, obj3);
 }
예제 #26
0
		internal static RegressionDistanceMode Convert(FreeQuant.Indicators.RegressionDistanceMode mode)
		{
			switch (mode)
			{
				case FreeQuant.Indicators.RegressionDistanceMode.Time:
					return RegressionDistanceMode.Time;
				case FreeQuant.Indicators.RegressionDistanceMode.Index:
					return RegressionDistanceMode.Index;
				default:
					throw new NotImplementedException("RegressionDistanceMode is not supported : " + (object)mode);
			}
		}
예제 #27
0
파일: OpenQuant.cs 프로젝트: heber/FreeOQ
        private static void RemoveInstrument(FreeQuant.Instruments.Instrument fq_instrument)
		{
			OpenQuant.instruments.Remove(fq_instrument.Symbol);
			Instrument instrument = Map.FQ_OQ_Instrument[fq_instrument] as Instrument;
			Map.OQ_FQ_Instrument.Remove(instrument);
			Map.FQ_OQ_Instrument.Remove(fq_instrument);
		}
예제 #28
0
		internal static StopType Convert(FreeQuant.Trading.StopType stopType)
		{
			switch (stopType)
			{
				case FreeQuant.Trading.StopType.Fixed:
					return StopType.Fixed;
				case FreeQuant.Trading.StopType.Trailing:
					return StopType.Trailing;
				case FreeQuant.Trading.StopType.Time:
					return StopType.Time;
				default:
					throw new NotImplementedException("Stop type is not supported : " + (object)stopType);
			}
		}
예제 #29
0
		internal BarSeriesEnumerator(FreeQuant.Series.BarSeries series)
		{
			this.series = series;
			this.enumerator = series.GetEnumerator();
		}
예제 #30
0
		internal static StopMode Convert(FreeQuant.Trading.StopMode stopMode)
		{
			switch (stopMode)
			{
				case FreeQuant.Trading.StopMode.Absolute:
					return StopMode.Absolute;
				case FreeQuant.Trading.StopMode.Percent:
					return StopMode.Percent;
				default:
					throw new NotImplementedException("Stop mode is not supported : " + (object)stopMode);
			}
		}