@Override protected Value<String> toDatastore(final BigMoney value) { return StringValue.of(value.toString()); } }
@Override public String toNonNullString(BigMoney value) { return value.toString(); }
@Override public Object forDatastore(Object value, ConverterSaveContext ctx) { if (value instanceof BigMoney) return ((BigMoney) value).toString(); else return null; }
@Override public String toNonNullString(BigMoney value) { return value.toString(); }
@Override public String toNonNullString(BigMoney value) { return value.toString(); }
/** * Gets the monetary value as a string. * <p> * The format is the 3 letter ISO currency code, followed by a space, * followed by the amount as per {@link BigDecimal#toPlainString()}. * * @return the string representation of this monetary value, never null */ @Override @ToString public String toString() { return money.toString(); }
log.debug("{} BTC Balance: {}",exchangeName,balanceBTC.toString()); }else { log.error("ERROR: {} BTC Balance is null.",exchangeName); log.debug("Max. BTC: {}",maxBTC.toString()); }else { log.error("ERROR: Max. BTC is null"); log.debug("Min. BTC: {}",minBTC.toString()); }else { log.error("ERROR: Min. BTC is null"); log.info("{} was more than the configured limit of {}",qtyToSell.withScale(8,RoundingMode.HALF_EVEN).toString(),maxBTC.toString()); log.info("Reducing {} order size to {}",exchangeName,maxBTC.toString()); qtyToSell = maxBTC; log.info("{} was less than the configured limit of {}",qtyToSell.withScale(8,RoundingMode.HALF_EVEN).toString(),minBTC.toString()); log.info("Trend following trade agent has decided that there is not enough {} momentum to trade at this time.",localCurrency.getCode()); } else if (Application.getInstance().getArbMode()) { log.info(exchangeName + "Trend following trade agent is attempting to sell {} of {} available",qtyToSell.withScale(8,RoundingMode.HALF_EVEN).toString(),balanceBTC.toString()); marketOrder(qtyToSell.getAmount(),OrderType.ASK);
log.debug("{} Local Balance: {}",exchangeName,balanceLocal.toString()); }else { log.error("ERROR: {} Local Balance is null",exchangeName); log.debug("Max. Local: {}",maxLocal.toString()); }else { log.error("ERROR: Max. Local is null"); log.debug("Min. Local: {}",minLocal.toString()); }else { log.error("ERROR: Min. Local is null"); log.info(qtyToBuy.withScale(8,RoundingMode.HALF_EVEN).toString() +" was more than the configured maximum of "+maxLocal.toString()+". Reducing " + exchangeName + "order size to "+maxLocal.toString()); qtyToBuy = maxLocal; log.info("{} was less than the configured minimum of {}",qtyToBuy.withScale(8,RoundingMode.HALF_EVEN).toString() ,minLocal.toString()); log.info("{} Trend following trade agent has decided that there is not enough {} momentum to trade at this time.",exchangeName,localCurrency.getCode()); } else if (Application.getInstance().getArbMode()) { log.info("{} was less than the configured limit of {}",qtyBTCToBuy.withScale(8,RoundingMode.HALF_EVEN).toString(),minBTC.toString()); log.info("{} Trend following trade agent has decided that there is not enough {} momentum to trade at this time.",exchangeName,localCurrency.getCode()); } else {
BigDecimal oneDivTo = BigDecimal.ONE.divide(lastTickBidTo.getAmount(),16,RoundingMode.HALF_EVEN); log.debug("Last ticker Ask price was "+lastTickAskFrom.toString()); log.debug("BTC/"+from.getCurrencyUnit().toString()+" is "+oneDivFrom.toString()); log.debug("Last ticker Bid price was "+lastTickBidTo.toString()); log.debug("BTC/"+to.getCurrencyUnit().toString()+" is "+oneDivTo.toString()); MarketOrder sellOrder = new MarketOrder(OrderType.ASK,qtyToBTC.getAmount(),"BTC",to.getCurrencyUnit().toString()); log.debug(exchangeName+" Arbitrage buy order is buy "+qtyFromBTC.toString()+" for "+qtyFrom.toString()); log.debug(exchangeName+" Arbitrage sell order is sell "+qtyToBTC.toString()+" for "+qtyTo.toString()); log.info("Arbitrage sold "+qtyFrom.withScale(8,RoundingMode.HALF_EVEN).toString() +" for "+ qtyFromBTC.withScale(8,RoundingMode.HALF_EVEN).toString()+" on "+exchangeName); if(!Application.getInstance().getSimMode()){ marketsellOrderReturnValue = tradeService.placeMarketOrder(sellOrder); log.info("Arbitrage bought "+qtyTo.withScale(8,RoundingMode.HALF_EVEN).toString() +" for "+ qtyToBTC.withScale(8,RoundingMode.HALF_EVEN).toString()+" on "+exchangeName); log.info("Arbitrage successfully traded "+qtyFrom.toString()+" for "+qtyTo.toString()+" on "+exchangeName); log.info(AccountManager.getInstance(exchangeName).getAccountInfo().toString()); ProfitLossAgent.getInstance().calcProfitLoss(); } else { log.error("ERROR: Sell failed. Arbitrage could not trade "+qtyFrom.toString()+" with "+qtyTo.toString()+" on "+exchangeName); log.error("ERROR: Buy failed. Arbitrage could not trade "+qtyFrom.toString()+" with "+qtyTo.toString()+" on "+exchangeName); log.info("Arbitrage could not trade with a balance of "+qtyFrom.toString()+" on "+exchangeName);
str.append(exchangeName + ":- "); str.append("Long SMA: "); str.append(smaLong.toString()); str.append(" | "); str.append("Short SMA: "); str.append(smaShort.toString()); log.debug(str.toString()); log.debug(exchangeName + "Current bid price of {} is above the VWAP of {}",currentBid.toString(),vwap.toString()); str.append(" up."); } else if (currentAsk.isLessThan(vwap)) { tradeIndicator.put("VWAPCross_Down",true); log.debug(exchangeName + "Current ask price of {} is below the VWAP of {}",currentAsk.toString(),vwap.toString()); str.append(" down."); } else { str.append(exchangeName + ": "); str.append("Long MACD: "); str.append(macdLong.withScale(8,RoundingMode.HALF_EVEN).toString()); str.append(" | "); str.append("Short MACD: "); str.append(macdShort.withScale(8,RoundingMode.HALF_EVEN).toString()); str.append(" | "); str.append("MACD Line: "); str.append(macdLine.withScale(8,RoundingMode.HALF_EVEN).toString()); str.append(" | "); str.append("MACD Signal Line: "); str.append(macdSigLine.withScale(8,RoundingMode.HALF_EVEN).toString()); log.debug(str.toString());
profitPercent = profitBTC.getAmount().divide(equivBTCStartBal.getAmount(),16,RoundingMode.HALF_EVEN); String profitToDisplay = percentFormat.format(profitPercent); log.info("Equivalent BTC Start Balance: "+equivBTCStartBal.withScale(8,RoundingMode.HALF_EVEN).toString()+" Equivalent BTC Current Balance: "+equivBTCEndBal.withScale(8,RoundingMode.HALF_EVEN).toString()); log.info("BTC Profit/Loss: "+profitBTC.withScale(8,RoundingMode.HALF_EVEN).toString()+" Percentage Profit/Loss: "+profitToDisplay);