@Override
  public void execute(
      LocalManagerApiContext context,
      LtApi api,
      UUID sessionId,
      Collection<LocalTraderEventSubscriber> subscribers) {

    try {
      // Call function
      api.acceptTrade(sessionId, _tradeSessionId, _tradeSessionTimestamp).getResult();

      // Notify
      synchronized (subscribers) {
        for (final LocalTraderEventSubscriber s : subscribers) {
          s.getHandler()
              .post(
                  new Runnable() {

                    @Override
                    public void run() {
                      s.onLtTradeSessionAccepted(_tradeSessionId, AcceptTrade.this);
                    }
                  });
        }
      }

    } catch (LtApiException e) {
      // Handle errors
      context.handleErrors(this, e.errorCode);
    }
  }
Beispiel #2
0
  @Override
  public void execute(
      LocalManagerApiContext context,
      LtApi api,
      UUID sessionId,
      Collection<LocalTraderEventSubscriber> subscribers) {

    try {

      // Call function
      final List<PriceFormula> list = api.getSupportedPriceFormulas(sessionId).getResult();

      // Notify
      synchronized (subscribers) {
        for (final LocalTraderEventSubscriber s : subscribers) {
          s.getHandler()
              .post(
                  new Runnable() {

                    @Override
                    public void run() {
                      s.onLtPriceFormulasFetched(list, GetPriceFormulas.this);
                    }
                  });
        }
      }

    } catch (LtApiException e) {
      // Handle errors
      context.handleErrors(this, e.errorCode);
    }
  }