コード例 #1
0
        private void SetSecurities()
        {
            try
            {
                DbQueryManager dbManager   = new DbQueryManager(connString);
                IDataReader    queryResult = dbManager.ToExecuteReader("sel_SecurityStream", true, new Dictionary <string, object>()
                {
                    { "Kriter", 1 }
                });
                while (queryResult.Read())
                {
                    SecurityBuilder secBuilder = new SecurityBuilder();
                    Security        sec        = secBuilder.Build(queryResult);

                    dataProvider.SecurityValues.AddOrUpdate(sec.OrgSecurity, sec, (k, v) => { return(sec); });
                }
                queryResult.Close();
                queryResult.Dispose();
            }
            catch (Exception ex)
            {
                TBYException tex = new TBYException(MethodInfo.GetCurrentMethod().GetFullName(), "Veritabanından semboller getirilirken hata oluştu", ex);
                ProcessException(tex);
            }
        }
コード例 #2
0
ファイル: DBHelper.cs プロジェクト: stanleywu111/algo_trade
        public void UpdateOrder(Teb.FIX.Model.Order order)
        {
            DbQueryManager dbQueryManager = new DbQueryManager(ConnectionString, ProviderName);

            dbQueryManager.OpenConnection();

            Dictionary <string, object> pList = new Dictionary <string, object>();

            pList.Add("Kriter", 1);
            pList.Add("State", order.State == null ? -1 : order.State.GetStateID());
            pList.Add("IsGlobal", order.IsGlobal);
            pList.Add("MessageId", order.DbID);
            pList.Add("TEBID", order.TEBID);
            pList.Add("UpdateDateTime", DateTime.Now);
            pList.Add("ClOrdIncrement", order.ClOrdIncrement);
            pList.Add("MarketClOrdID", order.MarketClOrdId);
            pList.Add("MarketOrdID", order.MarketOrdID);
            pList.Add("ConnectionID", order.ConnectionID);
            pList.Add("ConnectionClOrdID", order.ConnectionClOrdID);
            pList.Add("ConnectionOrigClOrdID", order.ConnectionOrigClOrdID);
            pList.Add("ClOrdID", order.ClOrdID);
            pList.Add("OrigClOrdID", order.OrigClOrdID);
            pList.Add("OrderID", order.OrderID);
            pList.Add("SecurityType", order.SecurityType);
            pList.Add("Afe", order.Afe);
            pList.Add("Kafe", order.Kafe);
            pList.Add("SellShort", order.IsSellShort);
            pList.Add("Account", order.Account);
            pList.Add("AccountSubNo", order.AccountSubNo);
            pList.Add("PartyID", order.PartyID);
            //pList.Add("AccountType", order.AccountType);
            pList.Add("ServerStatusID", (int)order.ServerStatus);
            pList.Add("ClientStatusID", (int)order.ClientStatus);
            pList.Add("HistoryStatusID", (int)order.HistoryStatus);
            pList.Add("IsUIActive", order.IsActive);

            pList.Add("TimeInForce", order.Core.TimeInForce);
            pList.Add("OrgTimeInForce", order.Core.OrgTimeInForce);
            pList.Add("ExpireDate", order.ExpireDate);
            pList.Add("Side", order.Core.Side);
            pList.Add("Symbol", order.Symbol);
            pList.Add("SymbolSfx", order.SymbolSfx);

            if (order.TransactTime.HasValue)
            {
                pList.Add("TransactTime", order.TransactTime.Value);
            }
            if (order.SendingTime.HasValue)
            {
                pList.Add("SendingTime", order.SendingTime.Value);
            }
            if (order.Price.HasValue)
            {
                pList.Add("Price", order.Price.Value);
            }
            if (order.Price2.HasValue)
            {
                pList.Add("Price2", order.Price2.Value);
            }
            if (order.TriggerPrice.HasValue)
            {
                pList.Add("TriggerPrice", order.TriggerPrice.Value);
            }
            if (order.OrderQty.HasValue)
            {
                pList.Add("OrderQty", order.OrderQty.Value);
            }
            if (order.OrderQty2.HasValue)
            {
                pList.Add("OrderQty2", order.OrderQty2.Value);
            }
            if (order.CumQty.HasValue)
            {
                pList.Add("CumQty", order.CumQty.Value);
            }
            if (order.AvgPx.HasValue)
            {
                pList.Add("AvgPx", order.AvgPx.Value);
            }
            if (order.LeavesQty.HasValue)
            {
                pList.Add("LeavesQty", order.LeavesQty.Value);
            }
            if (order.GrossTradeAmt.HasValue)
            {
                pList.Add("GrossTradeAmount", order.GrossTradeAmt.Value);
            }
            if (order.LastQty.HasValue)
            {
                pList.Add("LastQty", order.LastQty.Value);
            }
            if (order.LastPx.HasValue)
            {
                pList.Add("LastPx", order.LastPx.Value);
            }
            pList.Add("SenderCompID", order.SenderCompID);
            pList.Add("TargetCompID", order.TargetCompID);
            pList.Add("MarketSegmentID", order.Core.MarketSegmentID);
            pList.Add("PositionEffect", order.PositionEffect);
            pList.Add("Text", order.Text);
            pList.Add("EncodedText", order.EncodedText);
            pList.Add("OrdType", order.Core.OrdType);
            pList.Add("MarketSourceID", order.MarketSource == null ? "-1" : order.MarketSource.Id);
            pList.Add("InstructionSourceID", order.InstructionSource == null ? "-1" : order.InstructionSource.Id);

            pList.Add("ConnectionFirstClOrdID", order.ConnectionFirstClOrdID);
            pList.Add("MaxFloor", order.MaxFloor);
            pList.Add("PegPriceType", order.PegPriceType);
            pList.Add("FirstClOrdID", order.FirstClOrdID);
            dbQueryManager.Execute("up_FIXAppOrders", true, pList);
            dbQueryManager.CloseConnection();
        }