finhay-trading
Finhay Trading
Stock order execution via the Finhay Securities Open API. Real money operations — every action is irreversible once matched on the exchange.
MANDATORY — credentials: Ensure credentials are set (via environment variables
FINHAY_API_KEY/FINHAY_API_SECRETor via./finhay.sh auth). Run./finhay.sh doctorto verify. If IDs are missing, run./finhay.sh infer.
MANDATORY — order sub-account: Order execution only uses the sub-account whose
subAccountExtends in.4(a dedicated account provisioned by Finhay for Open API order routing). After./finhay.sh infer, the env varsSUB_ACCOUNT_ORDERandSUB_ACCOUNT_EXT_ORDERare populated only when such an account exists in the user's account list. If either is empty, the user does not have an order-execution-capable account — stop immediately and report:❌ Tài khoản đặt lệnh không tồn tại. Bạn chưa được cấp sub-account hỗ trợ đặt lệnh (
subAccountExtkết thúc bằng.4). Vui lòng liên hệ Finhay Securities để đăng ký tài khoản đặt lệnh trước khi sử dụng tính năng đặt/sửa/huỷ lệnh.Do not fall back to
$SUB_ACCOUNT_NORMAL/$SUB_ACCOUNT_MARGIN— orders sent on those accounts will be rejected.
For portfolio queries (balance, holdings, P&L, order history), use the
finhay-portfolioskill. This skill is for execution only.
Usage Examples
# Verify the order sub-account exists before any action (fail fast)
[ -z "$SUB_ACCOUNT_ORDER" ] && { echo "❌ Tài khoản đặt lệnh không tồn tại (subAccountExt phải kết thúc bằng .4). Liên hệ Finhay Securities để đăng ký." >&2; exit 1; }