use of suite.smtp.SmtpSsl in project suite by stupidsing.
the class DailyMain method run.
private boolean run() {
Trade_.blackList = Union.of(Trade_.blackList, blackList);
var sellPool = "sellpool";
var ymd = HkexUtil.getCloseTimeBefore(Time.now()).ymd();
var td = ymd + "#";
// perform systematic trading
var results = //
Read.each(//
alloc(bacs.pair_bb, 66666f), //
alloc("bug", bacs.bac_sell, 0f), //
alloc(bacs.pair_donchian, 100000f), //
alloc(bacs.pair_ema, 0f), //
mamr(50000f), //
alloc(bacs.pair_pmamr, 150000f), //
alloc(bacs.pair_pmamr2, 366666f), //
alloc(bacs.pair_pmmmr, 80000f), //
alloc(bacs.pair_revco, 0f), //
alloc(bacs.pair_tma, 0f), alloc(sellPool, bacs.bac_sell, 0f));
// unused strategies
if (Boolean.FALSE) {
alloc(bacs.pair_donchian, 100000f);
pairs(0f, "0341.HK", "0052.HK");
sellForEarn(sellPool);
}
var sbs = Summarize.of(cfg).summarize(trade -> trade.strategy);
var strategyTrades = //
results.concatMap2(//
result -> Read.from(result.trades).map2(trade -> result.strategy, trade -> trade)).filterValue(//
trade -> trade.buySell != 0).collect();
var requestTrades = strategyTrades.filterKey(strategy -> !Equals.string(strategy, sellPool));
var amounts = strategyTrades.values().collect(LiftDbl.of(Trade::amount));
var buys_ = amounts.filter(amount -> 0d < amount).sum();
var sells = amounts.filter(amount -> amount < 0d).sum();
sb.append(//
sbs.log + "\n" + //
sbs.pnlByKey + //
"\nBUY REQUESTS" + //
requestTrades.filterValue(//
trade -> 0 < trade.buySell).sortByValue(//
Trade::compare).map((strategy, t) -> //
"" + Trade.of(td, -t.buySell, t.symbol, t.price, sellPool).record() + //
"\n" + //
Trade.of(td, +t.buySell, t.symbol, t.price, strategy).record()) + //
"\n" + //
"\nSELL REQUESTS" + //
requestTrades.filterValue(//
trade -> trade.buySell < 0).sortByValue(//
Trade::compare).map((strategy, t) -> //
"" + Trade.of(td, +t.buySell, t.symbol, t.price, strategy).record() + //
"\n" + //
Trade.of(td, -t.buySell, t.symbol, t.price, sellPool).record()) + //
"\n" + "\nTOTAL BUYS_ = " + //
To.string(buys_) + "\nTOTAL SELLS = " + //
To.string(sells) + //
"\n" + //
"\nSUGGESTIONS" + //
"\n- check your balance" + "\n- sell mamr and " + //
sellPool + "\n");
var result = sb.toString().replace(".0\t", "\t");
Log_.info(result);
new SmtpSsl().send(null, getClass().getName(), result);
return true;
}
Aggregations