예제 #1
0
        bool isRightTime(string symbol, DateTime datetime)
        {
            int nDatetime = datetime.Hour * 100 + datetime.Minute;

            TimeHelper th;
            if(!TimeHelpers.TryGetValue(symbol,out th))
            {
                th = new TimeHelper(symbol);
                TimeHelpers[symbol] = th;
            }

            return th.IsTradingTime(datetime);
        }
예제 #2
0
        public override void OnStrategyStart()
        {
            TimeHelper = new TimeHelper(EnumTradingTime.COMMODITY);
            PriceHelper = new PriceHelper(Instrument.TickSize);

            TargetOrderBook = new OrderBook_BothSide_Size();

            DualPosition = new DualPosition();
            DualPosition.Sell.PriceHelper = PriceHelper;
            DualPosition.Buy.PriceHelper = PriceHelper;

            // 测试代码
            //TargetPosition = 3;
            DualPosition.Long.Qty = 0;
            DualPosition.Short.Qty = 0;
        }
예제 #3
0
        public override void OnStrategyStart()
        {
            timeHelper = new TimeHelper(EnumTradingTime.COMMODITY);
            priceHelper = new PriceHelper(Instrument.TickSize);

            dualPosition = new DualPosition();

            // 测试代码
            TargetPosition = 3;
            dualPosition.Long.Qty = 0;
            dualPosition.Short.Qty = 0;
        }
예제 #4
0
        public override void OnStrategyStart()
        {
            TimeHelper = new TimeHelper(Instrument.Symbol);
            PriceHelper = new PriceHelper(Instrument.TickSize);
            TextParameter = new TextCommon() { OpenClose = EnumOpenClose.OPEN };
            CloseTodayHelper = new CloseTodayHelper(EnumExchangeID.SHFE);

            DualPosition = new DualPosition(Instrument.Symbol);
            DualPosition.Sell.PriceHelper = PriceHelper;
            DualPosition.Buy.PriceHelper = PriceHelper;
            DualPosition.CloseTodayHelper = CloseTodayHelper;

            TargetPosition = 0;
            DualPosition.Long.Qty = 0;
            DualPosition.Long.QtyToday = 0;
            DualPosition.Short.Qty = 0;
            DualPosition.Short.QtyToday = 0;
        }