Пример #1
0
 public static Stock getEmptyStock(Code code, Symbol symbol)
 {
     return new Stock(code,
                         symbol,
                         "",
                         Stock.Board.Unknown,
                         Stock.Industry.Unknown,
                         0.0,
                         0.0,
                         0.0,
                         0.0,
                         0.0,
                         0,
                         0.0,
                         0.0,
                         0,
                         0.0,
                         0,
                         0.0,
                         0,
                         0.0,
                         0,
                         0.0,
                         0,
                         0.0,
                         0,
                         0.0,
                         0,
                         new SimpleDate()
                         );
 }
Пример #2
0
 public Stock(
     Code code,
     Symbol symbol,
     String name,
     Board board,
     Industry industry,
     double prevPrice,
     double openPrice,
     double lastPrice,
     double highPrice,
     double lowPrice,
     // TODO: CRITICAL LONG BUG REVISED NEEDED.
     long volume,
     double changePrice,
     double changePricePercentage,
     int lastVolume,
     double buyPrice,
     int buyQuantity,
     double sellPrice,
     int sellQuantity,
     double secondBuyPrice,
     int secondBuyQuantity,
     double secondSellPrice,
     int secondSellQuantity,
     double thirdBuyPrice,
     int thirdBuyQuantity,
     double thirdSellPrice,
     int thirdSellQuantity,
     SimpleDate calendar
     )
 {
     this.code = code;
     this.symbol = symbol;
     this.name = name;
     this.board = board;
     this.industry = industry;
     this.prevPrice = prevPrice;
     this.openPrice = openPrice;
     this.lastPrice = lastPrice;
     this.highPrice = highPrice;
     this.lowPrice = lowPrice;
     this.volume = volume;
     this.changePrice = changePrice;
     this.changePricePercentage = changePricePercentage;
     this.lastVolume = lastVolume;
     this.buyPrice = buyPrice;
     this.buyQuantity = buyQuantity;
     this.sellPrice = sellPrice;
     this.sellQuantity = sellQuantity;
     this.secondBuyPrice = secondBuyPrice;
     this.secondBuyQuantity = secondBuyQuantity;
     this.secondSellPrice = secondSellPrice;
     this.secondSellQuantity = secondSellQuantity;
     this.thirdBuyPrice = thirdBuyPrice;
     this.thirdBuyQuantity = thirdBuyQuantity;
     this.thirdSellPrice = thirdSellPrice;
     this.thirdSellQuantity = thirdSellQuantity;
     this.calendar = calendar;
 }
 public StockHistoryServer getStockHistoryServer(Code code, Duration duration)
 {
     try
     {
         return new YahooStockHistoryServer(country, code, duration);
     }
     catch (StockHistoryNotFoundException exp)
     {
         log.Error(null, exp);
         return null;
     }
 }
 public StockHistoryServer getStockHistoryServer(Code code)
 {
     try
     {
         return new SingaporeYahooStockHistoryServer(country, code);
     }
     catch (StockHistoryNotFoundException exp)
     {
         log.Error(null, exp);
         return null;
     }
 }
 public SingaporeYahooStockHistoryServer(Country country, Code code, Duration duration)
     : base(country, code, duration)
 {
 }
 public SingaporeYahooStockHistoryServer(Country country, Code code)
     : base(country, code)
 {
 }
Пример #7
0
 /**
  * Returns name based on the code.
  * @param code The code
  * @return name based on the code. <code>null</code> will be returned if
  * no match found.
  */
 public String codeToName(Code code)
 {
     return _codeToName[code];
 }
 public BrazilYahooStockHistoryServer(Country country, Code code, Duration duration)
     : base(country, code, duration)
 {
 }
 public BrazilYahooStockHistoryServer(Country country, Code code)
     : base(country, code)
 {
 }
Пример #10
0
 public Builder(Code code, Symbol symbol)
 {
     this._code = code;
     this._symbol = symbol;
 }
Пример #11
0
 // I didn't make this construcotr private. As I would like to make user able
 // to construct Stock either through this constructor or Builder.
 public Stock(Stock stock)
 {
     this.code = stock.code;
     this.symbol = stock.symbol;
     this.name = stock.name;
     this.board = stock.board;
     this.industry = stock.industry;
     this.prevPrice = stock.prevPrice;
     this.openPrice = stock.openPrice;
     this.lastPrice = stock.lastPrice;
     this.highPrice = stock.highPrice;
     this.lowPrice = stock.lowPrice;
     this.volume = stock.volume;
     this.changePrice = stock.changePrice;
     this.changePricePercentage = stock.changePricePercentage;
     this.lastVolume = stock.lastVolume;
     this.buyPrice = stock.buyPrice;
     this.buyQuantity = stock.buyQuantity;
     this.sellPrice = stock.sellPrice;
     this.sellQuantity = stock.sellQuantity;
     this.secondBuyPrice = stock.secondBuyPrice;
     this.secondBuyQuantity = stock.secondBuyQuantity;
     this.secondSellPrice = stock.secondSellPrice;
     this.secondSellQuantity = stock.secondSellQuantity;
     this.thirdBuyPrice = stock.thirdBuyPrice;
     this.thirdBuyQuantity = stock.thirdBuyQuantity;
     this.thirdSellPrice = stock.thirdSellPrice;
     this.thirdSellQuantity = stock.thirdSellQuantity;
     this.calendar = stock.calendar;
 }
 public Stock getStock(Code code)
 {
     Code newCode = Utils.toYahooFormat(code, this.country);
     return getStock(Symbol.newInstance(newCode.toString()));
 }
 /**
  * Returns stock history server for this factory based on given code and
  * duration. <code>null</code> will be returned if fail.
  *
  * @param code the code
  * @param duration the duration
  * @return stock history server for this factory based on given code and
  * duration. <code>null</code> will be returned if fail
  */
 public StockHistoryServer getStockHistoryServer(Code code, Duration duration)
 {
     return null;
 }
 /**
  * Returns stock history server for this factory based on given code. <code>
  * null</code> will be returned if fail.
  *
  * @param code the code
  * @return stock history server for this factory based on given code. <code>
  * null</code> will be returned if fail
  */
 public StockHistoryServer getStockHistoryServer(Code code)
 {
     return null;
 }
Пример #15
0
        public static Code toYahooFormat(Code code, Country country)
        {
            if (code == null)
            {
                throw new ArgumentException("Method parameters cannot be null in toYahooFormat");
            }

            Code result = code;

            if (country == Country.Malaysia)
            {
                String _code = code.toString();
                // Index's code start with ^. We will not intrude index's code.
                if (_code.StartsWith("^") == false && _code.EndsWith(".KL") == false)
                {
                    // This is not index's code, and it does not end with .KL.
                    // Let's intrude it!
                    result = Code.newInstance(_code + ".KL");
                }
            }

            return result;
        }