当前位置: 首页>>代码示例>>Java>>正文


Java Issue类代码示例

本文整理汇总了Java中com.ripple.core.coretypes.Issue的典型用法代码示例。如果您正苦于以下问题:Java Issue类的具体用法?Java Issue怎么用?Java Issue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Issue类属于com.ripple.core.coretypes包,在下文中一共展示了Issue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: rippleMultiPathfindPublisher

import com.ripple.core.coretypes.Issue; //导入依赖的package包/类
@Bean
public RippleMultiPathfindPublisher rippleMultiPathfindPublisher() {

	List<Pair<Issue, Issue>> listExchanges = RippleArbitragerPathfindPublisher.parseExchanges(exchanges);
	// TODO check #
	HashMap<String, Double> listAmounts = RippleArbitragerPathfindPublisher
			.parseExchangeAmountsFromProperties(exchangesAmounts);
	Pathfind pathfind1 = new Pathfind(rippleAccount, rippleAccount,
			listAmounts.get(listExchanges.get(0).getValue0().toString()), listExchanges.get(0).getValue0(),
			listExchanges.get(0));
	Pathfind pathfind2 = new Pathfind(rippleAccount, rippleAccount,
			listAmounts.get(listExchanges.get(0).getValue1().toString()), listExchanges.get(0).getValue1(),
			listExchanges.get(0));

	List<Pathfind> list = new ArrayList<>();
	list.add(pathfind1);
	list.add(pathfind2);

	return new RippleMultiPathfindPublisher(list);
}
 
开发者ID:mileschet,项目名称:ripple-marketmaker,代码行数:21,代码来源:ArbitragerApplication.java

示例2: findPathfindFromBaseAssetCurrency

import com.ripple.core.coretypes.Issue; //导入依赖的package包/类
public JSONObject findPathfindFromBaseAssetCurrency(JSONArray alts, Issue sourceIssue) throws JSONException {
	int altsLength = alts.length();
	for (int x = 0; x < altsLength; x++) {
		JSONObject j = alts.getJSONObject(x);
		JSONObject sourceAmount = j.optJSONObject("source_amount");

		if (sourceAmount != null) {
			String currency = sourceAmount.getString("currency");
			if (currency.equals(sourceIssue.currency().toString())) {
				return j;
			}
		}
	}
	return null;

}
 
开发者ID:mileschet,项目名称:ripple-marketmaker,代码行数:17,代码来源:RippleArbitragerPathfindPublisher.java

示例3: createOfferBid

import com.ripple.core.coretypes.Issue; //导入依赖的package包/类
public OfferCreate createOfferBid(double takerGetsBid, double bid, List<Pair<Double, Double>> rangeBids,
		int[] rangeCounBids) throws InvalidCipherTextException, JSONException, IOException {
	OfferCreate offer = null;
	double takerPaysBid = takerGetsBid / bid;
	double myOfferPriceBid = takerGetsBid / takerPaysBid;
	int idx = getOfferPrinceRange(myOfferPriceBid, rangeBids);
	if (idx != -1 && rangeCounBids[idx] < 1) {
		log.info("CreateOffer Bid " + myOfferPriceBid + " in Range " + rangeBids.get(idx));
		offer = createOffer(account(), Issue.fromString(counterAsset), Issue.fromString(baseAsset),
				new BigDecimal(takerGetsBid, new MathContext(5)), new BigDecimal(takerPaysBid, new MathContext(5)),
				false);
		// opportunityBids.put(offer.toJSON());
	} else {
		log.info("Opportunity not in range: myOfferPriceBid " + myOfferPriceBid + " bid " + bid + " takerPaysBid "
				+ takerPaysBid + " takerGetsBid " + takerGetsBid + " Idx " + idx + " rangeBids " + rangeBids);
	}

	return offer;
}
 
开发者ID:mileschet,项目名称:ripple-marketmaker,代码行数:20,代码来源:RippexLiquidityMakerListener.java

示例4: createOfferAsk

import com.ripple.core.coretypes.Issue; //导入依赖的package包/类
public OfferCreate createOfferAsk(double takerGetsAsk, double ask, List rangeAsks, int[] rangeCountAsks) throws InvalidCipherTextException, JSONException, IOException {
	OfferCreate offer = null;
	double takerPaysAsk = takerGetsAsk * ask;
	double myOfferPriceAsk = takerPaysAsk / takerGetsAsk;
	int idx = getOfferPrinceRange(myOfferPriceAsk, rangeAsks);
	if (idx != -1 && rangeCountAsks[idx] < 1) {
		log.info("CreateOffer Ask " + myOfferPriceAsk + " in Range " + rangeAsks.get(idx));
		offer = createOffer(account(), Issue.fromString(baseAsset), Issue.fromString(counterAsset),
				new BigDecimal(takerGetsAsk, new MathContext(5)), new BigDecimal(takerPaysAsk, new MathContext(5)),
				true);
		// opportunityAsks.put(offer.toJSON());
	} else {
		log.info("Opportunity not in range: myOfferPriceAsk " + myOfferPriceAsk + " ask " + ask + " takerPaysAsk "
				+ takerPaysAsk + " takerGetsAsk " + takerGetsAsk + " Idx " + idx + " rangeAsks " + rangeAsks);
	}

	return offer;
}
 
开发者ID:mileschet,项目名称:ripple-marketmaker,代码行数:19,代码来源:RippexLiquidityMakerListener.java

示例5: requestBookOffers

import com.ripple.core.coretypes.Issue; //导入依赖的package包/类
public void requestBookOffers(final Number ledger_index,
                              final Issue get,
                              final Issue pay,
                              final Manager<ArrayList<Offer>> cb) {
    makeManagedRequest(Command.book_offers, cb, new Request.Builder<ArrayList<Offer>>() {
        @Override
        public void beforeRequest(Request request) {
            request.json("taker_gets", get.toJSON());
            request.json("taker_pays", pay.toJSON());

            if (ledger_index != null) {
                request.json("ledger_index", ledger_index);
            }
        }
        @Override
        public ArrayList<Offer> buildTypedResponse(Response response) {
            ArrayList<Offer> offers = new ArrayList<Offer>();
            JSONArray offersJson = response.result.getJSONArray("offers");
            for (int i = 0; i < offersJson.length(); i++) {
                JSONObject jsonObject = offersJson.getJSONObject(i);
                STObject object = STObject.fromJSONObject(jsonObject);
                offers.add((Offer) object);
            }
            return offers;
        }
    });
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:28,代码来源:Client.java

示例6: subscribeBookOffers

import com.ripple.core.coretypes.Issue; //导入依赖的package包/类
public Request subscribeBookOffers(Issue get, Issue pay,int limit) {
    Request request = newRequest(Command.subscribe);
    JSONObject book = new JSONObject();
    JSONArray books = new JSONArray(new Object[] { book });
    book.put("snapshot", true);
    book.put("taker_gets", get.toJSON());
    book.put("taker_pays", pay.toJSON());
    book.put("limit", limit);
    request.json("books", books);
    
    return request;
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:13,代码来源:Client.java

示例7: createBookBase

import com.ripple.core.coretypes.Issue; //导入依赖的package包/类
private static Hash256 createBookBase(Issue pays, Issue gets) {
    return prefixed256(LedgerSpace.bookDir)
            .add(pays.currency())
            .add(gets.currency())
            .add(pays.issuer())
            .add(gets.issuer())
            .finish();
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:9,代码来源:Index.java

示例8: requestUpdate

import com.ripple.core.coretypes.Issue; //导入依赖的package包/类
public void requestUpdate() {
    for (int i = 0; i < 2; i++) {
        final boolean getAsks = i == 0,
                getBids = !getAsks;

        Issue getIssue = getAsks ? first : second,
                payIssue = getAsks ? second : first;

        Request request = client.requestBookOffers(getIssue, payIssue);
        request.once(Request.OnResponse.class, new Request.OnResponse() {
            @Override
            public void called(Response response) {
                if (response.succeeded) {
                    JSONArray offersJSON = response.result.optJSONArray("offers");
                    System.out.println(offersJSON);
                    STArray offers = STArray.translate.fromJSONArray(offersJSON);
                    if (getBids) bids = offers;
                    else asks = offers;

                    if (retrievedBothBooks()) {
                        if (!isEmpty()) {
                            calculateStats();
                        }
                        callback.onUpdate(OrderBookPair.this);
                    }
                } else {
                    System.out.println("There was an error: " + response.message);
                }
            }
        });
        request.request();
    }

}
 
开发者ID:mileschet,项目名称:ripple-marketmaker,代码行数:35,代码来源:OrderBookPair.java

示例9: Pathfind

import com.ripple.core.coretypes.Issue; //导入依赖的package包/类
public Pathfind(JSONObject json) {
	this.setPathFrom(json.getString("pathFrom"));
	this.setPathTo(json.getString("pathTo"));
	this.setBaseAsset(Issue.fromString(json.getString("baseAsset")));
	this.setAmount(json.getDouble("amount"));
	this.setResult(json);
}
 
开发者ID:mileschet,项目名称:ripple-marketmaker,代码行数:8,代码来源:Pathfind.java

示例10: parseExchanges

import com.ripple.core.coretypes.Issue; //导入依赖的package包/类
public static List<Pair<Issue, Issue>> parseExchanges(String exchanges) {
	String[] e = exchanges.split(",");
	List<Pair<Issue, Issue>> listPair = new ArrayList<>();
	for (int i = 0; i < e.length; i++) {
		if (!e[i].startsWith("#")) {
			String[] paths = e[i].split("/");
			Issue issue1 = Issue.fromString(paths[0] + "/" + paths[1]);
			Issue issue2 = Issue.fromString(paths[2] + "/" + paths[3]);
			Pair<Issue, Issue> pair = new Pair<Issue, Issue>(issue1, issue2);
			listPair.add(pair);
		}
	}
	return listPair;
}
 
开发者ID:mileschet,项目名称:ripple-marketmaker,代码行数:15,代码来源:RippleArbitragerPathfindPublisher.java

示例11: parsePathfinds

import com.ripple.core.coretypes.Issue; //导入依赖的package包/类
public static Pair<Pathfind, Pathfind> parsePathfinds(String exchanges, Double deepness, String rippleAccount,
		String rippleAccount2) {
	List<Pair<Issue, Issue>> listExchanges = RippleArbitragerPathfindPublisher.parseExchanges(exchanges);
	Pathfind pathfind1 = createPathfind(deepness, rippleAccount, listExchanges.get(0).getValue1(), listExchanges);
	Pathfind pathfind2 = createPathfind(deepness, rippleAccount, listExchanges.get(0).getValue0(), listExchanges);
	return new Pair<Pathfind, Pathfind>(pathfind1, pathfind2);
}
 
开发者ID:mileschet,项目名称:ripple-marketmaker,代码行数:8,代码来源:RippleArbitragerPathfindPublisher.java

示例12: createPathfind

import com.ripple.core.coretypes.Issue; //导入依赖的package包/类
private static Pathfind createPathfind(Double deepness, String rippleAccount, Issue baseAsset,
		List<Pair<Issue, Issue>> listExchanges) {
	Pathfind pathfind = new Pathfind();
	pathfind.setPathFrom(rippleAccount);
	pathfind.setPathTo(rippleAccount);
	pathfind.setIssues(listExchanges.get(0));
	pathfind.setAmount(deepness);
	pathfind.setBaseAsset(listExchanges.get(0).getValue0());

	return pathfind;
}
 
开发者ID:mileschet,项目名称:ripple-marketmaker,代码行数:12,代码来源:RippleArbitragerPathfindPublisher.java

示例13: isOfferAsk

import com.ripple.core.coretypes.Issue; //导入依赖的package包/类
public static boolean isOfferAsk(OfferCreate offer, String baseAsset) {
	String base = Issue.fromString(baseAsset).currency().toString();

	if (baseAsset.equals(offer.takerGets().currency().toString())) {
		return true;
	}
	return false;

}
 
开发者ID:mileschet,项目名称:ripple-marketmaker,代码行数:10,代码来源:RippleAccountOffersPublisher.java

示例14: publish

import com.ripple.core.coretypes.Issue; //导入依赖的package包/类
public void publish() {

		if (this.getIssue == null || this.payIssue == null) {
			return;
		}

		for (int i = 0; i < 2; i++) {
			final boolean getAsks = i == 0, getBids = !getAsks;

			Issue getIssue = getAsks ? this.payIssue : this.getIssue,
					payIssue = getAsks ? this.getIssue : this.payIssue;

			Request request = client().requestBookOffers(getIssue, payIssue);
			request.once(Request.OnResponse.class, new Request.OnResponse() {
				@Override
				public void called(Response response) {
					if (response.succeeded) {
						log.info(getAsks == true ? "ASK " : "BID " + response.result.toString());
						JSONArray offersJSON = response.result.optJSONArray("offers");
						STArray offers = STArray.translate.fromJSONArray(offersJSON);
						if (getAsks) {
							offerBook.setOffersBids(offersJSON);
						} else {
							offerBook.setOffersAsks(offersJSON);
						}

						if (offerBook.retrievedBothBooks()) {
							template.convertAndSend(Channels.OFFERBOOK, offerBook.toJSONObject().toString());
						}
					} else {
						log.error("Error processing OfferBook.");
					}
				}
			});
			request.request();
		}

	}
 
开发者ID:mileschet,项目名称:ripple-marketmaker,代码行数:39,代码来源:RippleOfferBookPublisher.java

示例15: publishAll

import com.ripple.core.coretypes.Issue; //导入依赖的package包/类
public void publishAll() {
	Set<Pair<Issue, Issue>> keySet = listValues.keySet();
	for (Iterator<Pair<Issue, Issue>> iterator = keySet.iterator(); iterator.hasNext();) {
		Pair<Issue, Issue> pair = iterator.next();
		publish(pair.getValue0(), pair.getValue1());
	}
}
 
开发者ID:mileschet,项目名称:ripple-marketmaker,代码行数:8,代码来源:RippleArbitragerOfferBookPublisher.java


注:本文中的com.ripple.core.coretypes.Issue类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。