private void AddOrderByToRequest() { if (!(_OrderBy == OrderByType.Relevance && _OrderDirection == OrderDirection.Descending)) { _request.AddParameter("OrderBy".ToLower(), _OrderBy.ToString()); _request.AddParameter("OrderDirection".ToLower(), _OrderDirection.ToString()); } }
private static string ConvertOrderDirection(OrderDirection orderDirection) { if (orderDirection == OrderDirection.Buy || orderDirection == OrderDirection.Sell) { return(orderDirection.ToString().ToLower()); } throw new NotSupportedException($"BitfinexBrokerage.ConvertOrderDirection: Unsupported order direction: {orderDirection}"); }
public void AddColumn(string columnName, OrderDirection direction) { string temp = columnName + " " + direction.ToString().ToLower(); if (!this.Columns.Contains(temp)) { this.Columns.Add(temp); } }
public static string ToDescriptionString(this OrderDirection val) { DescriptionAttribute[] attributes = (DescriptionAttribute[])val .GetType() .GetField(val.ToString()) .GetCustomAttributes(typeof(DescriptionAttribute), false); return(attributes.Length > 0 ? attributes[0].Description : string.Empty); }
/// <summary> /// Lädt eine Liste mit Touren. Es werden nur "Header"-Daten ausgegeben. /// </summary> public GetTourenResult GetTouren(int start = 0, int limit = 100, int[] status = null, string orderBy = "Nummer", OrderDirection orderDirection = OrderDirection.Desc) { string url = URL.NormalizeUrl() + "/server/api/REST/v1/tour" + "?start=" + start + "&limit=" + limit + "&status=" + (status != null ? string.Join(",", status.Select(p => p.ToString())) : "") + "&orderBy=" + orderBy + "&orderDirection=" + orderDirection.ToString("G").ToLower(); return(Get <GetTourenResult>(url)); }
public override string ToString() { if (IsGroup) { return(string.Join(", ", Group)); } ValidateColumn(); string[] column = Column.Replace("[", "[[").Replace("]", "]]").Split('.'); string columnName = column.Length > 1 ? "[" + column[0] + "].[" + column[1] + "]" : "[" + Column.Replace("[", "[[").Replace("]", "]]") + "]"; return(string.Format($"{columnName} {OrderDirection.ToString()}")); }
public virtual IEnumerable <T> GetAll <Q>(Expression <Func <T, Q> > expression = null, OrderDirection direction = OrderDirection.Asc) { var query = $"select * from [{typeof(T).Name}]"; if (expression != null) { var member = expression.Body as MemberExpression; var prop = member.Member as PropertyInfo; var name = prop.Name; query += $" order by {name} {direction.ToString()}"; } return(Connection.Query <T>(query)); }
/** * Orders the set based on the expression. * * ```cs * var orderedEntities = Models.Foo * .OrderBy(e => e.Bar, OrderDirection.DESC) * .OrderBy(e => e.Baz, OrderDirection.ASC); * ``` * * > NOTE: ASC is the default direction, if not supplied. */ public Linq <TModel> OrderBy(Expression <Func <TModel, object> > predicate, OrderDirection direction = OrderDirection.ASC) { MemberExpression member; if (predicate.Body.GetType() == typeof(UnaryExpression)) { var unary = (UnaryExpression)predicate.Body; member = (MemberExpression)unary.Operand; } else { member = (MemberExpression)predicate.Body; } return(this.OrderBy ( new SqlId(member.Member.Name).Value + " " + direction.ToString(), new object[] {} )); }
/// <summary> /// Represents the position. /// </summary> public override string ToString() { string orderd = ""; string NL = Environment.NewLine; orderd += "Number " + (ordNumb + 1).ToString() + NL; orderd += "Direction " + ordDir.ToString() + NL; orderd += "Type " + ordType.ToString() + NL; orderd += "Condition " + ordCond.ToString() + NL; orderd += "Status " + ordStatus.ToString() + NL; orderd += "Sender " + ordSender.ToString() + NL; orderd += "Origin " + ordOrigin.ToString() + NL; orderd += "If order " + (ordIF + 1).ToString() + NL; orderd += "To pos " + (ordPos + 1).ToString() + NL; orderd += "Lots " + ordLots.ToString() + NL; orderd += "Price " + ordPrice.ToString() + NL; orderd += "Price2 " + ordPrice2.ToString() + NL; orderd += "Note " + ordNote.ToString() + NL; return(orderd); }
/// <summary> /// Returns stringified version of the supplied OrderDirection. /// </summary> /// <param name="direction">The direction of the order.</param> /// <returns> /// Returns a stringified OrderDirection for the API. /// </returns> protected string getDirection(OrderDirection direction) { string sDirection = ""; switch (direction) { case OrderDirection.Buy: sDirection = "buy"; break; case OrderDirection.Sell: sDirection = "sell"; break; default: throw new NotImplementedException("Direction \"" + direction.ToString() + "\" not implemented."); } return(sDirection); }
public static string GetKey(string accountId, string instrument, OrderDirection?direction) => $"{accountId}_{instrument ?? ""}_{direction?.ToString() ?? ""}";
/// <summary> /// Sets order parameter on request. /// </summary> /// <param name="direction"></param> /// <returns></returns> public virtual T Order(OrderDirection direction) { _uriBuilder.SetQueryParam("order", direction.ToString().ToLower()); return(this as T); }
/// <summary> /// /// </summary> /// <param name="orderEvent"></param> public override void OnOrderEvent(OrderEvent orderEvent) { decimal fees = 0m; decimal lastTradeProfit = 0m; decimal holdingProfit = 0m; base.OnOrderEvent(orderEvent); if (orderEvent.Status == OrderStatus.Filled) { var fillprice = orderEvent.FillPrice; var fillquantity = orderEvent.FillQuantity; var amount = orderEvent.FillPrice * orderEvent.FillQuantity; OrderDirection direction = orderEvent.Direction; var orderid = Portfolio.Transactions.LastOrderId; var fpbuy = ""; var fpsell = ""; if (direction == OrderDirection.Buy) { fpbuy = fillprice.ToString(CultureInfo.InvariantCulture); } else { fpsell = fillprice.ToString(CultureInfo.InvariantCulture); } foreach (SecurityHolding holding in Portfolio.Values) { fees = holding.TotalFees - _totalFees; lastTradeProfit = holding.LastTradeProfit; holdingProfit = holding.Profit; _totalFees = holding.TotalFees; _holdingcost = holding.HoldingsCost; } var order = Transactions.GetOrderById(orderEvent.OrderId); var dt = order.Time; var quantity = Portfolio[symbol].Quantity; if (direction.ToString() == "Buy") { amount += fees; } else { amount += fees; } #region Scottrade //string transmsg = string.Format( // "{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15}", // symbol, // fillquantity, // fillprice, // direction.ToString(), // dt, // dt.AddDays(4), // 0, // amount, // fees, // 0, // "60505104", // actionNameUs + " share of " + _symbol + "at $" + fillprice.ToString(), // actionid, // orderEvent.OrderId, // "Trade", // "taxlot" // ); //mylog.Debug(transmsg); #endregion string logmsg = string.Format( "{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{22},{23},{24}", symbol, dt, barcount, "", "", "", "", "", "", "", "", "", direction.ToString(), fillquantity, fillprice, amount, fees, _holdingcost, holdingProfit, lastTradeProfit, Portfolio.Invested, _ROCSign, _nearMin, _nearMax, "" ); mylog.Debug(logmsg); } }