Skip to content

Scheduled Tasks & Monitoring

About This Page

What: Complete list of scheduled tasks (name / frequency / responsibility / dependencies) and Monitoring Alert rules with thresholds Audience: Product managers and Operations staff who need to look up automated system tasks and Alert rules Prerequisites: Architecture & Data FlowReading time: 4 minutes Owner: Technical Operations Lead

Key takeaway: The deposit and withdrawal system relies heavily on scheduled tasks to drive asynchronous workflows. Monitoring Alerts cover four categories — Bank Statement collection, Matching engine, bank callbacks, and balance circuit breaker. A hung task is the most common root cause of anomalies.


Scheduled Tasks Overview

The deposit and withdrawal system relies heavily on scheduled tasks to drive asynchronous workflows. They are grouped into four business domains:

DomainTask CountCore Responsibility
BST (Bank-Securities Transfer)~7Deposit/Withdrawal instruction dispatch, result polling, status sync
Deposit Matching~3Bank Statement Matching, anomaly detection, timeout handling
eDDA/eDDI~4Authorization polling, Direct Debit instruction result queries
Reconciliation~2Daily reconciliation, discrepancy detection

BST Scheduled Tasks

Airstar BST Tasks

Job NameResponsibilityTriggerRetryNotes
AsbBstCreateJobCreate deposit instructionTriggered by user depositCalls Airstar API to send deposit request
AsbBstCreateResultJobPoll deposit resultScheduled pollingUp to 60 timesQueries Airstar API for deposit status
AsbBstDepositJobProcess deposit creditingPolling returns SUCCESSExecutes SBA crediting orchestration
AsbBstTransferWithdrawal transfer + pollingTriggered by Approval passUp to 10 timesSends withdrawal request and polls result
SyncAsbBstWithdrawWithdrawal fallback syncScheduled2-hour windowFallback after AsbBstTransfer times out

Airstar deposit chain: AsbBstCreateJobAsbBstCreateResultJob (60 polls) → AsbBstDepositJob

Airstar withdrawal chain: AsbBstTransfer (10 polls) → SyncAsbBstWithdraw (2h fallback)

CMB / Minsheng BST Tasks

Service NameBankResponsibilityNotes
cmb_stock_transCMBBank-Securities TransferSM2-encrypted Socket, real-time bidirectional push
ms_stock_bank_transactionMinshengBank-Securities TransferSM2-encrypted Socket, real-time bidirectional push

CMB/Minsheng receive results in real time via a bidirectional Socket link — no polling tasks are needed. Results are pushed directly over the same connection.

For detailed BST task chains and bank comparisons → Mainland Bank BST Overview: Scheduled Tasks


Deposit Matching Scheduled Tasks

TaskFrequencyResponsibilityNotes
Auto-Matching roundEvery 3 minutesExecute Bank Statement–application MatchingRuns 5-dimension Matching on newly arrived Flows and pending Applies
AbnormalDepositJobScheduledAbnormal deposit detectionDetects Flows that remain unmatched for an extended period; triggers notification
Auto-rejection on timeoutScheduledOverdue application handlingAutomatically rejects unmatched applications after the configured number of days

Bank Statement arrival frequency by bank:

BankStatement MethodArrival Frequency
HSBCMT910 real-time pushSeconds
Citi / GDBFPS APISeconds
BOCHKB2E batch pull3 times daily
Other banksOnline banking transfer notificationMinutes to hours

For detailed Matching logic → Matching & Auto-Crediting

Auto-Matching Operating Window

Auto-Matching does not run 24/7. The HKD/CNH auto-Matching window is Monday 07:00 to Saturday 10:00; USD is daily 09:00-16:00. Bank Statements arriving outside the window only enter smart reminders (24/7) and are not auto-credited. See Manual Matching Guide: Auto-Matching vs Smart Reminders for details.


ICBC Bank Statement Monitoring

ICBC Bank Statement system uses a dual-AZ disaster recovery architecture with unique Monitoring requirements.

Dual-AZ Architecture

Deployment GroupDedicated LineNotes
Production groupLine 1Primary Bank Statement pull (high frequency)
Canary group (backup)Line 2Backup Bank Statement pull (low frequency)

Disaster Recovery Limitation

The two dedicated lines cannot be switched — the production group can only use Line 1, and the canary group can only use Line 2. If either line fails, the corresponding deployment group cannot switch to the other. The system mitigates this via the Bank Statement management service's automatic routing.

Five Types of Production Issues and Handling

TypeSymptomsCauseResolution
1. Customer refundBoth production and canary groups AlertCustomer requested a refund after transfer; bank deleted the Bank StatementMost common; run the Alert handling script (auto-generates SQL script)
2. Refund script failureAlert but the one-click handling script failsCanary group pulls slowly; no subsequent Bank Statement after the refunded one; script stallsManually investigate canary group Bank Statement status
3. Duplicate Bank StatementsOnly production group Alerts; canary group normalTwo Bank Statements have identical time, amount, and remarks; system cannot distinguish themModify close_balance; emergency-credit one of the Bank Statements
4. Bank pushes anomalous statementOnly production group Alerts; canary group normalBank first pushes an incorrect Bank Statement (balance same as previous entry), then deletes itVerification: compare production/canary group statements line by line + compare against bank statement; delete unused statements then restart
5. Cross-day statement pushed lateBoth production and canary groups AlertBank pushes T-1 day's Bank Statements after midnightModify previous day's close_balance; emergency-credit the missing Bank Statements

Key Concepts

ConceptDescription
Balance verificationEach Bank Statement is verified on insertion: previous balance + current credit - current debit = current balance. When a refund causes a statement to be deleted, the balance chain breaks and triggers an Alert
is_used fieldIndicates whether a Bank Statement has been used for Matching. After a full re-pull, statements with is_used=0 are unmatched
Production vs canary group differencesThe production group pulls more frequently (potentially per-entry), while the canary group pulls less often (may receive multiple entries at once). They behave differently in refund and duplicate statement scenarios

ICBC Alert Handling Runbook

Minute 1 — Identify the Alert type:

Alert SourceMost Likely TypeNext Step
Production + canary group Alert simultaneously1. Customer refund (most common)Run the auto-handling script
Only production group Alerts3. Duplicate statements or 4. Anomalous bank statementCompare both groups' statements line by line
Auto-script execution failed2. Refund script stalledManually investigate canary group status

Minutes 2-5 — Execute resolution:

  • Type 1 (Customer refund):

    1. Confirm the flow_id in the Alert
    2. Run the auto-handling script (it auto-generates and executes corrective SQL)
    3. Verify: balance chain is restored; Alert auto-clears
  • Type 3/4 (Production group only):

    1. Compare same-day statements between production/canary groups in the database, sorted by created_at
    2. Identify the differing statement → determine if it is a duplicate (Type 3) or a ghost statement (Type 4)
    3. Type 3: modify one entry's close_balance; emergency-credit
    4. Type 4: compare against bank statement to confirm → delete anomalous statements with is_used=0

If not resolved after 10 minutes → escalate to the on-duty technical Operations staff

Diagnostic Commands and Log Keywords

When an ICBC Alert is received, use these keywords to locate the issue:

ScenarioServiceLog KeywordsNotes
Balance chain breakicbc_be_relaybalance mismatch / close_balanceStatement deletion caused balance discontinuity
Duplicate statementsicbc_be_relayduplicate flow / same remarksIdentical amount + time + remarks
Pull timeouticbc_be_relaytimeout / connection refusedDedicated line connection interrupted
Canary group delayicbc_be_relaycanary lag / sync delayCanary group statements arriving slower than production
Cross-day missingicbc_be_relaymissing T-1 / late pushPost-midnight pull did not include T-1 day statements

Quick Verification

To compare production and canary group statements: sort same-day statements by created_at in the database. If a statement only exists in the production group → likely an anomalous bank push (Type 4). If the canary group has fewer statements than production → likely a canary group pull delay (Type 2).


BOCHK Dual-Path Bank Statement Monitoring

BOCHK Bank Statements come from two independent data sources that require correlated Monitoring.

Dual-Path Architecture

Data SourceTypeLatencyInformation Included
Bank-Enterprise ServiceReal-time APISecondsTransaction amount, currency, time; some include customer name
FTP Report S16Scheduled pull~30 minutesSupplements customer name + remitter account number

Why Dual-Path Is Needed

Most Bank Statements from the Bank-Enterprise Service lack the customer name, which is a core condition for auto-Matching. The FTP Report S16 supplements this critical information.

FTP Report Operating Hours

DimensionHours
Bank-side service hoursMon-Sat 8:00-20:00
Futu-side service hours24/7 (pulls around the clock)

Report File Identification

VersionFilename FormatNotes
S16 (current)AGSA/CNo+UC01.TXT, UC02.TXT, UC03.TXT...One file per time period
S14 (legacy)AGSA/CNo+AC1.TXT, AC2.TXT, AC3.TXT...Deprecated; for rollback reference only

Bank Statement Correlation Rules

How to correlate S16 report statements with Bank-Enterprise real-time statements:

  1. Take the "Transaction Reference Number" from S16
  2. Remove the first 5 characters
  3. Strip leading zeros from the remainder → yields seq_no_s16
  4. Take seq_no from the Bank-Enterprise real-time statement and strip leading zeros
  5. If seq_no_s16 == seq_no → same statement; can be correlated and updated

Update logic:

Bank-Enterprise Statement StatusS16 Update Content
Already has a name (en_name)Update balance and bank account number
No name (en_name is empty)Update name, balance, and bank account number

Monitoring Points

Monitor ItemTrigger ConditionResolution
S16 report delayNo new report received for over 1 hourCheck FTP connection status; confirm whether within bank service hours
Statement correlation failureS16 reference number cannot be matched to a Bank-Enterprise statementCheck reference number parsing logic; bank may have introduced an unknown format
Name not updatedBank-Enterprise statement lacks a name for an extended periodCheck whether S16 is being pulled normally; confirm whether the report contains the statement

eDDA / eDDI Scheduled Tasks

eDDA (authorization) and eDDI (Direct Debit instruction) are both used for deposit via Direct Debit — they are not withdrawal protocols.

TaskBankResponsibilityNotes
eDDA authorization pollingHSBC/Hang SengQuery eDDA authorization statusPolls bank for confirmation after user initiates authorization
eDDI deposit instruction queryHSBC/Hang SengQuery eDDI Direct Debit resultQueries whether the Direct Debit instruction was successfully credited
eDDI deposit result processingHSBC/Hang SengDeposit creditingExecutes crediting after confirming Direct Debit success
eDDA status syncHSBC/Hang SengPeriodic authorization status syncDetects whether authorization changes have occurred on the bank side

Difference Between eDDA/eDDI and BST Polling

eDDA/eDDI polling checks bank confirmation actions (whether authorization succeeded, whether Direct Debit completed), whereas BST Airstar polling checks transaction execution results (whether deposit/withdrawal completed). eDDA/eDDI polling frequency is lower; BST Airstar polling frequency is higher with explicit retry limits.


Concurrent Alert Triage

When the on-duty Operations staff receives multiple Alerts simultaneously, handle them in this priority order:

PriorityCriteriaTypical AlertsWhy This Priority
P0Funds moved but status not updatedFreeze not released, withdrawal sync timeout (2h exhausted)Fund status inconsistency; may lead to duplicate withdrawals or locked user funds
P1Channel completely downSocket disconnected (CMB/Minsheng), API connectivity failure (Airstar)Affects all subsequent transactions; impact expands every minute
P2Single transaction anomalyDeposit/Withdrawal polling timeout, deposit refund REFUNDEDAffects a single customer; system fallback mechanisms are usually running
P3Trend-based warningDaily circuit breaker triggered, cumulative alarm, Approval backlogNo immediate impact, but will worsen if not addressed

Alerts That Can Be Safely Deferred

  • BST Alerts on non-trading days → confirm it is a false trigger (BST does not process transactions on weekends)
  • Canary group delay < 5 minutes (ICBC) → known behavior; canary group pull frequency is inherently lower
  • bank-side initiation volume spike → first observe whether it is a normal business peak (e.g. start of month / payday)

Monitoring Alert Rules

Runbook Format Note

The following Alert rules are organized in Runbook format. Upon receiving an Alert, follow the flow: Severity → First responder → Resolution steps → Escalation criteria. See the Alert Escalation Matrix.

BST Alerts

Airstar BST:

#Alert ItemTrigger ConditionSeverityResolution
1Authorization creation timeoutMandate PROCESSING exceeds thresholdHighCheck Airstar API connectivity
2Authorization failure rate spikeFAIL count exceeds limit within time windowHighInvestigate bank-side anomaly
3Deposit creation failureAsbBstCreateJob fails consecutivelyHighCheck request parameters and API
4Deposit polling timeout60 polls exhaustedHighManually query bank side
5Deposit refundReceived REFUNDEDHighReversal + notify user
6Withdrawal polling timeout10 polls exhaustedHighEnters SyncAsbBstWithdraw
7Withdrawal sync timeout2h window exhaustedCriticalManually confirm bank-side status
8Freeze not releasedWithdrawal failed but freeze not rolled backCriticalManually release freeze
9Daily circuit breaker triggeredCumulative count reaches stop thresholdMediumAssess whether to resume
10Cumulative alarm triggeredCumulative count reaches alarm thresholdMediumOperations to monitor
11Duplicate transaction detectedDuplicate IDHighCheck deduplication logic
12API connectivity failureResponse timeout / error rate increaseCriticalContact Airstar technical support
13Anomalous bank-side initiation volumesource=2 volume spikeMediumInvestigate business fluctuation

CMB / Minsheng BST:

Alert ItemTrigger ConditionSeverityResolution
Socket connection droppedConnection to bank exit_server interruptedCriticalAuto-switch to backup server; Alert simultaneously
Timeout rate increase-5 callback code ratio exceeds thresholdHighCheck network and bank-side status
Rejection rate increase-6 callback code ratio exceeds thresholdHighContact bank to confirm rejection reason

Deposit Alerts

Alert ItemTrigger ConditionSeverityResolution
Bank Statement backlogUnmatched Flow count exceeds thresholdHighCheck whether the Matching task is running normally
Abnormal depositAbnormalDepositJob detects anomalyMediumOperations to review abnormal deposits
Auto-crediting failureMatching succeeded but crediting failedHighCheck SBA orchestration status

Withdrawal Alerts

Alert ItemTrigger ConditionSeverityResolution
Approval backlogPending task count exceeds thresholdMediumIncrease Operations capacity
Large withdrawalSingle amount exceeds Monitoring thresholdMediumOperations to review and confirm
Reversal operationA withdrawal has been reversedHighConfirm Reversal reason

Daily Operations Timeline

BST and other bank channels each have their own processing windows. Below is the typical trading day timeline:

TimeEventNotes
07:00CMB/Minsheng BST processing window opens
08:00Airstar BST processing window opens
07:00eDDI (HSBC/Hang Seng) processing window opens
09:00-10:00BOCHK B2E first batch of Bank Statements arrives
11:00Withdrawal batch cutoffWithdrawals submitted after 11:00 go into the next-day batch
After 11:00Withdrawal file exportTransfer files exported by method and uploaded to online banking
13:00-14:00BOCHK B2E second batch of Bank Statements arrives
AfternoonCheck depositsStaff visit branches to deposit checks
16:00eDDI processing window closes
17:00-18:00BOCHK B2E third batch of Bank Statements arrives
22:00Airstar BST processing window closes
Next day 04:00CMB/Minsheng BST processing window closes
Early next morningDaily reconciliation tasks run

Non-Trading Days

BST does not process transactions on weekends and public holidays (per HKEX calendar). eDDI operates on business days only. FPS is theoretically 24/7 but Operations Approval is only available on business days.


Alert Escalation Matrix

When an Alert is triggered, follow this escalation flow:

SeverityResponse SLAFirst ResponderEscalation CriteriaEscalation Target
Critical15 minutesOn-duty OperationsCannot recover within 15 minutes→ Technical Operations + corresponding bank service developer
High30 minutesOn-duty OperationsCannot identify root cause within 30 minutes→ Deposit/Withdrawal product manager
Medium2 hoursOn-duty OperationsCannot resolve within the business day→ Operations Lead

Critical Alerts (15-minute response required)

  • Socket connection dropped (CMB/Minsheng BST)
  • API connectivity failure (Airstar)
  • Withdrawal sync timeout (2h window exhausted)
  • Freeze not released (withdrawal failed but funds still frozen)

High Alerts (30-minute response required)

  • Bank Statement backlog (pending statement count exceeds threshold)
  • Deposit/Withdrawal polling timeout
  • BST timeout rate / rejection rate spike
  • Auto-crediting failure
  • Reversal operation
  • Deposit refund (REFUNDED)

Medium Alerts (2-hour response required)

  • Abnormal deposit detected
  • Approval backlog
  • Large withdrawal
  • Cumulative alarm / daily circuit breaker triggered
If Requirements Change: Adjusting Monitoring Alert Configuration

Code locations:

  • Deposit Monitoring tasks: deposit/doc/crontab.sh (all Cron definitions)
  • Bank Statement backlog Monitoring: deposit/src/app/Console/Commands/Monitor/FlowMonitor.php
  • BST Approval Monitoring: withdraw/src/app/Console/Commands/Monitor/AutoBsApprovalMonitor.php
  • auto_settings Alerts: withdraw/src/app/Business/AutoSetting.phpautoOut() method (auto-Alerts when balance is insufficient)
  • Alert delivery: via Feishu messages (sendFeishu() method); Alert recipient configuration is in auto_settings.alarm_staff_name

Common change scenarios:

  • Modify Bank Statement backlog threshold → modify threshold constants in FlowMonitor.php
  • Modify Alert recipients → modify alarm_staff_name via the CRM auto-withdrawal settings page, or use the AutoSetting::setAlarmStaff() API
  • Add a new Monitoring dimension → create a new Monitor Command class and register it in crontab.sh
  • Modify Alert interval → modify AUTO_SETTING_ALARM_INTERVAL (currently 1 hour, to avoid duplicate Alerts)

Documentation Maintenance Reminder

The following information is prone to becoming outdated. We recommend verifying it quarterly:

Check ItemVerification MethodOwner
Bank maintenance window timesConfirm with bank liaison whether changes have occurredBank liaison
eDDA supported bank listCompare against actual HSBC/Hang Seng channel configurationsDeposit product manager
Withdrawal Channel feesCompare against the bank's latest fee scheduleWithdrawal Operations Lead
Alert thresholdsCompare against actual values in FlowMonitor.php / auto_settingsTechnical Operations
FPS ID and payee nameConfirm with bank whether updates have been madeBank liaison

After Reading

I want to...Go to
See bank-level details for BST tasksMainland Bank BST Overview
Understand deposit Matching logicMatching & Auto-Crediting
See the operational guide after an Alert triggersManual Matching Guide
Look up error codes and status codesUnified Error Code Center
Learn about CRM module operationsCRM Operations Guide
See the eDDA troubleshooting workfloweDDA Troubleshooting Guide
Was this page helpful?

内部业务文档 · 仅限 moomoo 团队使用