mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-10 16:58:08 +00:00
Add Oxlint configuration and integrate linting commands
- Introduced a new `.oxlintrc.json` file to configure Oxlint for code quality checks. - Updated `package.json` to include linting scripts (`lint` and `lint:fix`) for easier code maintenance. - Enhanced documentation in `README` files to guide users on running Oxlint checks and applying fixes.
This commit is contained in:
@@ -409,7 +409,7 @@ export class BasisArbEngine {
|
||||
if (!Number.isFinite(wallet) || !Number.isFinite(available)) continue;
|
||||
if (Math.abs(wallet) === 0 && Math.abs(available) === 0) continue;
|
||||
|
||||
const isTaggedFuturesAsset = /0$/.test(name);
|
||||
const isTaggedFuturesAsset = name.endsWith("0");
|
||||
if (isTaggedFuturesAsset) {
|
||||
futuresBalances.push({ asset: name.replace(/0$/, ""), wallet, available });
|
||||
continue;
|
||||
|
||||
@@ -461,7 +461,7 @@ export class GridEngine {
|
||||
return false;
|
||||
}
|
||||
|
||||
private async haltGrid(price: number): Promise<void> {
|
||||
private async haltGrid(_price: number): Promise<void> {
|
||||
if (!this.running) return;
|
||||
const reason = this.stopReason ?? "触发网格止损";
|
||||
this.log("warn", `${reason},开始执行平仓与撤单`);
|
||||
|
||||
@@ -3,7 +3,6 @@ import type { ExchangeAdapter } from "../exchanges/adapter";
|
||||
import type {
|
||||
AsterAccountSnapshot,
|
||||
AsterDepth,
|
||||
AsterKline,
|
||||
AsterOrder,
|
||||
AsterTicker,
|
||||
} from "../exchanges/types";
|
||||
|
||||
@@ -422,7 +422,7 @@ export class SwingEngine {
|
||||
: position.entryPrice * (1 + Math.max(0, this.config.stopLossPct));
|
||||
|
||||
const tick = Math.max(1e-9, this.config.priceTick);
|
||||
const lastPrice = referencePrice ?? Number(this.tickerSnapshot?.lastPrice) ?? null;
|
||||
const lastPrice = referencePrice;
|
||||
|
||||
// Kill-switch (always-on).
|
||||
const triggerKill =
|
||||
@@ -621,4 +621,3 @@ export class SwingEngine {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -386,7 +386,7 @@ export class TrendEngine {
|
||||
private async enforceRateLimitStop(): Promise<void> {
|
||||
const position = getPosition(this.accountSnapshot, this.config.symbol);
|
||||
if (Math.abs(position.positionAmt) < 1e-5) return;
|
||||
const price = this.getReferencePrice() ?? Number(this.tickerSnapshot?.lastPrice) ?? this.lastPrice;
|
||||
const price = this.getReferencePrice();
|
||||
if (!Number.isFinite(price) || price == null) return;
|
||||
const result = await this.handlePositionManagement(position, Number(price));
|
||||
if (result.closed) {
|
||||
|
||||
Reference in New Issue
Block a user