Ejemplo n.º 1
0
 protected virtual bool PlaceBid(double rate, double amount)
 {
     if (!DemoMode && Ticker.Buy(rate, amount) == null)
     {
         Log(LogType.Error, "Place Bid " + GetRateAmountString(rate, amount) + " failed.");
         return(false);
     }
     Log(LogType.Success, "Place Bid " + GetRateAmountString(rate, amount) + " succeded.");
     return(true);
 }
        protected virtual TradingResult PlaceBid(double rate, double amount)
        {
            TradingResult res = null;

            if (!DemoMode)
            {
                res = Ticker.Buy(rate, amount);
                if (res == null)
                {
                    Log(LogType.Error, "", rate, amount, StrategyOperation.LimitBuy);
                }
                return(res);
            }
            else
            {
                res = AddDemoTradingResult(rate, amount, OrderType.Buy);
            }
            Log(LogType.Success, "", rate, amount, StrategyOperation.LimitBuy);
            return(res);
        }
        protected virtual TradingResult MarketBuy(Ticker ticker, double rate, double amount)
        {
            TradingResult res = null;

            if (!DemoMode)
            {
                res = ticker.Buy(rate, amount);
                if (res == null)
                {
                    Log(LogType.Error, "", rate, amount, StrategyOperation.MarketBuy);
                }
                return(res);
            }
            else
            {
                res = AddDemoTradingResult(ticker, rate, amount, OrderType.Buy);
            }
            TradeHistory.Add(res);
            Log(LogType.Success, ticker.Name, rate, amount, StrategyOperation.MarketBuy);
            return(res);
        }