Tutorials
What you'll learn, prerequisites, and how to navigate the tutorials
Overview
These tutorials walk you through real-world use cases of the FastConnect API — from authentication and market data queries to order management, real-time streaming, and automated trading.
Each tutorial is a standalone, runnable example with both sync and async versions. You can follow them in order as a learning path, or jump directly to the topic you need. The content targets SDK 3.3.x.
The tutorial pages show Python code as the reference language. The GitHub repo below has samples in 4 languages: Python, Node.js, .NET and Go (the same numbered set, 01–19). To see the Node.js/.NET/Go version, open the matching file in the repo; see SDK for more on each SDK.
Source Code
All tutorial source code is available on GitHub:
github.com/SSI-Securities-Inc/ssi-fastconnect-v3-tutorials
git clone https://github.com/SSI-Securities-Inc/ssi-fastconnect-v3-tutorials.gitPrerequisites
- FastConnect API account (Consumer ID, API Key, API Secret, Private Key)
- Python 3.10+
- Install SDK:
pip install ssi-sdk
Learning Path
1. Authentication & Token
Login, get token, cache token for reuse
2. Market Indexes
Get VN-Index, HNX-Index and detailed summary
3. K-line Data (OHLC)
Get candlestick data for charting and technical analysis
4. Securities List
Get stocks by exchange, index, view details
5. Account Balance
Check buying power, positions before placing orders
6. Limit Order
Place buy/sell orders at specified price
7. Market Order
Quick execution at market price
8. Order Status
Track order execution progress via polling
9. Cancel Order
Cancel open unfilled orders
10. WebSocket Market Data
Receive trade prices, quotes, foreign room in real-time
11. WebSocket Trading
Receive order status and portfolio updates in real-time
12. MA Cross Auto Trade
Automated trading bot based on MA Cross signal
13. Conditional Orders (FCO)
Place and manage GTD, Stop, Trailing Stop, OCO, Bull Bear orders...
14. Batch Orders
Place and cancel multiple orders in one request and handle per-order results
15. Positions, PPMMR & Max Buy/Sell
Read T1/T2 positions, purchasing power, margin ratio, derivative positions and the maximum buy/sell quantity
16. Advanced WebSocket Streaming
Subscribe by board/index, index ticks, connection events, subscription management
17. Trading WebSocket
Place/cancel orders and query positions and the order book over the Trading WebSocket
18. Error Handling & Rate Limits
Classify exceptions, read server error codes, retry safely and never resend a duplicate order
19. Corporate Actions
View dividends, bonus shares and rights issues for today or a date range, filtered by symbol and language
Overall Flow
Auth (token cache) → Market Data → Account Check → Place Order → Track/Cancel → Realtime Update- Manual flow: Auth → Market Data → Account Check → Place Order → Track/Cancel → Realtime Update
- Auto flow: Auth → OHLC/Indicator → Signal Engine → Risk Check → Auto Order → Monitor → P&L Logging
Code Structure
Each tutorial provides:
- Objective — what the code does and why
- Flow — step-by-step diagram of the process
- Sync sample — straightforward sequential code
- Async sample —
asyncio-based code for concurrent workloads - Notes — important caveats and best practices
All samples share a common auth_helper.py module for token caching (introduced in Tutorial 1) and a helpers.py module with utilities such as enum_value and mask_account.
Tips
- Start with Tutorial 1 (Authentication) — all other tutorials depend on it.
- Tutorials 1–4 don't require OTP, so you can explore market data without trading credentials.
- Keep credentials in environment variables or config files, never hard-code them.
- Add
token_cache.jsonto.gitignore.