Пример #1
0
        public void Test_GetPositionSummaryList()
        {
            TradePositionBLL   bll   = new TradePositionBLL(_unit);
            List <OutPosition> aList = bll.GetPositionSummaryList(1060, null);

            aList = bll.GetPositionSummaryList(1060, 2);
        }
Пример #2
0
        public async Task <IHttpActionResult> UpdatePosition([FromBody] InUpdatePositionParams input)
        {
            TradePositionBLL tpBLL    = new TradePositionBLL(_unit);
            TradePosition    position = null;

            try
            {
                position = tpBLL.UpdatePosition(input);
            }
            catch (Exception ex)
            {
                LogHelper.Error(_log, ex.ToString());
                return(InternalServerError(ex));
            }

            return(Ok(position));
        }
        public async Task <IHttpActionResult> GetOutstandingTradePositionByAccount(int accountId)
        {
            List <TradePosition> tlist = null;

            try
            {
                TradePositionBLL bll = new TradePositionBLL(_unit);

                tlist = bll.GetOutstandingPositions(accountId);
            }
            catch (Exception ex)
            {
                LogHelper.Error(_log, ex.ToString());
                return(InternalServerError(ex));
            }

            return(Ok(tlist));
        }
        public async Task <IHttpActionResult> GetPositionSummaryListByAccount(int accountId, int?size = 50)
        {
            List <OutPosition> slist = null;

            try
            {
                TradePositionBLL bll = new TradePositionBLL(_unit);

                slist = bll.GetPositionSummaryList(accountId, size);
            }
            catch (Exception ex)
            {
                LogHelper.Error(_log, ex.ToString());
                return(InternalServerError(ex));
            }

            return(Ok(slist));
        }
Пример #5
0
        public void Test_UpdateSpanDays()
        {
            TradePositionBLL     bll   = new TradePositionBLL(_unit);
            TransactionBLL       tbll  = new TransactionBLL(_unit);
            List <TradePosition> aList = bll.GetListByAccount(1060);

            foreach (var p in aList)
            {
                if (p.ExitTransactionId.HasValue)
                {
                    var entryTrans = tbll.GetByID(p.EntryTransactionId);
                    var exitTrans  = tbll.GetByID(p.ExitTransactionId.Value);

                    p.days = new TickerBLL(_unit).GetTradesDaySpan(p.ShareId, entryTrans.TradingDate, exitTrans.TradingDate);

                    bll.Update(p);
                }
            }
        }