美文网首页
交易笔记

交易笔记

作者: 帅气的昵称lc | 来源:发表于2019-11-16 18:15 被阅读0次

private static final StringKEY_CNY = WConstant.CURRENCY_CNY +"_" WConstant.CURRENCY_ISSUE;

private static final StringKEY_SWT = WConstant.CURRENCY_SWT +"_" +"";

case "offernew":

mTvType.setText(getResources().getString(R.string.tv_offernew));

String getsCur =mTransactions.getGets().getCurrency() +"_" +mTransactions.getGets().getIssuer();

String paysCur =mTransactions.getPays().getCurrency() +"_" +mTransactions.getPays().getIssuer();

String getsAmount ="0";

String paysAmount ="0";

if (mTransactions.getEffects() !=null) {

mEffects =mTransactions.getEffects();

for (int i =mEffects.size() -1; i >=0; i--) {

JSONObject effect =mEffects.getJSONObject(i);

pays = effect.getJSONObject("paid");

gets = effect.getJSONObject("got");

String effectType = effect.getString("effect");

Log.i("effectTYpe",effectType);

if (!TextUtils.equals(effectType,"offer_cancelled") &&

!TextUtils.equals(effectType,"offer_created")) {

if (pays !=null && gets !=null) {

Log.i("pays",pays.toJSONString());

Log.i("gets",gets.toJSONString());

String currency = pays.getString("currency") +"_" + pays.getString("issuer");

String paysCount = pays.getString("value");

if (TextUtils.equals(currency, paysCur)) {

paysAmount = CaclUtil.add(paysAmount, paysCount);

}

Log.i("payAmount",paysAmount);

currency = gets.getString("currency") +"_" + gets.getString("issuer");

String getsCount = gets.getString("value");

if (TextUtils.equals(currency, getsCur)) {

getsAmount = CaclUtil.add(getsAmount, getsCount);

}

Log.i("getAmount",getsAmount);

}else {

Log.i("effectTYpe11111",effectType);

mEffects.remove(i);

}

}

}

if (mEffects !=null &&mEffects.size() >0) {

mRecyclerView.setVisibility(View.VISIBLE);

}

Log.i("getAmount",getsAmount);

// 成交

        if (!TextUtils.isEmpty(getsAmount) && CaclUtil.compare(getsAmount,"0") !=0 &&

!TextUtils.isEmpty(paysAmount) && CaclUtil.compare(paysAmount,"0") !=0) {

mLayoutTurnoverAmount.setVisibility(View.VISIBLE);

mTvTurnoverContent.setText(formatHtml(CaclUtil.formatAmount(paysAmount,SCALE), paysCur, CaclUtil.formatAmount(getsAmount,SCALE), getsCur));

// 成交价格

            String price;

String token;

if (TextUtils.equals(KEY_CNY, getsCur)) {

price = amountRatio(getsAmount, paysAmount);

token = WConstant.CURRENCY_CNT;

}else if (TextUtils.equals(KEY_CNY, paysCur)) {

price = amountRatio(paysAmount, getsAmount);

token = WConstant.CURRENCY_CNT;

}else if (TextUtils.equals(KEY_SWT, getsCur)) {

price = amountRatio(getsAmount, paysAmount);

token = WConstant.CURRENCY_SWTC;

}else {

price = amountRatio(paysAmount, getsAmount);

token = paysCur.split("_")[0];

}

if (!TextUtils.equals("0", price)) {

mLayoutTurnoverValue.setVisibility(View.VISIBLE);

mTvTurnoverValue.setText(CaclUtil.formatAmount(price,6));

mTvTurnoverValueToken.setText(token);

}

}

// 委托

        String getsValue =mTransactions.getGets().getValue();

String paysValue =mTransactions.getPays().getValue();

mLayoutEntrustAmount.setVisibility(View.VISIBLE);

mTvEntrustContent.setText(formatHtml(CaclUtil.formatAmount(paysValue,SCALE), paysCur, CaclUtil.formatAmount(getsValue,SCALE), getsCur));

// 委托价格

        String price;

String token;

if (TextUtils.equals(KEY_CNY, getsCur)) {

price = amountRatio(getsValue, paysValue);

token = WConstant.CURRENCY_CNT;

}else if (TextUtils.equals(KEY_CNY, paysCur)) {

price = amountRatio(paysValue, getsValue);

token = WConstant.CURRENCY_CNT;

}else if (TextUtils.equals(KEY_SWT, getsCur)) {

price = amountRatio(getsValue, paysValue);

token = WConstant.CURRENCY_SWTC;

}else {

price = amountRatio(paysValue, getsValue);

token = paysCur.split("_")[0];

}

if (!TextUtils.equals("0", price)) {

mLayoutValue.setVisibility(View.VISIBLE);

mTvValue.setText(CaclUtil.formatAmount(price,6));

mTvValueToken.setText(token);

}

mFrom = currentAddr;

mTvFrom.setText(mFrom);

}

相关文章

  • 交易笔记47

    《K均交易法》笔记二:笔记更多关注的是关于文中的交易理念,而非其交易系统,更多的是需要关注让自己的心不难受,云淡风...

  • 交易笔记

    private static final StringKEY_CNY = WConstant.CURRENCY_C...

  • 交易笔记

    交易标的通过的下跌,反弹到了压力位,次季依然高于现货,至于下跌原因不用费力搜寻,目前交易量的幅度较大,反应的是多空...

  • 万建峰老师的听课笔记 余梦承

    笔记工具—幕布 努力不求回报,交易必求超值

  • 万建峰老师的听课笔记 任佳敏

    笔记工具—幕布 努力不求回报,交易必求超值

  • 交易笔记84

    读书笔记摘抄 盈利期望E大于0才有交易价值,交易前先算算自己的策略达到了没有。 初始本金,风险暴露,盈利期望,交易...

  • 交易笔记62

    读书笔记摘抄: 过度交易是交易者常犯的错误之一。过度交易不但不能帮你赚钱,还会快速亏光你的账户资金。过度交易可能会...

  • 交易笔记42

    知乎笔记摘抄: 提高认知和改掉不良习惯,比完善交易系统重要的多,如果你把频繁交易,抄底摸顶,重仓交易,情绪化交易这...

  • 交易笔记|修炼交易心法

    高低点,代表着大多数人的预期,根据高低点来行动,就是跟随大多数人的预期。交易市场,就是多空双方大军的战役,你永远跟...

  • 交易笔记|技术交易指标

    不管做股票,还是做期货、贵金属、外汇交易,对于技术派而言,技术指标都是很重要的。 主要分为趋势指标和震荡指标。但是...

网友评论

      本文标题:交易笔记

      本文链接:https://www.haomeiwen.com/subject/imoyictx.html