Example #1
0
        public static T create <T>(string className, QREBridgeBase bridge, Symbol symbol) where T : SymbolSystem
        {
            var type = Type.GetType(className, true, false);
            var c    = type.GetConstructor(new[] { typeof(QREBridge <T>), typeof(Symbol) });

            Bomb.ifNull(c, () => "no constuctor matching qrebridge of type, symbol on class " + className);
            return((T)c.Invoke(new object[] { bridge, symbol }));
        }
Example #2
0
 public DollarTrailingStop(Position position, Spud <double> close, double stopLoss, string name, QREBridgeBase bridge)
     : base(position, name, STOP, close.manager)
 {
     this.close    = close;
     this.stopLoss = stopLoss;
     this.bridge   = bridge;
     tradePnl      = close.transform(price => position.pnlNoSlippage(price, bridge.arguments().runInNativeCurrency, bridge.fxRate(position.symbol)));
     highWaterMark = dependsOn(new Max(tradePnl));
 }
Example #3
0
        public static S create <S>(string className, bool useMultiSymbol, QREBridgeBase bridge) where S : System
        {
            var type = Type.GetType(className, true, false);

            if (useMultiSymbol && type.IsSubclassOf(typeof(SymbolSystem)))
            {
                type = typeof(IndependentSymbolSystems <>).MakeGenericType(type);
            }
            var c      = type.GetConstructor(new[] { typeof(QREBridge <S>) });
            var system = (S)c.Invoke(new object[] { bridge });

            return(system);
        }
Example #4
0
 protected SymbolSystem(QREBridgeBase bridge, Symbol symbol) : base(bridge, symbol)
 {
     this.symbol = symbol;
     manager     = new SpudManager();
     bars        = new BarSpud(manager);
     base.bars[symbol].pushedDown += () => {
         parentManagerHasPushedDown = true;
     };
     base.bars[symbol].valueSet += newValue => {
         if (parentManagerHasPushedDown)
         {
             manager.newBar();
             parentManagerHasPushedDown = false;
         }
         bars.set(newValue);
     };
     base.bars[symbol].manager.onLive        += () => manager.goLive();
     base.bars[symbol].manager.onRecalculate += () => manager.recalculate();
     base.bars[symbol].ticked += time => bars.lastTickedAt(time);
 }
Example #5
0
 public IndependentPairSystems(QREBridgeBase bridge) : base(bridge)
 {
 }
Example #6
0
 public CustomTradeEmailer(QREBridgeBase bridge, Symbol symbol) : base(bridge, symbol)
 {
 }
Example #7
0
 public StopSystem(QREBridgeBase bridge, Symbol symbol) : base(bridge, symbol)
 {
     bars.low.prepare();
     bars.high.prepare();
 }
Example #8
0
 public IndependentSymbolSystems(QREBridgeBase bridge) : base(bridge)
 {
 }
Example #9
0
 protected PairSystem(QREBridgeBase bridge, Pair pair) : base(bridge, pair)
 {
     this.pair = pair;
 }
Example #10
0
 protected System(QREBridgeBase bridge)
 {
     this.bridge = bridge;
 }
Example #11
0
 public static S create <S>(QREBridgeBase bridge) where S : System
 {
     return(create <S>(bridge.arguments().parameters.systemClassName(), bridge));
 }
Example #12
0
 public static S create <S> (string className, QREBridgeBase bridge) where S : System
 {
     return(create <S>(className, true, bridge));
 }
Example #13
0
 protected MultiSystem(QREBridgeBase bridge) : base(bridge)
 {
 }