Examples of Instrument


Examples of com.barchart.feed.api.model.meta.Instrument

  // ########################
 
  @Override
  public void make(final Message message) {

    final Instrument instrument = message.getInstrument();

    if (!isValid(instrument)) {
      return;
    }
View Full Code Here

Examples of com.barchart.feed.api.model.meta.Instrument

  // ######################## Make ########################

  @Override
  public void make(final Message message) {

    final Instrument instrument = message.getInstrument();

    if (!isValid(instrument)) {
      return;
    }

    MarketDo market = marketMap.get(instrument.id());

    final boolean valid = isValid(market);

    if(!valid) {
      register(instrument);
      market = marketMap.get(instrument.id());
    }

    market.runSafe(safeMake, message)

    /* Below is a hack to keep the subscriptions updated */
    /* If a new market is created, a new subscription is made,
     * but it needs the State enum from market which should
     * get set on the first market snapshot, which is why
     * this comes after the above safeRun update of the message */

    /* If the state hasn't been set, this will mark it as Delayed,
     * and we're not updating */
    Subscription.Lense lense;
    if(market.get(MarketField.STATE).contains(
        MarketStateEntry.IS_PUBLISH_REALTIME)) {
      lense = Subscription.Lense.REALTIME;
    } else if(market.get(MarketField.STATE).contains(
        MarketStateEntry.IS_PUBLISH_DELAYED)) {
      lense = Subscription.Lense.DELAYED;
    } else {
      lense = Subscription.Lense.NULL;
    }

    if(!valid) {
      log.debug("Adding Subscription to map for {}", instrument.symbol());
      varSubs.put(instrument.id(), new VarSubscription(instrument, lense));
      defSubs.put(instrument.id(), varSubs.get(instrument.id()));
    }

    varSubs.get(instrument.id()).setLense(lense);

  }
View Full Code Here

Examples of com.barchart.feed.api.model.meta.Instrument

            final Map<String, Type> newInterests = new HashMap<String, Type>();

            for (final Entry<String, List<Instrument>> e : instMap.entrySet()) {

              /* Currently assuming we're only getting one inst back */
              final Instrument i = e.getValue().get(0);

              if (!i.isNull()) {

                exInsts.remove(i);
                incInsts.add(i);

                /* We have to use an alternate symbol for options */
                final String symbol = i.symbol();
                if(symbol.contains("|")) {
                  newInterests.put(i.vendorSymbols().get(VendorID.BARCHART_SHORT), Type.INSTRUMENT);
                } else {
                  newInterests.put(formatForJERQ(i.symbol()), Type.INSTRUMENT);
                }

              } else {
                /* For all failed lookups, store symbol and attempt to match
                 * in the hasMatch method. */
 
View Full Code Here

Examples of com.barchart.feed.api.model.meta.Instrument

            final Map<String, Type> oldInterests = new HashMap<String, Type>();

            for (final Entry<String, List<Instrument>> e : instMap.entrySet()) {

              /* Currently assuming we're only getting one inst back */
              final Instrument i = e.getValue().get(0);

              if (!i.isNull()) {

                incInsts.remove(i);
                exInsts.add(i);

                /* We have to use an alternate symbol for options
                 * ...rolls eyes...
                 */
                final String symbol = i.symbol();
                if(symbol.contains("|")) {
                  oldInterests.put(i.vendorSymbols().get(VendorID.BARCHART_SHORT), Type.INSTRUMENT);
                } else {
                  oldInterests.put(formatForJERQ(i.symbol()), Type.INSTRUMENT);
                }

              } else {
                /*
                 * For all failed lookups, store symbol and attempt to match
View Full Code Here

Examples of com.barchart.feed.api.model.meta.Instrument

        default:
          // Ignore
          continue;
        case INSTRUMENT:

          final Instrument i = (Instrument)m;

          incInsts.add(i);
          exInsts.remove(i);

          /* We have to use an alternate symbol for options */
          final String symbol = i.symbol();
          if(symbol.contains("|")) {
            newInterests.put(i.vendorSymbols().get(VendorID.BARCHART_SHORT), Type.INSTRUMENT);
          } else {
            newInterests.put(formatForJERQ(i.symbol()), Type.INSTRUMENT);
          }

          continue;
        case EXCHANGE:
          incExchanges.add((Exchange)m);
View Full Code Here

Examples of com.barchart.feed.api.model.meta.Instrument

        default:
          // Ignore
          continue;
        case INSTRUMENT:

          final Instrument i = (Instrument)m;

          exInsts.add(i);
          incInsts.remove(i);

          /* We have to use an alternate symbol for options */
          final String symbol = i.symbol();
          if(symbol.contains("|")) {
            oldInterests.put(i.vendorSymbols().get(VendorID.BARCHART_SHORT), Type.INSTRUMENT);
          } else {
            oldInterests.put(formatForJERQ(i.symbol()), Type.INSTRUMENT);
          }

          continue;
        case EXCHANGE:
          exExchanges.add((Exchange)m);
View Full Code Here

Examples of com.barchart.feed.api.model.meta.Instrument

  }
 
  @Override
  public Market snapshot(final String symbol) {
   
    final Instrument inst = instrument(symbol).toBlockingObservable().first().results().get(symbol).get(0);
   
    if(inst.isNull()) {
      return Market.NULL;
    }
   
    return snapshot(inst);
  }
View Full Code Here

Examples of com.barchart.feed.api.model.meta.Instrument

    final List<Instrument> listInstrument = new ArrayList<Instrument>(
        listDocument.size());

    for (final Document doc : listDocument) {

      final Instrument instrument = CodecHelper
          .<TextValue> instrumentDecode(doc);

      listInstrument.add(instrument);

    }
View Full Code Here

Examples of com.barchart.feed.api.model.meta.Instrument

    final List<Instrument> listInstrument = new ArrayList<Instrument>(
        listDocument.size());

    for (final Document doc : listDocument) {

      final Instrument instrument = CodecHelper
          .<TextValue> instrumentDecode(doc);

      listInstrument.add(instrument);

    }
View Full Code Here

Examples of com.barchart.feed.api.model.meta.Instrument

  // ########################

  @Override
  public void make(final Message message) {

    final Instrument instrument = message.getInstrument();

    if (!isValid(instrument)) {
      return;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.