Package com.barchart.util.values.api

Examples of com.barchart.util.values.api.SizeValue


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

    final DDF_ParamType.Kind kind = param.kind;

    final PriceValue price;
    final SizeValue size;

    switch (kind) {
    default:
      log.error("wrong kind; treat as size : {}", kind);
    case SIZE:
View Full Code Here


  public Void visit(final DDF_MarketSession message, final MarketDo market) {

    // ### process session

    // TODO are these trade fields?
    final SizeValue sizeLast = message.getSizeLast();
    final TimeValue timeLast = message.getTimeLast();

    // ### process snapshot

    final DDF_MarketSnapshot snapshot = message;
View Full Code Here

      final PriceValue priceOpen = message.getPriceOpen();
      final PriceValue priceHigh = message.getPriceHigh();
      final PriceValue priceLow = message.getPriceLow();
      final PriceValue priceClose = message.getPriceLast(); // XXX
      final PriceValue priceSettle = message.getPriceSettle();
      final SizeValue sizeVolume = message.getSizeVolume();

      applyBar(bar, MarketBarField.OPEN, priceOpen);
      applyBar(bar, MarketBarField.HIGH, priceHigh);
      applyBar(bar, MarketBarField.LOW, priceLow);
      applyBar(bar, MarketBarField.CLOSE, priceClose);
      applyBar(bar, MarketBarField.SETTLE, priceSettle);
      applyBar(bar, MarketBarField.VOLUME, sizeVolume);

      bar.set(MarketBarField.BAR_TIME, time);

      market.setBar(type, bar);

    }

    /** Update PREVIOUS bar */
    {

      final MarketBarType type = PREVIOUS;

      final MarketDoBar bar = market.loadBar(type.field);
      final PriceValue priceOpen = message.getPriceOpen();
      final PriceValue priceHigh = message.getPriceHigh();
      final PriceValue priceLow = message.getPriceLow();
      final PriceValue priceClose = message.getPriceLastPrevious();
      final PriceValue priceSettle = message.getPriceSettle();
      final SizeValue sizeVolume = message.getSizeVolumePrevious();
      final SizeValue sizeInterest = message.getSizeInterest(); // XXX

      applyBar(bar, MarketBarField.OPEN, priceOpen);
      applyBar(bar, MarketBarField.HIGH, priceHigh);
      applyBar(bar, MarketBarField.LOW, priceLow);
      applyBar(bar, MarketBarField.CLOSE, priceClose);
View Full Code Here

    final PriceValue priceOpen = message.getPriceOpen();
    final PriceValue priceHigh = message.getPriceHigh();
    final PriceValue priceLow = message.getPriceLow();
    final PriceValue priceClose = message.getPriceLast(); // XXX note: LAST
    final PriceValue priceSettle = message.getPriceSettle();
    final SizeValue sizeVolume = message.getSizeVolume();
    final SizeValue sizeInterest = message.getSizeInterest();

    // apply

    applyBar(bar, MarketBarField.OPEN, priceOpen);
    applyBar(bar, MarketBarField.HIGH, priceHigh);
View Full Code Here

    case TRADE: {

      // message "27" : normal trade

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

      // TODO review contract on how to clean partial values
      if (isClear(price) || isEmpty(price)) {
        price = ValueConst.NULL_PRICE;
        size = ValueConst.NULL_SIZE;
View Full Code Here

      case COMBINED:
        type = Book.Type.COMBINED;
        break;
      }

      final SizeValue size = LIMIT; // inst.get(BOOK_SIZE);
     
      // ValueConverter
      final PriceValue step = ValueBuilder.newPrice(
          instrument.tickSize().mantissa(),
          instrument.tickSize().exponent());
View Full Code Here

    } else {

      // ### volume

      final SizeValue volumeOld = bar.get(VOLUME);
      final SizeValue volumeNew = volumeOld.add(size);
      bar.set(VOLUME, volumeNew);
      eventAdd(NEW_VOLUME);

      // ### high
View Full Code Here

        break;
      case COMBINED:
        type = Book.Type.COMBINED;
        break;
      }
      final SizeValue size = LIMIT;
      // TODO ValueConverter
      final Price tempStep = instrument.tickSize();
      final PriceValue step = ValueBuilder.newPrice(tempStep.mantissa(),
          tempStep.exponent());
View Full Code Here

  public final void add(final PriceValue price, final SizeValue size) {

    assert price != null;
    assert size != null;

    SizeValue volume = map.get(price);

    if (volume == null) {
      volume = size;
    } else {
      volume = volume.add(size);
    }

    map.put(price, volume);

    priceLast = price;
View Full Code Here

  public final DefCuvol freeze() {

    final SizeValue[] entries = entries();

    for (int k = 0; k < entries.length; k++) {
      SizeValue volume = entries[k];
      if (volume == null) {
        volume = ValueConst.NULL_SIZE;
      }
      entries[k] = volume.freeze();
    }

    final DefCuvol that = new DefCuvol(instrument, entries,
        priceFirst(), priceStep());
View Full Code Here

TOP

Related Classes of com.barchart.util.values.api.SizeValue

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.