Skip to content

Commit 205bacc

Browse files
committed
cleanup
1 parent 9610701 commit 205bacc

File tree

3 files changed

+8
-23
lines changed

3 files changed

+8
-23
lines changed

packages/api-binance/src/helper/holdUSDT.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,12 @@ export const createHoldUSDT = (binance: Binance, logger: LoggerService) => {
196196

197197
const holdUSDT = async (sellPercent = 1.01, usdtAmount = 100) => {
198198
if (await hasOpenOrders('ETHUSDT')) {
199+
logger.log("has orders");
199200
return;
200201
}
201202

202203
if ((await getBalance('USDT')) <= usdtAmount * 1.03) {
204+
logger.log("no funds");
203205
return;
204206
}
205207

src/config/params.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,5 @@ export const CC_TRADE_AMOUNT = 100;
1515
export const CC_TRADE_PERCENT = 1.01;
1616

1717
export const CC_PLAYSOUND_MINUTES = 15;
18-
export const CC_FREEZE_SECONDS = 30;
1918
export const CC_LIVENESS_DELAY = 5_000;
2019
export const CC_NET_TICK = 5_000;

src/pages/MainPage/emitters.ts

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import { Subject, Source, Operator, singlerun } from "react-declarative";
1+
import { Subject, Source, singlerun } from "react-declarative";
22

3-
import dayjs, { Dayjs } from "dayjs";
3+
import dayjs from "dayjs";
44

5-
import getTimeLabel from "../../utils/getTimeLabel";
65
import playSound, { Sound } from "../../utils/playSound";
76

87
import { doNotify, doTrade, doRollback, errorSubject } from "./api";
98

10-
import { CC_FREEZE_SECONDS, CC_PLAYSOUND_MINUTES, CC_TRADE_AMOUNT, CC_TRADE_PERCENT } from "../../config/params";
9+
import { CC_PLAYSOUND_MINUTES, CC_TRADE_AMOUNT, CC_TRADE_PERCENT } from "../../config/params";
1110

1211
export const predictEmitter = new Subject<"train" | "upward" | "downward" | "untrained" | null>();
1312

@@ -34,24 +33,9 @@ soundEmitter.connect((stamp) => {
3433
}
3534
});
3635

37-
const upwardEmitter = Source.multicast(() => {
38-
let lastDownward: Dayjs | null = null;
39-
return predictEmitter
40-
.operator(Operator.skip(1))
41-
.tap((trend) => {
42-
if (trend === "downward") {
43-
lastDownward = dayjs();
44-
}
45-
})
46-
.filter(() => {
47-
if (lastDownward && dayjs().diff(lastDownward, 'second') <= CC_FREEZE_SECONDS) {
48-
console.log(`ambiguously rise prediction skipped ${getTimeLabel(new Date())}`)
49-
return false;
50-
}
51-
return true;
52-
})
53-
.filter((trend) => trend === "upward")
54-
});
36+
const upwardEmitter = Source.multicast(() => predictEmitter
37+
.filter((trend) => trend === "upward")
38+
);
5539

5640
const downwardEmitter = Source.multicast(() => predictEmitter
5741
.filter((trend) => trend === "downward")

0 commit comments

Comments
 (0)