Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="base_name">The type of trading base-currency of which information you want to query for.</param>
        /// <param name="quote_name">The type of trading quote-currency of which information you want to query for.</param>
        /// <param name="quantity">amount of coin</param>
        /// <param name="price">price of coin</param>
        /// <param name="sideType">type of buy(bid) or sell(ask)</param>
        /// <param name="args">Add additional attributes for each exchange</param>
        /// <returns></returns>
        public virtual async Task <MyOrder> CreateMarketOrder(string base_name, string quote_name, decimal quantity, decimal price, SideType sideType, Dictionary <string, object> args = null)
        {
            var _result = new MyOrder(base_name, quote_name);

            var _market = await publicApi.LoadMarket(_result.marketId);

            if (_market.success == true)
            {
                tradeClient.ExchangeInfo.ApiCallWait(TradeType.Private);

                _result.result = new MyOrderItem
                {
                    timestamp   = CUnixTime.NowMilli,
                    orderType   = OrderType.Market,
                    sideType    = sideType,
                    orderStatus = OrderStatus.Unknown,
                    quantity    = quantity,
                    price       = price,
                    amount      = quantity * price
                };

                _result.SetFailure("not supported yet", ErrorCode.NotSupported);
                _result.supported = false;
            }
            else
            {
                _result.SetResult(_market);
            }

            return(await Task.FromResult(_result));
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="base_name">The type of trading base-currency of which information you want to query for.</param>
        /// <param name="quote_name">The type of trading quote-currency of which information you want to query for.</param>
        /// <param name="order_id">Order number registered for sale or purchase</param>
        /// <param name="quantity">amount of coin</param>
        /// <param name="price">price of coin</param>
        /// <param name="sideType">type of buy(bid) or sell(ask)</param>
        /// <param name="args">Add additional attributes for each exchange</param>
        /// <returns></returns>
        public virtual async Task <MyOrder> CancelOrder(string base_name, string quote_name, string order_id, decimal quantity, decimal price, SideType sideType, Dictionary <string, object> args = null)
        {
            var _result = new MyOrder(base_name, quote_name);

            var _currency_id = await publicApi.LoadCurrencyId(base_name);

            if (_currency_id.success == true)
            {
                tradeClient.ExchangeInfo.ApiCallWait(TradeType.Private);

                _result.result = new MyOrderItem
                {
                    orderId  = order_id,
                    quantity = quantity,
                    price    = price,
                    amount   = quantity * price,
                    sideType = sideType
                };

                _result.SetFailure("not supported yet", ErrorCode.NotSupported);
                _result.supported = false;
            }
            else
            {
                _result.SetResult(_currency_id);
            }

            return(await Task.FromResult(_result));
        }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="base_name">The type of trading base-currency of which information you want to query for.</param>
        /// <param name="quote_name">The type of trading quote-currency of which information you want to query for.</param>
        /// <param name="order_id">Order number registered for sale or purchase</param>
        /// <param name="args">Add additional attributes for each exchange</param>
        /// <returns></returns>
        public virtual async Task <MyOrder> FetchMyOrder(string base_name, string quote_name, string order_id = "", Dictionary <string, object> args = null)
        {
            var _result = new MyOrder(base_name, quote_name);

            var _currency_id = await publicApi.LoadCurrencyId(base_name);

            if (_currency_id.success == true)
            {
                tradeClient.ExchangeInfo.ApiCallWait(TradeType.Private);

                _result.result = new MyOrderItem();

                _result.SetFailure("not supported yet", ErrorCode.NotSupported);
                _result.supported = false;
            }
            else
            {
                _result.SetResult(_currency_id);
            }

            return(await Task.FromResult(_result));
        }