Ejemplo n.º 1
0
        public SecurityID RoomAdder(int loaner)
        {
            SecurityID    Steve    = new SecurityID();
            List <string> newDoors = new List <string>();

            Steve.BadgeID = loaner;

            bool coolRunnings = true;

            while (coolRunnings)
            {
                Console.WriteLine("Which room do we need to Add?");
                newDoors.Add(Console.ReadLine());

                Steve.Doors = newDoors;

                Console.WriteLine("Add another room? (y/n)");
                string input       = Console.ReadLine();
                bool   affirmative = (input == "y");

                if (affirmative == true)
                {
                    coolRunnings = true;
                }
                else
                {
                    coolRunnings = false;
                }
            }

            return(Steve);
        }
Ejemplo n.º 2
0
 public SecurityIdentityAdded(SecurityID id, UserID userID, string displayName, string token)
     : base(id)
 {
     UserID = userID;
     DisplayName = displayName;
     Token = token;
 }
Ejemplo n.º 3
0
        public void StockUpDict()
        {
            List <string> _id1List = new List <string>();

            _id1List.Add("A7");

            SecurityID id1 = new SecurityID(69, _id1List);

            List <string> _id2List = new List <string>();

            _id2List.Add("A1");
            _id2List.Add("A4");
            _id2List.Add("B1");
            _id2List.Add("B2");
            SecurityID id2 = new SecurityID(70, _id2List);

            List <string> _id3List = new List <string>();

            _id3List.Add("A4");
            _id3List.Add("A5");
            SecurityID id3 = new SecurityID(71, _id3List);


            _repo.CreateNewBadge(id1);
            _repo.CreateNewBadge(id2);
            _repo.CreateNewBadge(id3);
        }
Ejemplo n.º 4
0
 public UserLoginSuccessReported(SecurityID securityID, UserID userID, DateTime timeUtc, string ip)
     : base(securityID)
 {
     UserID = userID;
     TimeUtc = timeUtc;
     Ip = ip;
 }
Ejemplo n.º 5
0
 public SecurityItemRemoved(SecurityID securityID, UserID userId, string lookup, string type)
     : base(securityID)
 {
     UserID = userId;
     Lookup = lookup;
     Type = type;
 }
 public PermissionAddedToSecurityItem(SecurityID securityID, UserID userId, string displayName, string permission, string token)
     : base(securityID)
 {
     UserID = userId;
     DisplayName = displayName;
     Permission = permission;
     Token = token;
 }
Ejemplo n.º 7
0
 public SecurityInfo(SecurityID securityId, string login, string pwd, string userDisplay, string optionalIdentity)
 {
     SecurityID = securityId;
     Login = login;
     Pwd = pwd;
     UserDisplay = userDisplay;
     OptionalIdentity = optionalIdentity;
 }
        public void Arrange()
        {
            _repo         = new SecurityRepository();
            _dude         = new SecurityID();
            _dude.BadgeID = 69;
            _repo.AddDoorToExistingBadge(_dude);

            _repo.CreateNewBadge(_dude);
        }
        public void CreateNewBadgeID()
        {
            List <string> stuff = new List <string>();

            SecurityID dibz     = new SecurityID(1, stuff);
            bool       wasAdded = _repo.CreateNewBadge(dibz);

            Assert.IsTrue(wasAdded);
        }
Ejemplo n.º 10
0
 public RegistrationSucceeded(RegistrationID registrationIdentity, SecurityID securityID, UserID userID,
                              string userDisplayName, string userToken)
     : base(registrationIdentity)
 {
     SecurityID = securityID;
     UserID = userID;
     UserDisplayName = userDisplayName;
     UserToken = userToken;
 }
Ejemplo n.º 11
0
 public SecurityPasswordAdded(SecurityID identity, UserID userID, string displayName,
                              string login, string passwordHash, string passwordSalt, string token)
     : base(identity)
 {
     UserID = userID;
     DisplayName = displayName;
     Login = login;
     PasswordHash = passwordHash;
     PasswordSalt = passwordSalt;
     Token = token;
 }
Ejemplo n.º 12
0
        public SessionIdentity(UserID user, SecurityID security, string userName,
                               string cookieString, IEnumerable<string> permissions, string token)
        {
            User = user;
            Security = security;
            UserName = userName;
            SessionDisplay = String.Format("{0} ({1})", UserName, User.GetIdenfitier());

            CookieString = cookieString;
            Permissions = new HashSet<string>(permissions);
            Token = token;
        }
Ejemplo n.º 13
0
        public void RoomAdderToUi(int loanerAdd)
        {
            SecurityID newSteve = RoomAdder(loanerAdd);

            bool wasAdded = _repo.AddDoorToExistingBadge(newSteve);

            if (wasAdded)
            {
                Console.WriteLine("Door Access Added Successfully");
            }
            else
            {
                Console.WriteLine("Looks Like Something Went Wrong");
            }
        }
Ejemplo n.º 14
0
    void btnUpdateStockIDUpdate_Click(object sender, EventArgs e)
    {
        int investarsStockID;

        if (SecurityID != 0 && Int32.TryParse(txtUpdateStockID.Text.Trim(), out investarsStockID))
        {
            //Update
            Data.UpdateAllianceInvestarsStockID(SecurityID, investarsStockID);

            txtSecurityID.Text = SecurityID.ToString();

            btnSearch_Click(btnSearch, new EventArgs());
        }

        pUpdateStockID.Visible = false;
    }
Ejemplo n.º 15
0
        public ActionResult Create(CreateAccountModel model)
        {
            if (ModelState.IsValid)
            {
                var securityid = new SecurityID(Guid.NewGuid().ToString());
                var security = new SecurityInfo(securityid, model.Username, model.Password, model.Username, null);
                var regid = new RegistrationID(Guid.NewGuid());

                var cmd = new RegistrationCreated(regid, DateTime.UtcNow, security);

                Bus.SendOne(cmd);

                return RedirectToAction("Index");
            }

            return View(model);
        }
Ejemplo n.º 16
0
        private void AddNewBadge()
        {
            Console.Clear();
            SecurityID    newDude  = new SecurityID();
            List <string> newDoors = new List <string>();


            Console.Write("Please Enter New Badge ID: ");
            int badge = Convert.ToInt32(Console.ReadLine());

            newDude.BadgeID = badge;

            bool coolRunnings = true;

            while (coolRunnings)
            {
                Console.Write("List Door Access Needed: ");
                newDoors.Add(Console.ReadLine());
                newDude.Doors = newDoors;
                Console.Write("Add Another Doors? (y/n)");
                string moreDoors = Console.ReadLine().ToLower();

                if (moreDoors == "y")
                {
                    coolRunnings = true;
                }
                else
                {
                    coolRunnings = false;
                }
            }
            _repo.CreateNewBadge(newDude);
            bool wasAddedCorrectly = _repo.DoesKeyExist(newDude.BadgeID);

            if (wasAddedCorrectly)
            {
                Console.WriteLine("Badge Successfully Created");
                Console.Write("Press Any Key To Continue to Main Menu.");
                Console.ReadLine();
            }
            else
            {
                Console.WriteLine("Oops, Something Went Wrong. Try Again.");
            }
        }
Ejemplo n.º 17
0
        public void MarketDataRequest(QuickFix42.SecurityDefinition securityDefinition)
        {
            QuickFix42.MarketDataRequest marketDataRequest =
                new QuickFix42.MarketDataRequest(new MDReqID(DateTime.Now.ToString()),
                new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT_PLUS_UPDATES),
                new MarketDepth(1));
            marketDataRequest.setField(new MDUpdateType(MDUpdateType.FULL_REFRESH));
            marketDataRequest.setField(new AggregatedBook(true));

            QuickFix42.MarketDataRequest.NoMDEntryTypes marketDataEntyGroupBid = new QuickFix42.MarketDataRequest.NoMDEntryTypes();
            marketDataEntyGroupBid.set(new MDEntryType(MDEntryType.BID));
            marketDataRequest.addGroup(marketDataEntyGroupBid);

            QuickFix42.MarketDataRequest.NoMDEntryTypes marketDataEntyGroupOffer = new QuickFix42.MarketDataRequest.NoMDEntryTypes();
            marketDataEntyGroupOffer.set(new MDEntryType(MDEntryType.OFFER));
            marketDataRequest.addGroup(marketDataEntyGroupOffer);

            /** Create Component Block NoRelatedSym */
            QuickFix42.MarketDataRequest.NoRelatedSym noRelatedSym = new QuickFix42.MarketDataRequest.NoRelatedSym();

            SecurityExchange securityExchange = new SecurityExchange();
            securityDefinition.getField(securityExchange);
            noRelatedSym.setField(securityExchange);

            SecurityType securityType = new SecurityType();
            securityDefinition.getField(securityType);
            noRelatedSym.setField(securityType);

            Symbol symbol = new Symbol();
            securityDefinition.getField(symbol);
            noRelatedSym.setField(symbol);

            //MaturityMonthYear maturityMonthYear = new MaturityMonthYear();
            //securityDefinition.getField(maturityMonthYear);
            //noRelatedSym.setField(maturityMonthYear);

            SecurityID securityId = new SecurityID();
            securityDefinition.getField(securityId);
            noRelatedSym.setField(securityId);

            marketDataRequest.addGroup(noRelatedSym);

            Session.sendToTarget(marketDataRequest, GetPriceSession());
        }
Ejemplo n.º 18
0
        public void RoomRemover(int loaner)
        {
            SecurityID    Steve1   = new SecurityID();
            List <string> oldDoors = new List <string>();

            Steve1.BadgeID = loaner;

            bool coolRunnings = true;

            while (coolRunnings)
            {
                Console.WriteLine("Which room do we need to Remove?");
                oldDoors.Add(Console.ReadLine());

                Steve1.Doors = oldDoors;

                Console.WriteLine("Remove another room? (y/n)");
                string input = Console.ReadLine();

                bool affirmative = (input == "y");

                if (affirmative == true)
                {
                    coolRunnings = true;
                }
                else
                {
                    coolRunnings = false;
                }
            }

            bool wasAdded = _repo.RemoveDoorFromExistingBadge(Steve1);

            if (wasAdded)
            {
                Console.WriteLine("Door Access Removed");
            }
            else
            {
                Console.WriteLine("Something Went Wrong");
            }
        }
Ejemplo n.º 19
0
 public UserCreated(SecurityID securityID, UserID userID, TimeSpan activityThreshold)
     : base(securityID)
 {
     UserID = userID;
     ActivityThreshold = activityThreshold;
 }
Ejemplo n.º 20
0
 public static SessionIdentity Create(string dispay, UserID user, string token,
                                      SecurityID sec, params string[] permissions)
 {
     var auth = new AuthInfo(user, token);
     return new SessionIdentity(user, sec, dispay, auth.ToCookieString(), permissions, token);
 }
Ejemplo n.º 21
0
 public UserUnlocked(SecurityID securityID, UserID userID, string unlockReason)
     : base(securityID)
 {
     UserID = userID;
     UnlockReason = unlockReason;
 }
 public override int GetHashCode()
 {
     return(1664755014 + SecurityID.GetHashCode());
 }
 public SecurityItemDisplayNameUpdated(SecurityID securityID, UserID userId, string displayName)
     : base(securityID)
 {
     UserID = userId;
     DisplayName = displayName;
 }
Ejemplo n.º 24
0
        public Message NewOrder(MDEntryGroup entryGroup, double quantity)
        {
            bool isInvertedSecurity = entryGroup.OwnerEntry.IsInverted;
            Message message = null;
            Account account = new Account(GetOrderSession().getSenderCompID().ToLower());

            ClOrdID clOrdId = new ClOrdID("ClOrd_" + Guid.NewGuid());
            HandlInst handlInst = new HandlInst(HandlInst.AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION);
            OrdType ordType = new OrdType(OrdType.LIMIT);
            TimeInForce timeInForce = new TimeInForce(TimeInForce.FILL_OR_KILL);
            TransactTime transactTime = new TransactTime();

            Price price = new Price(entryGroup.MDEntryPx);
            SecurityExchange securityExchange = new SecurityExchange(entryGroup.OwnerEntry.SecurityExchange);
            SecurityType securityType = new SecurityType(entryGroup.OwnerEntry.SecurityType);
            Symbol symbol = new Symbol(entryGroup.OwnerEntry.Symbol);
            SecurityID securityId = new SecurityID(entryGroup.OwnerEntry.SecurityID);
            OrderQty orderQty = new OrderQty(quantity);

            Side side = null;
            switch (entryGroup.MDEntryType)
            {
                case MDEntryType.BID:
                    side = new Side(Side.SELL);
                    break;
                case MDEntryType.OFFER:
                    side = new Side(Side.BUY);
                    break;
                default:
                    throw new Exception("Undefined entry type.");
            }

            //if (isInvertedSecurity && side.getValue() == Side.BUY)
            //    price = new Price(-price.getValue());

            message = new QuickFix42.NewOrderSingle();

            ((QuickFix42.NewOrderSingle) message).set(account);

            ((QuickFix42.NewOrderSingle) message).set(clOrdId);
            ((QuickFix42.NewOrderSingle) message).set(side);
            ((QuickFix42.NewOrderSingle) message).set(transactTime);
            ((QuickFix42.NewOrderSingle) message).set(ordType);

            ((QuickFix42.NewOrderSingle) message).set(price);
            ((QuickFix42.NewOrderSingle) message).set(orderQty);
            ((QuickFix42.NewOrderSingle) message).set(securityId);
            ((QuickFix42.NewOrderSingle) message).set(securityExchange);
            ((QuickFix42.NewOrderSingle) message).set(timeInForce);

            ((QuickFix42.NewOrderSingle) message).set(securityType);

            return message;
        }
Ejemplo n.º 25
0
        public override void onMessage(QuickFix42.SecurityDefinition securityDefinition, SessionID sessionID)
        {
            //Console.WriteLine("securityDefinition " + securityDefinition);

            try
            {
                SecurityType securityType = new SecurityType();
                securityDefinition.getField(securityType);

                SecurityID securityID = new SecurityID();
                securityDefinition.getField(securityID);

                //Create the object in the spreadmatrix;

                if(securityType.getValue() == SecurityType.MULTILEGINSTRUMENT)
                {
                    string longUnderlyingMaturityMonthYear=null;
                    string shortUnderlyingMaturityMonthYear=null;

                    NoRelatedSym noRelatedSym = securityDefinition.getNoRelatedSym();
                    uint SubContractCount = (uint)noRelatedSym.getValue();

                    if (SubContractCount != 2)
                    {
                        //Console.WriteLine("I don't know how to handle an MLEG with " + SubContractCount + " legs.");
                        return;
                    }

                    SecurityDefinition.NoRelatedSym group = new SecurityDefinition.NoRelatedSym();
                    for (uint i = 0; i < SubContractCount; i++)
                    {
                        securityDefinition.getGroup(i + 1, group);

                        UnderlyingMaturityMonthYear underlyingMaturityMonthYear = new UnderlyingMaturityMonthYear();
                        group.getField(underlyingMaturityMonthYear);

                        Side side = new Side();
                        group.getField(side);

                        if (side.getValue() == QuickFix.Side.SELL)
                        {
                            shortUnderlyingMaturityMonthYear = underlyingMaturityMonthYear.getValue();
                        }
                        else if (side.getValue() == QuickFix.Side.BUY)
                        {
                            longUnderlyingMaturityMonthYear = underlyingMaturityMonthYear.getValue();
                        }
                        else
                        {
                            Console.WriteLine("Unsupport MLEG side: " + side.getValue());
                            return;
                        }
                    }

                    spreadMatrix.CreateSpread(securityID.getValue(), longUnderlyingMaturityMonthYear, shortUnderlyingMaturityMonthYear);
                }
                else if (securityType.getValue() == SecurityType.FUTURE)
                {
                    MaturityMonthYear maturityMonthYear = new MaturityMonthYear();
                    securityDefinition.getField(maturityMonthYear);

                    spreadMatrix.CreateOutright(securityID.ToString(), maturityMonthYear.ToString());
                }
                else
                {
                    Console.WriteLine("Unsupport security type: " + securityType.getField());
                    return;
                }

                MarketDataRequest(securityDefinition, sessionID);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
        }