public OrderViewModel(int number, float openValue, OrderType type, OrderCategory category)
 {
     this.number = number;
     this.value = openValue;
     this.type = type;
     this.category = category;
 }
		/// <summary>
		/// The <b>AddOrder</b> call can be used by a seller to combine two or more unpaid order line items from the same buyer into one order with multiple line items. Once multiple line items are combined into one order, the buyer can make one single payment for each line item in the order. If possible and agreed to, the seller can then ship multiple line items in the same shipping package, saving on shipping costs, and possibly passing that savings down to the buyer through Combined Shipping Discount rules set up in My eBay.
		/// </summary>
		/// 
		/// <param name="Order">
		/// The root container of the <b>AddOrder</b> request. In this 
		/// call, the seller identifies two or more unpaid order line items from the same buyer 
		/// through the <b>TransactionArray</b> container, specifies one or 
		/// more accepted payment methods through the <b>PaymentMethods</b> 
		/// field(s), and specifies available shipping services and other shipping details 
		/// through the <b>ShippingDetails</b> container.
		/// </param>
		///
		public string AddOrder(OrderType Order)
		{
			this.Order = Order;

			Execute();
			return ApiResponse.OrderID;
		}
Example #3
0
 public List<Order> Get(OrderType Type)
 {
     using (var db = GetDataContext())
     {
         return db.Orders.Where(e=>e.Type==Type).OrderBy(e => e.Time).ToList();
     }
 }
Example #4
0
 public NewOrderResponse ExecuteOrder(OrderSymbol symbol, decimal amount, decimal price, OrderExchange exchange, OrderSide side, OrderType type)
 {
     NewOrderRequest req = new NewOrderRequest(Nonce, symbol, amount, price, exchange, side, type);
     string response = SendRequest(req,"POST");
     NewOrderResponse resp = NewOrderResponse.FromJSON(response);
     return resp;
 }
Example #5
0
		public AIControlMobileTarget( BaseAI ai, OrderType order ) : base( -1, false, ( order == OrderType.Attack ? TargetFlags.Harmful : TargetFlags.None ) )
		{
			m_List = new List<BaseAI>();
			m_Order = order;

			AddAI( ai );
		}
        public async Task<TransactionResponse> GetTransactions(string orderExternalRef, OrderType orderType = OrderType.OutletToDistributor)
        {
            TransactionResponse _response;
            string _url = MiddlewareHttpClient.BaseAddress +
                          "api/Integrations/Transaction?username={0}&password={1}&integrationModule={2}&documentRef={3}&orderType={4}";

            string url = string.Format(_url, _userName, _otherUtilities.MD5Hash(_password),
                                       module, orderExternalRef, orderType);
            Messenger.Default.Send(
                string.Format(DateTime.Now.ToString("hh:mm:ss") + ":Contacting Server =>" +
                              MiddlewareHttpClient.BaseAddress));
            HttpResponseMessage response =
                await MiddlewareHttpClient.GetAsync(url);
            Messenger.Default.Send(
                string.Format(DateTime.Now.ToString("hh:mm:ss") + ":Server Response=>" + response.StatusCode));
            _response =
                await response.Content.ReadAsAsync<TransactionResponse>();
            if (_response != null)
            {
                if (_response.Result == "Error")
                {
                    Messenger.Default.Send(
                        string.Format(DateTime.Now.ToString("hh:mm:ss") + ":Server Response=>" + _response.ErrorInfo));
                    return null;
                }
                if (!string.IsNullOrEmpty(_response.TransactionData))
                {
                    Messenger.Default.Send(
                        string.Format(DateTime.Now.ToString("hh:mm:ss") + ": Server response: items downloaded"));
                    DumpExportFilesAsync(_response);

                }
            }
            return _response;
        }
Example #7
0
        public static async Task GetLibraryList(
            Action<LibraryList> onSuccess, 
            Action<Error> onFail,
            int channelId, 
            OrderType orderType = OrderType.LASTEST, 
            Dictionary<string, string> filters = null,
            int pageCount = 1,
            int pageSize = 20)
        {
            string methodName = "getLibraryList";

            MGDataLoader<LibraryList> loader = new MGDataLoader<LibraryList>(CATEGORY, methodName);
            loader.AddParameter("channelId", channelId.ToString());
            loader.AddParameter("pageCount", pageCount.ToString());
            loader.AddParameter("pageSize", pageSize.ToString());
            loader.AddParameter("orderType", orderType.ToString());
           
            if(filters != null)
            {
                foreach (KeyValuePair<string, string> kv in filters)
                {
                    loader.AddParameter(kv.Key, kv.Value);
                }
            }

            await loader.LoadDataAsync(onSuccess, onFail);

        }
        /// <summary>
        ///     Adds an order for the given contract and market side with the given properties
        /// </summary>
        /// <returns>The added order</returns>
        public IOrder AddOrder(long orderID,
                               Contract contract,
                               OrderType orderType,
                               MarketSide marketSide,
                               decimal price,
                               decimal quantity,
                               string clOrdID,
                               TradingAccount account)
        {
            var order = new Order(orderID,
                                  orderType,
                                  contract,
                                  marketSide,
                                  price,
                                  quantity,
                                  clOrdID,
                                  account);

            var stack = _market.GetOrCreate(
                contract,
                () =>
                    {
                        var os = OrderStackFactory.CreateStandardSortedStack(_orderMatcher);
                        os.OrdersMatched += OnOrdersMatched;
                        return os;
                    });
            stack.AddOrder(order);
            return order;
        }
Example #9
0
        /// <summary>
        /// Create a NewOrderSingle message.
        /// </summary>
        /// <param name="customFields"></param>
        /// <param name="orderType"></param>
        /// <param name="side"></param>
        /// <param name="symbol"></param>
        /// <param name="orderQty"></param>
        /// <param name="tif"></param>
        /// <param name="price">ignored if orderType=Market</param>
        /// <returns></returns>
        static public QuickFix.FIX42.NewOrderSingle NewOrderSingle(
            Dictionary<int,string> customFields,
            OrderType orderType, Side side, string symbol,
            int orderQty, TimeInForce tif, decimal price)
        {
            // hard-coded fields
            QuickFix.Fields.HandlInst fHandlInst = new QuickFix.Fields.HandlInst(QuickFix.Fields.HandlInst.AUTOMATED_EXECUTION_ORDER_PRIVATE);
            
            // from params
            QuickFix.Fields.OrdType fOrdType = FixEnumTranslator.ToField(orderType);
            QuickFix.Fields.Side fSide = FixEnumTranslator.ToField(side);
            QuickFix.Fields.Symbol fSymbol = new QuickFix.Fields.Symbol(symbol);
            QuickFix.Fields.TransactTime fTransactTime = new QuickFix.Fields.TransactTime(DateTime.Now);
            QuickFix.Fields.ClOrdID fClOrdID = GenerateClOrdID();

            QuickFix.FIX42.NewOrderSingle nos = new QuickFix.FIX42.NewOrderSingle(
                fClOrdID, fHandlInst, fSymbol, fSide, fTransactTime, fOrdType);
            nos.OrderQty = new QuickFix.Fields.OrderQty(orderQty);
            nos.TimeInForce = FixEnumTranslator.ToField(tif);

            if (orderType == OrderType.Limit)
                nos.Price = new QuickFix.Fields.Price(price);

            // add custom fields
            foreach (KeyValuePair<int,string> p in customFields)
                nos.SetField(new QuickFix.Fields.StringField(p.Key, p.Value));

            return nos;
        }
 /// <summary>
 /// 从外部传入的参数来构造订单商品
 /// </summary>
 /// <param name="merchantId"></param>
 /// <param name="productId"></param>
 /// <param name="opType"></param>
 /// <param name="paras"></param>
 /// <returns></returns>
 internal OrderProduct CreateOrderProduct(int productId,int quantity, OrderType opType, System.Collections.Specialized.NameValueCollection paras)
 {
     OrderProduct op = null;
     OrderProduct bll = GetOrderProductBll(opType);
     op = bll.CreateOrderProduct(productId,quantity, opType, paras);
     return op;
 }
        public WeRefundRequest(OrderType orderType, string orderId, string outRefundNo, int totalFee, int refundFee)
            : this()
        {
            TkDebug.AssertArgumentNullOrEmpty(orderId, "orderId", null);
            TkDebug.AssertArgumentNullOrEmpty(outRefundNo, "outRefundNo", null);

            switch (orderType)
            {
                case OrderType.TransactionId:
                    TransactionId = orderId;
                    break;
                case OrderType.OutTradeNo:
                    OutTradeNo = orderId;
                    break;
                case OrderType.OutRefundNo:
                case OrderType.RefundId:
                    TkDebug.ThrowToolkitException(string.Format(ObjectUtil.SysCulture,
                        "当前不支持{0}这种枚举,请确认", orderType), null);
                    break;
            }

            OutRefundNo = outRefundNo;
            TotalFee = totalFee;
            RefundFee = refundFee;
            OpUserId = MchId;
        }
Example #12
0
        internal Order(Expression expr, OrderType order)
        {
            expr.ThrowIfNullArgument(nameof(expr));

            _expr = expr;
            _order = order;
        }
Example #13
0
 public Order(OrderType type, string symbol, decimal limitPrice, decimal quantity)
 {
     Type = type;
     Symbol = symbol;
     Price = limitPrice;
     Quantity = quantity;
 }
Example #14
0
 public void AddOrder()
 {
     Assert.IsNotNull(TestData.NewItem, "Failed because no item available -- requires successful AddItem test");
     // Make API call.
     ApiException gotException = null;
     try
     {
     AddOrderCall api = new AddOrderCall(this.apiContext);
     OrderType order = new OrderType();
     api.Order = order;
     TransactionType t1 = new TransactionType();
     t1.Item = TestData.NewItem;
     t1.TransactionID = "0";
     TransactionType t2 = new TransactionType();
     t2.Item = TestData.NewItem;
     t2.TransactionID = "0";
     TransactionTypeCollection tary = new TransactionTypeCollection();
         tary.Add(t1); tary.Add(t2);
     order.TransactionArray = tary;
     api.Order = order;
     // Make API call.
     /*AddOrderResponseType resp =*/ api.Execute();
     }
     catch(ApiException ex)
     {
         gotException = ex;
     }
     Assert.IsNotNull(gotException);
 }
Example #15
0
 public static void Sort(List<FriendInfo> infos, OrderType orderType)
 {
     if(infos == null || infos.Count <= 1)
     {
         return;
     }
     switch(orderType)
     {
         case OrderType.Atk:
             {
                 infos.Sort(CompareFriendByAtk);
                 break;  
             }      
         case OrderType.Level:
             {
                 infos.Sort(CompareFriendByLevel);
                 break; 
             } 
         case OrderType.MaxDamage:
             {
                 infos.Sort(CompareFriendByMaxHit);
                 break;
             }
     }
 }
Example #16
0
 public Order(OrderType Type, int Size, CardSuit Trump)
 {
     this.Type = Type;
     this.Size = Size;
     this.Trump = Trump;
     this.Team = BeloteTeam.TEAM_NONE;
 }
        public override OrderProduct AddToCart(OrderType opType, int productId, int quantity, NameValueCollection paras)
        {
            int typecode;
            if (int.TryParse(paras["typecode"],out typecode))
            {
                typecode =0;
            }

            OrderProduct op = OrderProducts.Find(c => c.ProductID == productId && c.TypeCode == typecode);
            if (op == null)
            {
                op = OrderProductFactory.Instance().CreateOrderProduct(productId, quantity, opType, paras);
                op.Key = this.Key + "_op" + this.GetSerial();
                op.Container = this;
                this.ContinueShopUrl = op.ProductUrl;

                if (op != null)
                {
                    OrderProducts.Add(op);
                }
            }
            else
            {
                op.SetQuantiy(op.Quantity + quantity);
            }
            return op;
        }
		public AIControlMobileTarget( BaseAI ai, OrderType order ) : base( -1, false, TargetFlags.None )
		{
			m_List = new ArrayList();
			m_Order = order;

			AddAI( ai );
		}
Example #19
0
        public Message CreateNewOrderSingleMessage(string symbol,
                                                   MarketSide marketSide,
                                                   string clOrdID,
                                                   TradingAccount account,
                                                   decimal price,
                                                   decimal quantity,
                                                   OrderType orderType,
                                                   string execID)
        {
            var fOrdType = TranslateFixFields.Translate(orderType);
            var fSide = TranslateFixFields.Translate(marketSide);
            var fSymbol = new Symbol(symbol);
            var fTransactTime = new TransactTime(DateTime.Now);
            var fClOrdID = new ClOrdID(clOrdID);

            var nos = new NewOrderSingle(fClOrdID,
                                         fSymbol,
                                         fSide,
                                         fTransactTime,
                                         fOrdType)
            {
                OrderQty = new OrderQty(quantity),
                TimeInForce = new TimeInForce(TimeInForce.GOOD_TILL_CANCEL)
            };

            if (orderType == OrderType.Limit)
                nos.Price = new Price(price);

            return nos;
        }
Example #20
0
 public List<ProductPopUpItem> GetProductBySupplier(Outlet outlet, OrderType orderType, Supplier supplier)
 {
     vm.SetUpWithSupplier(outlet, orderType, supplier);
     this.Owner = Application.Current.MainWindow;
     this.ShowDialog();
     return vm.GetProductsLineItem();
 }
 public List<ProductPopUpItem> GetProduct(Outlet outlet, OrderType orderType, List<ProductPopUpItem> existing)
 {
     vm.SetUpPOS(outlet, orderType,existing);
     this.Owner = Application.Current.MainWindow;
     this.ShowDialog();
     return vm.GetProductsLineItem();
 }
        public static List<ClassifiedsListing> GetListings(Item item, ListingProperties props, 
			OrderType orderType)
        {
            VersatileIO.Info("Searching bp.tf classifieds for {0}...", props.ToString(item));
            List<ClassifiedsListing> all = ClassifiedsScraper.GetClassifieds(item, props);

            List<ClassifiedsListing> res = new List<ClassifiedsListing>();
            foreach (ClassifiedsListing c in all)
            {
                if (c.ItemInstance.Item.IsSkin())
                {
                    continue;
                }

                if (c.OrderType == orderType)
                {
                    res.Add(c);
                }
            }

            if (res.IsNullOrEmpty())
            {
                VersatileIO.Warning("No classifieds found for {0}.", props.ToString(item));
                return res.EmptyIfNull().ToList();
            }

            VersatileIO.Info("{0} listings found.", res.Count);
            return res;
        }
 public OrdersButton(List<Ship> shiplist, Vector2 Location, OrderType ot, int tipid)
 {
     this.ID_tip = tipid;
     this.ShipList = shiplist;
     this.orderType = ot;
     this.clickRect = new Rectangle((int)Location.X, (int)Location.Y, 48, 48);
 }
Example #24
0
        public virtual RequestStatus SendNewOrderRequest(Account account,
            MarketOrder order,
            OrderType orderType,
            decimal requestedPrice,
            decimal slippagePoints)
        {
            order.State = PositionState.Opened;
            order.TimeEnter = DateTime.Now;

            //if (magic.HasValue)
            //    order.ExpertComment = comment;
            //else
            //    order.Comment = comment;
            // подставить текущую цену
            var quote = QuoteStorage.Instance.ReceiveValue(order.Symbol);
            if (quote == null)
                return RequestStatus.NoPrice;
            order.PriceEnter = order.Side > 0 ? quote.ask : quote.bid;
            // проверить проскальзывание
            if (slippagePoints != 0)
            {
                var slippageAbs = DalSpot.Instance.GetAbsValue(order.Symbol, slippagePoints);
                var delta = Math.Abs(order.PriceEnter - (float)requestedPrice);
                if (delta > (float)slippageAbs) return RequestStatus.Slippage;
            }

            int posID;
            // сохранить ордер (и уведомить клиента)
            var result = ServerInterface.SaveOrderAndNotifyClient(order, out posID);
            return result ? RequestStatus.OK : RequestStatus.SerializationError;
        }
 protected string GetAutoPlacedOrderName(OrderType orderType, OrderSide orderSide, string info, string instrument, int retrials, string ibAccountNumber)
 {
     if (string.IsNullOrEmpty(info))
         return string.Format("ACCT: {4} -- {0}: {1} order for {2} [#{3}]", orderType, orderSide, instrument, retrials, ibAccountNumber);
     else
         return string.Format("ACCT: {5} -- {0}: {1} ({2}) order {3} [#{4}]", orderType, orderSide, info, instrument, retrials, ibAccountNumber);
 }
Example #26
0
        public readonly UnitType unitTypeBuild; // Nullable

        #endregion Fields

        #region Constructors

        public Order(OrderType orderType, Position targetPosition=null, Unit targetUnit=null, UnitType unitTypeBuild=null)
        {
            this.orderType = orderType;
            this.targetPosition = targetPosition;
            this.targetUnit = targetUnit;
            this.unitTypeBuild = unitTypeBuild;
        }
        public TableOrColumnName(IAstNode preNode, string originalValue)
            : base(preNode, originalValue)
        {
            // SQLが成立していないとき
            if (ParentNode == null || ParentNode.ParentNode == null)
            {
                Order = OrderType.Unknown;
                throw new Exception("SQLが成立していません");
            }

            // 定義の親がStatementでその親が予約語
            if (ParentNode.ParentNode.GetType() == typeof (ReservedTopLevel))
            {
                string reservedWord = ParentNode.ParentNode.OriginalValue;
                Match m = _regex.Match(reservedWord);
                if (m.Success)
                {
                    // FROMやUPDATEなど、カラム名称が定義されない予約語ならテーブル名
                    Order = OrderType.Table;
                }
                else
                {
                    // SELECT句やWHERE区ででてきたカラム定義
                    Order = OrderType.Column;
                }
            }
            else
            {
                // JOIN句など、予約語とは違うネスト階層により出現する定義
                Order = OrderType.Column;
            }
        }
        public async Task<TransactionExportResponse> GetNextOrder(OrderType orderType = OrderType.OutletToDistributor, DocumentStatus documentStatus = DocumentStatus.Closed)
        {
            HttpClient client = MiddlewareHttpClient;

            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            try
            {
                string urlSuffix = client.BaseAddress + "api/new/Integration/GetNextOrderToExport?username={0}&password={1}&orderType={2}&documentStatus={3}";

                string url = string.Format(urlSuffix, _userName,_otherUtilities.MD5Hash(_password), orderType, documentStatus);

                var response = client.GetAsync(url).Result;
                TransactionExportResponse _response = response.Content.ReadAsAsync<TransactionExportResponse>().Result;
                if (_response == null)
                {
                    return new TransactionExportResponse() { Success = false };
                }


                return _response;
            }
            catch (Exception ex)
            {
                return new TransactionExportResponse { Info = ex.Message };
            }
        }
Example #29
0
        static void AddPendingOrder(LiveOpenPositionsEditor openPositionData, Symbol symbol, string orderId, long size, DateTime submittedTime,
            OrderType orderType, TransactionType transactionType, double price, string customString)
        {
            if (openPositionData.PortfolioXml.PendingOrders.Any(o => o.OrderId == orderId))
            {
                //  Order already tracked
                return;
            }

            PositionType positionType = (transactionType == TransactionType.Buy || transactionType == TransactionType.Sell) ? PositionType.Long : PositionType.Short;

            //  This assumes there is just one position per symbol.  If this isn't the case then you will need to find a way of figuring out which
            //  position a pending order corresponds to.
            PositionDataXml position = openPositionData.PortfolioXml.Positions.FirstOrDefault(pos => pos.Symbol.Equals(symbol) && pos.PositionType == positionType);

            if (position == null)
            {
                //  No existing position, so create a new one
                position = openPositionData.AddPosition(symbol, positionType);
                position.CustomString = customString;
            }

            BrokerOrder brokerOrder = new BrokerOrder();
            if (orderType == OrderType.Limit || orderType == OrderType.LimitOnClose)
            {
                brokerOrder.LimitPrice = price;
            }
            else if (orderType == OrderType.Stop || orderType == OrderType.TrailingStop)
            {
                brokerOrder.StopPrice = price;
            }
            brokerOrder.CustomString = customString;

            TradeOrderXml tradeOrder = openPositionData.AddPendingOrder(position, brokerOrder, orderId, size, submittedTime, orderType, transactionType);
        }
        public override OrderProduct AddToCart(OrderType opType, int productId, int quantity, NameValueCollection paras)
        {
            SuitId = productId;
            int typecode;
            if (int.TryParse(paras["typecode"],out typecode))
            {
                typecode =0;
            }

            NoName.NetShop.Solution.BLL.SuiteBll sbll = new SuiteBll();
            SolutionProductBll spbll = new SolutionProductBll();

            SuiteModel smodel = sbll.GetModel(SuitId);

            List<SolutionProductModel> list = spbll.GetModelList(SuitId);

            this.OrderProducts.Clear();
            foreach (SolutionProductModel model in list)
            {
                OrderProduct op = OrderProductFactory.Instance().CreateOrderProduct(model.ProductId, model.Quantity, opType, paras);
                op.Key = this.Key + "_op" + this.GetSerial();
                op.Container = this;
                if (op != null)
                {
                    OrderProducts.Add(op);
                }
            }
            this.DerateFee = this.ProductSum - smodel.Price;
            _score = smodel.Score;

            return null;
        }
Example #31
0
 public OrderType Update(OrderType record)
 {
     return(this.repository.Update(record));
 }
Example #32
0
        public void PlaceOrderTest(string orderId, HttpStatusCode httpStatus, OrderStatus status, decimal quantity, decimal price, OrderType orderType)
        {
            var response = new
            {
                id        = BrokerId,
                fill_fees = "0.11"
            };

            SetupResponse(JsonConvert.SerializeObject(response), httpStatus);

            _unit.OrderStatusChanged += (s, e) =>
            {
                Assert.AreEqual(status, e.Status);
                if (orderId != null)
                {
                    Assert.AreEqual("BTCUSD", e.Symbol.Value);
                    Assert.That((quantity > 0 && e.Direction == OrderDirection.Buy) || (quantity < 0 && e.Direction == OrderDirection.Sell));
                    Assert.IsTrue(orderId == null || _unit.CachedOrderIDs.SelectMany(c => c.Value.BrokerId.Where(b => b == BrokerId)).Any());
                }
            };

            Order order;

            if (orderType == OrderType.Limit)
            {
                order = new LimitOrder(_symbol, quantity, price, DateTime.UtcNow);
            }
            else if (orderType == OrderType.Market)
            {
                order = new MarketOrder(_symbol, quantity, DateTime.UtcNow);
            }
            else
            {
                order = new StopMarketOrder(_symbol, quantity, price, DateTime.UtcNow);
            }

            var actual = _unit.PlaceOrder(order);

            Assert.IsTrue(actual || (orderId == null && !actual));
        }
        //This Wraps the target and resets the targeted ITEM to it's child BASECREATURE
        //Unfortunately, there is no accessible Array for a player's followers,
        //so we must use the GetMobilesInRage(int range) method for our reference checks!
        public override bool CheckTarget(Mobile from, Target targ, object targeted)
        {
            #region CheckEntity

            //Check to see if we have an Entity Link (Child BaseCreature)
            //If not, create one!
            //(Without Combatant Change, since this is for pets)

            PlayerMobile pm = from as PlayerMobile;

            if (pm != null)
            {
                if (m_Child != null && !m_Child.Deleted)
                {
                    m_Child.Update( );
                }
                else
                {
                    ProvideEntity( );

                    if (m_Child != null && !m_Child.Deleted)
                    {
                        m_Child.Update( );
                    }
                }
            }
            #endregion

            if (targ is AIControlMobileTarget && targeted == this)
            {
                //Wrap the target
                AIControlMobileTarget t = targ as AIControlMobileTarget;
                //Get the OrderType
                OrderType order = t.Order;

                //Search for our controlled pets within screen range
                foreach (Mobile m in from.GetMobilesInRange(16))
                {
                    if (!(m is BaseCreature))
                    {
                        continue;
                    }

                    BaseCreature bc = m as BaseCreature;

                    if (from != null && !from.Deleted && from.Alive)
                    {
                        if (bc == null || bc.Deleted || !bc.Alive || !bc.Controlled || bc.ControlMaster != from)
                        {
                            continue;
                        }

                        //Reset the pet's ControlTarget and OrderType.
                        bc.ControlTarget = m_Child;
                        bc.ControlOrder  = t.Order;
                    }
                }
            }

            return(base.CheckTarget(from, targ, targeted));
        }
Example #34
0
 public ApplyOrderWithPosition(OrderType orderType, Vec3 position)
 {
     this.OrderType = orderType;
     this.Position  = position;
 }
Example #35
0
 protected virtual Expression BindThenBy(Expression source, LambdaExpression orderSelector, OrderType orderType)
 {
     return(AsProjection(Visit(source)));
 }
Example #36
0
 public OrderType Insert(OrderType record)
 {
     return(this.repository.Insert(record));
 }
Example #37
0
 public void Delete(OrderType record)
 {
     this.repository.Delete(record);
 }
Example #38
0
 protected virtual Expression BindThenBy(Expression source, LambdaExpression orderSelector, OrderType orderType)
 {
     if (thenBys == null)
     {
         thenBys = new List <OrderExpression>();
     }
     thenBys.Add(new OrderExpression(orderType, orderSelector));
     return(Visit(source));
 }
Example #39
0
 public OrderForm(string ticker, float price, int volumen, string userId, DateTime transactionTime, OrderType transType)
 {
     Id              = Guid.NewGuid();
     Ticker          = ticker;
     Price           = price;
     Volumen         = volumen;
     UserId          = userId;
     TransactionTime = transactionTime;
     OrderType       = transType;
 }
Example #40
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="pInstrument"></param>
 /// <param name="pDirection"></param>
 /// <param name="pOffset"></param>
 /// <param name="pPrice"></param>
 /// <param name="pVolume"></param>
 /// <param name="pHedge"></param>
 /// <returns>正确返回0</returns>
 public int ReqOrderInsert(string pInstrument, DirectionType pDirection, OffsetType pOffset, double pPrice, int pVolume, HedgeType pHedge = HedgeType.Speculation, OrderType pType = OrderType.Limit, string pCustom = "HFapi")
 {
     return(_proxy.ReqOrderInsert(pInstrument, pDirection, pOffset, pPrice, pVolume, pHedge, pType, pCustom));
 }
Example #41
0
        /// <summary>
        /// 利用[ROW_NUMBER() over]分页,生成sql语句
        /// </summary>
        /// <param name="tableName">表名称『eg:Orders』</param>
        /// <param name="columns">需要显示列『*:所有列;或者:eg:OrderID,OrderDate,ShipName,ShipCountry』</param>
        /// <param name="orderColumn">依据排序的列『eg:OrderID』</param>
        /// <param name="sqlWhere">筛选条件『eg:Order=1』</param>
        /// <param name="orderType">升序降序『1:desc;其他:asc』</param>
        /// <param name="pSize">每页页数『需大于零』</param>
        /// <param name="pIndex">页数『从壹开始算』</param>
        /// <returns>生成分页sql脚本</returns>
        public static string JoinPageSQLByRowNumber(string tableName, string columns, string orderColumn, string sqlWhere, OrderType orderType, int pSize, int pIndex)
        {
            int    _pageStart = pSize * (pIndex - 1) + 1;
            int    _pageEnd   = pSize * pIndex + 1;
            string _sql       = string.Format(@"select {1} from (SELECT A.*, ROWNUM RN FROM (SELECT * FROM {0} order by {2} {3}) A ) WHERE RN BETWEEN {4} AND {5} "
                                              , tableName
                                              , columns
                                              , orderColumn
                                              , orderType == OrderType.Desc ? "desc" : "asc"
                                              , _pageStart
                                              , _pageEnd);

            _sql = SqlScriptBuilder.JoinQueryWhereSql(_sql, sqlWhere);
            _sql = SqlScriptBuilder.JoinQueryTotalSql(_sql, tableName);
            return(_sql);
        }
Example #42
0
 public Order(OrderType orderType, Session session) : base(session)
 {
     m_orderType = orderType;
     UserTracking.SetUserInfoGetter(m_userInfoGetter);
     InitContracts();
 }
Example #43
0
    public OrderType getOrderType()
    {
        OrderType ret = (OrderType)ContextModulePINVOKE.Order_getOrderType(swigCPtr);

        return(ret);
    }
Example #44
0
 public Task ListQuotes(OrderType order = OrderType.Keyword)
 => ListQuotes(1, order);
Example #45
0
 public bool IsOrderSubmitted(int userId, OrderType orderType)
 {
     return(_orderRepository
            .TableNoTracking
            .Any(c => c.UserId == userId && c.TypeId == (int)orderType && c.StatusId == (int)OrderStatus.Submitted));
 }
Example #46
0
 public void setOrderType(OrderType val)
 {
     ContextModulePINVOKE.Order_setOrderType(swigCPtr, (int)val);
 }
Example #47
0
        /// <summary>
        /// Determine if a symbol supports an order type.
        /// </summary>
        /// <param name="symbol"></param>
        /// <param name="orderType"></param>
        /// <returns></returns>
        public static bool IsSupported(this Symbol symbol, OrderType orderType)
        {
            Throw.IfNull(symbol, nameof(symbol));

            return(symbol.OrderTypes.Contains(orderType));
        }
Example #48
0
        public JsonResult Load(int pageIndex, int pageSize, string sort,
                               OrderType order, string controllerName, string actionName,
                               string requestMessage, string exception, string httpMethod, int application)
        {
            PageHelper.GetPageIndex(ref pageIndex);
            PageHelper.GetPageSize(ref pageSize);

            var tempErrors = ErrorInfoServices.LoadEntities(r => true);

            #region 查询
            if (!String.IsNullOrEmpty(controllerName))
            {
                tempErrors = tempErrors.Where(r => r.Controller.Contains(controllerName));
            }
            if (!String.IsNullOrEmpty(actionName))
            {
                tempErrors = tempErrors.Where(r => r.Action.Contains(actionName));
            }
            if (!String.IsNullOrEmpty(requestMessage))
            {
                tempErrors = tempErrors.Where(r => r.RequestMessage.Contains(requestMessage));
            }
            if (!String.IsNullOrEmpty(exception))
            {
                tempErrors = tempErrors.Where(r => r.Exception.Contains(exception));
            }
            if (!String.IsNullOrEmpty(httpMethod))
            {
                tempErrors = tempErrors.Where(r => r.HttpMethod.Equals(httpMethod, StringComparison.InvariantCultureIgnoreCase));
            }
            if (application > -1)
            {
                tempErrors = tempErrors.Where(r => r.ApplicationType == (ApplicationType)application);
            }
            #endregion
            #region 排序
            if ("AddTime".Equals(sort, StringComparison.InvariantCultureIgnoreCase))
            {
                tempErrors = Sort(tempErrors, r => r.AddTime, order).ThenBy(r => r.ID);
            }
            else
            {
                tempErrors = Sort(tempErrors, r => r.ID, order);
            }
            #endregion
            int totalCount = tempErrors.Count();
            var errors     = ErrorInfoServices
                             .LoadPageEntities(pageIndex, pageSize, tempErrors);

            int pageCount = PageHelper.GetPageCount(totalCount, pageSize);
            return(Json(new
            {
                total = totalCount,
                rows = errors.Select(m => new
                {
                    m.ID,
                    m.Head,
                    m.Controller,
                    m.Action,
                    m.HttpMethod,
                    m.IP,
                    m.Description,
                    m.RequestMessage,
                    m.ApplicationType,
                    m.Exception,
                    m.InnerException,
                    m.AddTime
                })
            }));
        }
 internal AddPhysicalTransactionCommand(Account account, PhysicalOrder openOrder, Price closePrice, OrderType orderType)
     : base(account, openOrder, closePrice, orderType, AddAutoCloseTransactionCommandVisitor.Default)
 {
 }
Example #50
0
 public Order GetOrder(int userId, OrderStatus status, OrderType type, bool inNearestBatch = true)
 {
     return(GetOrder(userId, new[] { status }, type, inNearestBatch));
 }
Example #51
0
        public async Task <IEnumerable <ProductListingModel> > All(Expression <Func <Product, bool> > wherePredicate, Expression <Func <Product, object> > orderPredicate, OrderType orderType, int take)
        {
            var products = _productRepository
                           .All()
                           .Where(p => !p.IsDeleted)
                           .AsQueryable();

            if (wherePredicate != null)
            {
                products = products.Where(wherePredicate);
            }

            products = products.Take(take).AsQueryable();
            return(await ListProducts(products, orderPredicate, orderType));
        }
Example #52
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="qrUser"></param>
        /// <param name="store"></param>
        /// <param name="TotalAmount">订单总金额</param>
        /// <param name="orderType">订单类型:大额/小额</param>
        /// <param name="AliPayAccount">支付宝账户</param>
        /// <param name="orderNum">是否有订单,没有费率则为全局费率</param>
        /// <param name="ui">如果用户被禁用,传入</param>
        /// <param name="QRHugeTrans"></param>
        /// <returns></returns>
        public EOrderInfo InitOrder(EQRUser qrUser, EStoreInfo store, EUserStore userStore, float TotalAmount, OrderType orderType, string AliPayAccount = "", int orderNum = 0, EUserInfo ui = null, EQRHugeTrans QRHugeTrans = null)
        {
            EOrderInfo order = new EOrderInfo()
            {
                OrderNo          = _handler.OrderNo,
                OrderStatus      = BaseEnum.OrderStatus.WaitingAliPayNotify,
                QRUserId         = qrUser.ID,
                AgentName        = qrUser.UserName,
                AgentOpenId      = qrUser.OpenId,
                TotalAmount      = TotalAmount,
                Rate             = qrUser.Rate,
                RateAmount       = (float)Math.Round(TotalAmount * (qrUser.Rate / 100), 2, MidpointRounding.AwayFromZero),
                TransDate        = DateTime.Now,
                TransDateStr     = DateTime.Now.ToString("yyyy-MM-dd HH:mm"),
                SellerAliPayId   = store.AliPayAccount,
                SellerStoreId    = store.ID,
                SellerName       = store.Name,
                SellerChannel    = store.Channel,
                SellerRate       = store.Rate,
                SellerCommission = (float)Math.Round(TotalAmount * (userStore.OwnerRate) / 100, 2, MidpointRounding.ToEven),
                OrderType        = orderType,

                BuyerMarketRate     = qrUser.MarketRate,
                BuyerTransferAmount = (float)Math.Round(TotalAmount * (100 - qrUser.MarketRate) / 100, 2, MidpointRounding.AwayFromZero),
                BuyerAliPayAccount  = AliPayAccount,

                //ReceiveNo = StringHelper.GenerateReceiveNo(),
            };

            if (QRHugeTrans != null)
            {
                order.EQRHugeTransId = QRHugeTrans.ID;

                //大单用户手续费
                order.BuyerTransferAmount -= (float)RuleManager.PayRule().User_ServerFee_HQ;
            }
            else
            {
                //double FOFeeRate = RuleManager.PayRule().Agent_FOFeeRate;
                //小单用户手续费
                //if(order.TotalAmount>=199)
                //    order.BuyerTransferAmount -= (float)RuleManager.PayRule().User_ServerFee_Q;
                order.BuyerTransferAmount -= (float)RuleManager.PayRule().User_ServerFee_Q;

                ////首单费率
                //if(orderNum == 0 && (qrUser.MarketRate-qrUser.Rate)< FOFeeRate)
                //    order.RateAmount = (float)Math.Round(TotalAmount * ((qrUser.MarketRate-FOFeeRate) / 100), 2, MidpointRounding.ToEven);

                if (ui.UserStatus == UserStatus.JustRegister)
                {
                    order.RateAmount = (float)Math.Round(TotalAmount * (0.5 / 100), 2, MidpointRounding.ToEven);
                }
            }


            return(order);
        }
Example #53
0
        private async Task <IEnumerable <ProductListingModel> > ListProducts(IQueryable <Product> products, Expression <Func <Product, object> > orderPredicate, OrderType orderType)
        {
            if (orderType == OrderType.Ascending)
            {
                products = products.OrderBy(orderPredicate);
            }
            else if (orderType == OrderType.Descending)
            {
                products = products.OrderByDescending(orderPredicate);
            }

            return(await products.ProjectTo <ProductListingModel>().ToListAsync());
        }
Example #54
0
 private bool OrderIsNostroOrLockInDisbursal(OrderType orderType)
 {
     return(orderType == OrderType.NostroPaymentOrder || orderType == OrderType.LockInDisbursalOrder);
 }
Example #55
0
 public OrderPhrase(string name, string table, OrderType orderType)
     : this(name, table, null, orderType)
 {
 }
Example #56
0
        public async Task <IEnumerable <ProductListingModel> > All(string category, Expression <Func <Product, object> > orderPredicate, OrderType orderType)
        {
            var categoryEntity = await _categoriesRepository.All().FirstOrDefaultAsync(c => c.Name.ToLower() == category.ToLower());

            if (categoryEntity == null)
            {
                throw new InvalidOperationException(string.Format(ServiceErrorsConstants.CategoryDoesNotExist, category));
            }

            var products = _productRepository
                           .All()
                           .Where(p => p.CategoryId == categoryEntity.Id && !p.IsDeleted)
                           .AsQueryable();

            return(await ListProducts(products, orderPredicate, orderType));
        }
Example #57
0
 public OrderTicket Order(Symbol symbol, int quantity, OrderType type)
 {
     return(Order(symbol, quantity));
 }
Example #58
0
 public OrderPhrase(string name, string table, string alias, OrderType orderType)
     : base(name, alias)
 {
     OrderType = orderType;
 }
Example #59
0
 public OrderTicket Order(Symbol symbol, decimal quantity, OrderType type)
 {
     return(Order(symbol, (int)quantity));
 }
Example #60
0
 private SubmitOrderRequest CreateSubmitOrderRequest(OrderType orderType, Security security, int quantity, string tag, decimal stopPrice = 0m, decimal limitPrice = 0m)
 {
     return(new SubmitOrderRequest(orderType, security.Type, security.Symbol, quantity, stopPrice, limitPrice, UtcTime, tag));
 }