Package com.barchart.feed.base.values.api

Examples of com.barchart.feed.base.values.api.PriceValue


      /* value of a future contract / stock share */
      final String pricePointString = xmlStringDecode(ats, PRICE_POINT_VALUE,  XML_PASS);
      if(pricePointString == null || pricePointString.isEmpty()) {
        builder.setContractPointValue(buildDecimal(0,0));
      } else {
        PriceValue pricePoint = ValueBuilder.newPrice(Double
            .valueOf(pricePointString));
        builder.setContractPointValue(buildDecimal(
            pricePoint.mantissa(), pricePoint.exponent()));
      }
     
      /* display fraction base : decimal(10) vs binary(2), etc. */
      builder.setDisplayBase((int)frac.fraction.base());
      builder.setDisplayExponent(frac.fraction.exponent());
 
View Full Code Here


        break;
      }
      final SizeValue size = LIMIT;
      // TODO ValueConverter
      final Price tempStep = instrument.tickSize();
      final PriceValue step = ValueBuilder.newPrice(tempStep.mantissa(),
          tempStep.exponent());

      final VarBookDDF varBook = new VarBookDDF(instrument, type, size, step);
      final VarBookTopDDF varBookTop = new VarBookTopDDF(varBook);
View Full Code Here

  }
 
  @Override
  public PriceValue priceGap() {

    final PriceValue priceBid = priceTop(Book.Side.BID);
    if (priceBid.isNull()) {
      return ValueConst.NULL_PRICE;
    }

    final PriceValue priceAsk = priceTop(Book.Side.ASK);
    if (priceAsk.isNull()) {
      return ValueConst.NULL_PRICE;
    }

    return priceAsk.sub(priceBid);

  }
View Full Code Here

    MarketCuvol cuvol = get(CUVOL);

    if (cuvol.isFrozen()) {

      final PriceValue priceStep = ValueBuilder.newPrice(
          instrument.tickSize().mantissa(),
          instrument.tickSize().exponent());

      if(priceStep.mantissa() == 0) {
        System.out.println();
      }

      final VarCuvol varCuvol = new VarCuvol(instrument, priceStep);
      final VarCuvolLast varCuvolLast = new VarCuvolLast(varCuvol);
View Full Code Here

      }

      final SizeValue size = LIMIT; // inst.get(BOOK_SIZE);

      // ValueConverter
      final PriceValue step = ValueBuilder.newPrice(
          instrument.tickSize().mantissa(),
          instrument.tickSize().exponent());

      final VarBook varBook = new VarBook(instrument, type, size, step);
      final VarBookLast varBookLast = new VarBookLast(varBook);
View Full Code Here

  }

  protected final boolean isValidPrice(final PriceValue price) {

    //TODO Value Converter
    final PriceValue priceStep = ValueBuilder.newPrice(
        instrument.tickSize().mantissa(),
        instrument.tickSize().exponent());

    if (!price.equalsScale(priceStep)) {
      log.error("not normalized");
      return false;
    }

    final long count = price.count(priceStep);

    final PriceValue priceTest = priceStep.mult(count);

    if (!price.equals(priceTest)) {
      log.error("does not fit step");
      return false;
    }
View Full Code Here

    final DDF_ParamType param = message.getParamType();
    final TimeValue time = message.getTime();
    final TimeValue date = message.getTradeDay().tradeDate();
    final DDF_Session ddfSession = message.getSession();

    final PriceValue price;
    final SizeValue size;

    switch (param.kind) {

      default:
View Full Code Here

    final TimeValue time = message.getTime();

    /** Update top of book */
    {

      final PriceValue priceBid = message.getPriceBid();
      final PriceValue priceAsk = message.getPriceAsk();

      final MarketDoBookEntry entryBid = new DefBookEntry(
          MODIFY, Book.Side.BID,
          Book.Type.DEFAULT, ENTRY_TOP, priceBid, ValueConst.NULL_SIZE);
      final MarketDoBookEntry entryAsk = new DefBookEntry(
          MODIFY, Book.Side.ASK,
          Book.Type.DEFAULT, ENTRY_TOP, priceAsk, ValueConst.NULL_SIZE);

      applyTop(entryBid, time, market);
      applyTop(entryAsk, time, market);

    }

    final PriceValue settle = message.getPriceSettle();
    BooleanValue settled = null;

    // Check settled flag
    if (isClear(settle)) {
      settled = ValueConst.FALSE_BOOLEAN;
View Full Code Here

    market.clearChanges();

    final TimeValue date = message.getTradeDay().tradeDate();

    final PriceValue settle = message.getPriceSettle();
    BooleanValue settled = null;

    // Check settled flag
    if (settle == DDF_ClearVal.PRICE_CLEAR) {
      settled = ValueConst.FALSE_BOOLEAN;
View Full Code Here

    final TimeValue time = message.getTime();
    final TimeValue date = message.getTradeDay().tradeDate();
    final DDF_Session ddfSession = message.getSession();

    PriceValue price = message.getPrice();
    SizeValue size = message.getSize();

    if (isClear(price) || isEmpty(price)) {
      price = ValueConst.NULL_PRICE;
      size = ValueConst.NULL_SIZE;
View Full Code Here

TOP

Related Classes of com.barchart.feed.base.values.api.PriceValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.