示例#1
0
        public void CanCreateTakeProfitAndStopLimitOrder()
        {
            var q  = new OrderTradeParams(Mother.SBRF, Direction.Sell, 1, 76.48m);
            var sq = new StopOrderTradeParams(q, 76.48m, Mother.STD_ProfitCondition, ExpiryDate.TODAY, 73.12m);
            var o  = this.tb.NewTakeProfitAndStopLimitOrder(sq);

            Assert.IsFalse(String.IsNullOrEmpty(o.ToString()));
        }
        public void CanCreateTakeProfitOrder()
        {
            var q  = new OrderTradeParams(Mother.SBRF, Direction.Sell, 1);
            var sq = new StopOrderTradeParams(q, 76.48m, Mother.STD_ProfitCondition);
            var o  = this.tb.NewTakeProfitOrder(sq);

            Console.WriteLine(o);
            Assert.IsNotEmpty(o.ToString());
        }
示例#3
0
        public void CanSendTakeProfitOrder()
        {
            var cw = new ConnectionListener(Mother.CONST_PathToQuik);

            Assert.IsTrue(cw.Connect());
            var tw  = new TransactionManager();
            var q   = new OrderTradeParams(Mother.SBRF, Direction.Sell, 1);
            var sq  = new StopOrderTradeParams(q, 76.48m, Mother.STD_ProfitCondition);
            var txn = tBuilder.NewTakeProfitOrder(sq);
            var res = tw.SendSyncTransaction(txn.ToString());

            Console.WriteLine("{0}", res);
            Assert.IsTrue(res.ReturnValue.IsSuccess);
        }
示例#4
0
        public void CanSendTakeProfitAndStopLimitMarketOrder()
        {
            var cw = new ConnectionListener(Mother.CONST_PathToQuik);

            Assert.IsTrue(cw.Connect());
            var tw = new TransactionManager();

            var q   = new OrderTradeParams(Mother.SBRF, Direction.Sell, 1);
            var pq  = new ProfitCondition(0.1m, Units.PriceUnits, true, true);
            var sq  = new StopOrderTradeParams(q, 76.48m, pq, ExpiryDate.TODAY, 73.12m);
            var txn = tBuilder.NewTakeProfitAndStopLimitOrder(sq);
            var res = tw.SendSyncTransaction(txn.ToString());

            Console.WriteLine("{0}", res);
            Assert.IsTrue(res.ReturnValue.IsSuccess);
        }
示例#5
0
        public void Sample03()
        {
            var gateway = new Gateway(@"C:\Quik", "LXX+XXXXXXXXX");

            gateway.NewTransaction += OnNewTransaction;
            gateway.Start();

            var security    = new Security("TQBR", "SBER");
            var tradeParams = new OrderTradeParams(security, Direction.Buy, 1);

            gateway.SendOrder(tradeParams); // Купить по рынку 10 акций Сбербанка

            // Выставить стоп-лимит: продать 10 акций Сбербанка по 75.10. Активировать при наступлении цены 75.12
            var stop = new StopOrderTradeParams(new OrderTradeParams(security, Direction.Sell, 1, 75.10m), 75.12m);

            gateway.SendStopLimitOrder(stop);

            Thread.Sleep(10000);
        }
示例#6
0
 public StopOrder NewTakeProfitAndStopLimitOrder(StopOrderTradeParams tradeParams)
 {
     return(new StopOrder(this.GetNextId(), this.Account, StopOrderKind.TakeProfitAndStopLimit).SetStopOrderTradeParams(tradeParams));
 }
示例#7
0
 public StopOrder NewStopLimitOrder(StopOrderTradeParams tradeParams)
 {
     return(new StopOrder(this.GetNextId(), this.Account, StopOrderKind.Simple).SetStopOrderTradeParams(tradeParams));
 }