fastbot
All guides
DNSE

Connect DNSE (Vietnamese stocks)

Get your DNSE API key plus a Gmail app password so Fastbot can read the OTP and renew your trading session without you doing anything.

2 min read·Updated September 29, 2026

DNSE lets Fastbot read your Vietnamese stock portfolio and place orders on the HOSE and HNX exchanges. Your shares and cash stay in your DNSE account.

Why DNSE needs more settings than the others

DNSE requires two-factor authentication for every trading session: every 8 hours it emails you a 6-digit OTP. Without a way to read that code, you would have to type it in every 8 hours.

Fastbot solves this by reading your mailbox over IMAP, taking the OTP and renewing the session itself. That is why you need a Gmail app password alongside the API key.

Step 1: Get your DNSE API key

  1. Sign in to DNSE Entrade and open the API settings.
  2. Create a new key pair and save the API Key and API Secret.
  3. Note the email address on your DNSE account — that is where OTPs arrive.

Step 2: Create a Gmail app password

This is a 16-character app password, NOT your Gmail password.

  1. Your Gmail account must have 2-step verification switched on first.
  2. Go to myaccount.google.com/apppasswords.
  3. Create a new app password and name it fastbot.
  4. Google shows a 16-character string — copy it now, it is shown only once.

An app password only allows reading mail and can be revoked at any time without affecting your main password.

Step 3: Enter them into Fastbot

⚙️ Settings → ⚙️ Edit .env, then enter five values:

SettingValue
DNSE_ENABLEDtrue
DNSE_API_KEYAPI Key from DNSE
DNSE_API_SECRETAPI Secret from DNSE
DNSE_EMAILThe email on your DNSE account (where OTPs arrive)
IMAP_PASSWORDThe 16-character Gmail app password

For any setting not in the list yet, tap ➕ Add variable and send it as DNSE_ENABLED=true.

When they are all in, tap 🔄 Restart Bot.

Check it worked

Open 🇻🇳 DNSE → 💰 DNSE account:

Fastbot💰 DNSE account
🇻🇳 DNSE account Session: Continuous matching (morning) Account: 0003693208 Balance: Cash: 5,200,000 VND Stock value: 28,500,000 VND NAV: 33,700,000 VND Holdings: • HPG: 1000 shares @ 26,800 VND Last: 28,500 VND | Value: 28,500,000 VND 🟢 PnL: 1,700,000 VND (+6.34%) 🟢 Total PnL: 1,700,000 VND (6.34%)
💰 DNSE account
🔵 Buy/sell stocks
« Main menu

This screen always shows the current trading session, so you know whether orders will go through.

If the OTP never arrives

Fastbot tells you plainly: "No new OTP from noreply@mail.dnse.com.vn after 120s. Check that the email reached the inbox." Usually one of:

  • A Gmail filter is moving the OTP email elsewhere — let it land in the Inbox.
  • You pasted your Gmail password instead of the 16-character app password.
  • The app password was revoked — create a new one.

Next: DNSE orders and DCA.

Ready to start?

Message @fastbot_support on Telegram to get free access.

Sign up via @fastbot_support