mirror of
https://github.com/FXDavid-OffbeatForex/MBT.git
synced 2026-11-02 03:56:12 +00:00
Add ASCII banner (grey, sibling to Offbeat Engine) on server start + installer
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
3539f73c9d
commit
3e14a7fe79
@@ -0,0 +1,54 @@
|
||||
"""MBT ASCII banner — sibling to Offbeat Engine, in a restrained grey.
|
||||
|
||||
Same block-letter + waveform family as the engine, but understated: MBT is
|
||||
the open, no-nonsense backtester, so it wears grey where the engine wears
|
||||
cyan. No dependencies (usable before pip install). Colour auto-detects, so
|
||||
captured/non-TTY output stays clean plain text.
|
||||
|
||||
Preview: python banner.py
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
_LOGO = [
|
||||
r" ███╗ ███╗██████╗ ████████╗",
|
||||
r" ████╗ ████║██╔══██╗╚══██╔══╝",
|
||||
r" ██╔████╔██║██████╔╝ ██║ ",
|
||||
r" ██║╚██╔╝██║██╔══██╗ ██║ ",
|
||||
r" ██║ ╚═╝ ██║██████╔╝ ██║ ",
|
||||
r" ╚═╝ ╚═╝╚═════╝ ╚═╝ ",
|
||||
]
|
||||
_TAG = " MT5 Backtest Toolkit · replay real signals on real bars"
|
||||
_WAVE = " ╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴"
|
||||
|
||||
# subtle light→mid grey vertical gradient
|
||||
_SHADES = [253, 251, 249, 247, 245, 243]
|
||||
|
||||
|
||||
def _plain() -> str:
|
||||
return "\n" + "\n".join(_LOGO + ["", _TAG, _WAVE]) + "\n"
|
||||
|
||||
|
||||
def _ansi() -> str:
|
||||
out = [f"\033[38;5;{s}m{line}\033[0m" for s, line in zip(_SHADES, _LOGO)]
|
||||
out.append("")
|
||||
out.append(f"\033[38;5;245m{_TAG}\033[0m")
|
||||
out.append(f"\033[38;5;240m{_WAVE}\033[0m")
|
||||
return "\n" + "\n".join(out) + "\n"
|
||||
|
||||
|
||||
def _supports_color(stream) -> bool:
|
||||
return (hasattr(stream, "isatty") and stream.isatty()
|
||||
and os.environ.get("TERM") not in (None, "dumb")
|
||||
and not os.environ.get("NO_COLOR"))
|
||||
|
||||
|
||||
def banner(color=None, stream=None) -> str:
|
||||
if color is None:
|
||||
color = _supports_color(stream or sys.stderr)
|
||||
return _ansi() if color else _plain()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.stdout.write(banner(color=True))
|
||||
@@ -75,6 +75,8 @@ def print_mcp_cmd():
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from banner import banner
|
||||
sys.stdout.write(banner(stream=sys.stdout))
|
||||
install_deps()
|
||||
make_config()
|
||||
copy_include()
|
||||
|
||||
@@ -13,6 +13,7 @@ import sys
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
from banner import banner
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
|
||||
from core.connection import load_config, connect, signal_file_path
|
||||
@@ -158,4 +159,5 @@ def ping() -> dict:
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(banner(stream=sys.stderr), file=sys.stderr)
|
||||
mcp.run(transport="stdio")
|
||||
|
||||
Reference in New Issue
Block a user