Beispiel #1
0
        /// <summary>
        /// /markets/{region_id}/orders/
        /// </summary>
        /// <param name="region_id"></param>
        /// <param name="order_type"></param>
        /// <param name="page"></param>
        /// <param name="type_id"></param>
        /// <returns></returns>
        public async Task <EsiResponse <List <Order> > > RegionOrders(
            int region_id,
            MarketOrderType order_type = MarketOrderType.All,
            int page    = 1,
            int?type_id = null)
        {
            var parameters = new List <string>()
            {
                $"order_type={order_type.ToEsiValue()}"
            };

            parameters.Add($"page={page}");

            if (type_id != null)
            {
                parameters.Add($"type_id={type_id}");
            }

            var response = await Execute <List <Order> >(_client, _config, RequestSecurity.Public, RequestMethod.GET, "/markets/{region_id}/orders/",
                                                         replacements : new Dictionary <string, string>()
            {
                { "region_id", region_id.ToString() }
            },
                                                         parameters : parameters.ToArray());

            return(response);
        }
Beispiel #2
0
        public static string OrderMarketError(MarketOrderType orderType, string message = "")
        {
            var result = string.IsNullOrWhiteSpace(message)
                ? string.Empty
                : $"=> {message}";

            return($"{orderType.GetDescription()} => ORDER => EXCHANGE => NOT SUCCEED {result}");
        }
Beispiel #3
0
        public static string StepMarketError(MarketOrderType orderType, decimal priceCurrent, decimal priceBase, string change)
        {
            var result = priceBase > 0
                ? $"=> DECREASED ({priceBase}) => by {change}"
                : string.Empty;

            return($"{orderType.GetDescription()} => CURRENT PRICE => ({priceCurrent}) {result}");
        }
        // 开仓
        public void OpenPosition(MarketOrderType marketType, double lastPrice, double priceDiff)
        {
            if (_orderLock || _status != HedgeStatus.WaitOpenPosition)
            {
                return;
            }

            _marketType = marketType;

            double      priceLimite = getOpenPrice(lastPrice, priceDiff);
            EnumBuySell dir         = getOpenPositionDir();

            _order = _st.SendOrder(_st.DefaultAccount, _future.ID, EnumMarket.期货, _future.ExchangeID,
                                   priceLimite, _volume, dir, EnumOpenClose.开仓, EnumOrderPriceType.市价,
                                   EnumOrderTimeForce.当日有效, EnumHedgeFlag.投机);

            _orderLock = true;
            _status    = HedgeStatus.WaitOpenOrderComplete;
            _openHitTimes++;

            _st.Print("===========》开仓:");
            OrderHelper.PrintOrderStatus(_st, _order);
        }
Beispiel #5
0
 public static string ExecuteMarketSuccess(MarketOrderType orderType, decimal bought)
 {
     return(bought == 0
         ? $"{orderType.GetDescription()} => PRICE => REACHED"
         : $"{orderType.GetDescription()} => PRICE => REACHED => BOUGHT => ({bought})");
 }
Beispiel #6
0
 public static string TradeResult(MarketOrderType orderType, BinanceOrderTrade order)
 => $"{orderType.GetDescription()} => TRADE ({order.TradeId}) => Price => {order.Price} => Quantity {order.Quantity} => Commission {order.Commission} ({order.CommissionAsset})";
Beispiel #7
0
 public static string OrderMarketSuccess(MarketOrderType orderType)
 => $"{orderType.GetDescription()} => ORDER => EXCHANGE => SUCCEED";
Beispiel #8
0
 public static string PriceMarketError(MarketOrderType orderType)
 => $"{orderType.GetDescription()} => ORDER => EXCHANGE => NOT PLACED";
Beispiel #9
0
 public static string PriceMarketSuccess(MarketOrderType orderType)
 => $"{orderType.GetDescription()} => ORDER => EXCHANGE => PLACED";
Beispiel #10
0
 public static string Off(MarketOrderType orderType)
 => $"{orderType.GetDescription()} => OFF";
Beispiel #11
0
 public static string NotificationTitle(WorkingType workingType, MarketOrderType marketOrderType, string symbol)
 => $"[{workingType.GetDescription()}] => {marketOrderType.GetDescription()} [{symbol}]";
Beispiel #12
0
 /// <summary>Get orders in a Region (First Page)</summary>
 /// <param name="RegionID">(Int32) Region ID</param>
 /// <param name="TypeID">(Int32) Type ID</param>
 /// <param name="OrderType">(MarketOrderType) Market Order Type</param>
 /// <param name="Page">(Int32) Page number</param>
 /// <returns>EsiRequest</returns>
 public EsiRequest GetRegionOrders(int RegionID, int?TypeID, MarketOrderType OrderType, int Page)
 {
     return(GetRegionOrders(RegionID, TypeID, OrderType.Value, Page));
 }
Beispiel #13
0
 public List <Order> GetOrders(int regionID, MarketOrderType orderType, int page, int?typeID, out int?pages)
 {
     return(DownloadData(Settings.EsiClient.Market.RegionOrders(regionID, orderType, page, typeID), out pages));
 }
Beispiel #14
0
 public static string TradeResultKucoin(MarketOrderType orderType, KucoinOrder order, decimal price)
 => $"{orderType.GetDescription()} => TRADE ({order.Id}) => Price => {price} => Quantity {order.DealQuantity.ToKucoinRound()} => Commission {order.Fee.ToKucoinRound()} ({order.FeeCurrency})";
Beispiel #15
0
 public static string ExecuteMarketError(MarketOrderType orderType, decimal bought)
 => $"{orderType.GetDescription()} => PRICE => NOT REACHED => bought price ({bought})";
Beispiel #16
0
 public static string StepMarketSuccess(MarketOrderType orderType, decimal priceCurrent, decimal priceBase, string change)
 => $"{orderType.GetDescription()} => CURRENT PRICE => ({priceCurrent}) => INCREASED ({priceBase}) => by {change}";