public void Setup() { this.signalQueue = new ObservableQueue <Signal>(); this.tradingData = new TradingDataContext(); this.lLeg = new List <StrategyHeader>(); this.rLeg = new List <StrategyHeader>(); this.lStrategy = new StrategyHeader(1, "Left leg strategyHeader", "BP12345-RF-01", "SBRF-3.14_FT", 10); this.tradingData.Get <ICollection <StrategyHeader> >().Add(lStrategy); this.lLeg.Add(this.lStrategy); this.rStrategy = new StrategyHeader(2, "Right leg strategyHeader", "BP12345-RF-01", "SBPR-3.13_FT", 11); this.tradingData.Get <ICollection <StrategyHeader> >().Add(rStrategy); this.rLeg.Add(this.rStrategy); this.arbitrageSettings = new ArbitrageSettings(1, this.lLeg, this.rLeg, new SpreadSettings(1.12, 1.25, 1.01)); this.tradingData.Get <ICollection <ArbitrageSettings> >().Add(this.arbitrageSettings); this.lStrategyVolumeChangeStep = new StrategyVolumeChangeStep(this.lStrategy, 2); this.tradingData.Get <ICollection <StrategyVolumeChangeStep> >().Add(this.lStrategyVolumeChangeStep); ArbitrageOpenPositionOnSpreadValue handler = new ArbitrageOpenPositionOnSpreadValue(this.arbitrageSettings, this.lStrategy, this.tradingData, this.signalQueue, new NullLogger()); }
private Signal MakeSignal(SpreadValue item, TradeAction action) { StrategyVolumeChangeStep strategyVolumeChangeStep = GetStrategyVolumeChangeStep(this.strategyHeader); Signal signal = new Signal(strategyHeader, BrokerDateTime.Make(DateTime.Now), action, OrderType.Market, arbitrageSetings.SpreadSettings.FairPrice, 0, 0); if (strategyVolumeChangeStep != null) { signal.Amount = GetAmount(strategyVolumeChangeStep.Amount); } return(signal); }
public void StrategyVolumeChangeStep_constructor_test() { double stepValue = 10; StrategyHeader strategyHeader = new StrategyHeader(1, "Strategy", "BP12345-RF-01", "SBRF-3.14_FT", 100); StrategyVolumeChangeStep step = new StrategyVolumeChangeStep(strategyHeader, stepValue); Assert.AreEqual(stepValue, step.Amount); Assert.AreEqual(strategyHeader.Id, step.Id); Assert.AreEqual(strategyHeader.Id, step.StrategyId); Assert.AreEqual(strategyHeader, step.Strategy); }