예제 #1
0
        /// <summary>
        /// Get positions by criteria
        /// </summary>
        /// <param name="inputs"></param>
        /// <returns></returns>
        protected async Task <IndexCollection <ITransactionPositionModel> > GetGenericPositions(dynamic inputs)
        {
            var positions = new IndexCollection <ITransactionPositionModel>();
            var response  = await GetResponse <InputDealListModel>($"/v3/accounts/{ Account.Id }/trades");

            foreach (var inputOrder in response.Deals)
            {
                var positionModel = new TransactionPositionModel
                {
                    Id        = $"{ inputOrder.Id }",
                    Size      = inputOrder.Size,
                    Price     = inputOrder.Price,
                    OpenPrice = inputOrder.Price,
                    Type      = OrderTypeMap.Input(inputOrder.Type),
                    Status    = DealStatusMap.Input(inputOrder.Status),
                    TimeSpan  = OrderTimeSpanMap.Input(inputOrder.TimeSpan),
                    Time      = inputOrder.OpenTime ?? inputOrder.CreationTime,
                    DealTime  = inputOrder.OpenTime
                };

                positions.Add(positionModel);
            }

            return(positions);
        }
예제 #2
0
        /// <summary>
        /// Convert to external position type
        /// </summary>
        /// <param name="inputs"></param>
        public static IList <ITransactionPositionModel> Positions(dynamic inputs)
        {
            var positions = new List <ITransactionPositionModel>();

            if (inputs is IEnumerable)
            {
                foreach (var input in inputs)
                {
                    var position = new TransactionPositionModel
                    {
                    };
                }
            }

            return(positions);
        }