Example #1
0
        public async Task ShouldGetPositions()
        {
            _connector.Start();
            WaitForState(FixConnectorState.Connected, 30);

            var request = new RequestForPositions
            {
                PosReqID   = new PosReqID(nameof(RequestForPositions) + Guid.NewGuid()),
                PosReqType = new PosReqType(PosReqType.POSITIONS),
                SubscriptionRequestType = new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT),
                NoPartyIDs           = new NoPartyIDs(1),
                Account              = new Account("account"),
                AccountType          = new AccountType(AccountType.ACCOUNT_IS_CARRIED_ON_CUSTOMER_SIDE_OF_BOOKS),
                ClearingBusinessDate = new ClearingBusinessDate(DateTimeConverter.ConvertDateOnly(DateTime.UtcNow.Date)),
                TransactTime         = new TransactTime(DateTime.UtcNow)
            };

            var partyGroup = new RequestForPositions.NoPartyIDsGroup
            {
                PartyID   = new PartyID("FB"),
                PartyRole = new PartyRole(PartyRole.CLIENT_ID)
            };

            request.AddGroup(partyGroup);

            var resp = await _connector.GetPositionsAsync(request, CancellationToken.None);

            Assert.NotEmpty(resp);
        }
Example #2
0
        public override async Task <IReadOnlyCollection <PositionModel> > GetPositionsAsync(TimeSpan timeout)
        {
            var request = new RequestForPositions
            {
                PosReqID   = new PosReqID(nameof(RequestForPositions) + Guid.NewGuid()),
                PosReqType = new PosReqType(PosReqType.POSITIONS),
                SubscriptionRequestType = new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT),
                NoPartyIDs           = new NoPartyIDs(1),
                Account              = new Account("account"),
                AccountType          = new AccountType(AccountType.ACCOUNT_IS_CARRIED_ON_CUSTOMER_SIDE_OF_BOOKS),
                ClearingBusinessDate = new ClearingBusinessDate(DateTimeConverter.ConvertDateOnly(DateTime.UtcNow.Date)),
                TransactTime         = new TransactTime(DateTime.UtcNow)
            };

            var partyGroup = new RequestForPositions.NoPartyIDsGroup
            {
                PartyID   = new PartyID("FB"),
                PartyRole = new PartyRole(PartyRole.CLIENT_ID)
            };

            request.AddGroup(partyGroup);
            var cts = new CancellationTokenSource(timeout);

            var resp = await _tradeSessionConnector.GetPositionsAsync(request, cts.Token);

            return(_converter.ConvertPositionReport(resp));
        }
        public override async Task <IReadOnlyCollection <PositionModel> > GetPositions(TimeSpan timeout)
        {
            var pr = new RequestForPositions
            {
                PosReqType   = new PosReqType(PosReqType.POSITIONS),
                NoPartyIDs   = new NoPartyIDs(1),
                TransactTime = new TransactTime(DateTime.UtcNow)
            };
            var partyGroup = new RequestForPositions.NoPartyIDsGroup
            {
                PartyID = new PartyID("*")
            };

            pr.AddGroup(partyGroup);
            var cts     = new CancellationTokenSource(timeout);
            var reports = await _connector.GetPositionsAsync(pr, cts.Token);

            return(_modelConverter.ConvertPositionReport(reports));
        }
        public async Task ShouldGetPositions()
        {
            _connector.Start();
            WaitForState(FixConnectorState.Connected, 30);

            var pr = new RequestForPositions()
            {
                PosReqType   = new PosReqType(PosReqType.POSITIONS),
                NoPartyIDs   = new NoPartyIDs(1),
                TransactTime = new TransactTime(DateTime.UtcNow)
            };
            var partyGroup = new RequestForPositions.NoPartyIDsGroup
            {
                PartyID = new PartyID("8")
            };

            pr.AddGroup(partyGroup);

            var resp = await _connector.GetPositionsAsync(pr, CancellationToken.None);

            Assert.NotEmpty(resp);
        }