Trading simulation using SET50 data with portfolio and order matching features.
Project description
Trading Simulation
A Python-based trading simulator using SET50 daily tick data.
This system mimics real-time trading environments and supports development of algorithmic (ALGO) trading strategies with features such as order matching, portfolio management, commission/VAT handling, and more.
💼 Overview
The simulator reproduces a streaming-like stock trading system with capabilities including:
- Order placement and matching
- Real-time-like data streaming
- Portfolio tracking and analysis
- Automated performance summarization
Each trader starts with an initial cash balance of 10,000,000 THB. This capital will be managed through the portfolio system and used throughout the trading competition or simulation.
🧠 Features
📈 Stock & Portfolio Management
- Initialize a portfolio or load an existing one
- Update market prices during simulation
- Track and calculate key financial metrics:
- Amount by cost
- Average cost per stock
- Unrealized & realized gains/losses (in value and %)
- Net Asset Value (NAV)
- Maximum Drawdown
- Calmar Ratio
📊 Portfolio Summary
- Automatically generate transaction summaries
- Output metrics such as buy/sell volume, average price, commission, VAT, and net result
📝 Order Handling
- Submit buy/sell orders under these rules:
- Stocks must belong to the SET50 index
- Volume must be a multiple of 100 (standard lot size)
- Partial or invalid volumes (e.g. 150) are rejected
- Orders exceeding portfolio cash will be rejected
- All valid orders are recorded and matched against streaming market data
🔁 Order Matching Simulation
- Market simulator checks all orders during each time step
- Orders are executed only if matched price/volume is available in the stream
- Realistic handling of slippage, VAT (7%), and commission (0.157%), and slippage (0.03%)
📤 Strategy Result Submission
- After simulation, trading performance and results are automatically generated
- Ensure the portfolio name matches your trader/team name for correct result assignment
License
This project is licensed under the MIT License - see the LICENSE file for details.
⚙️ Requirements
- Python 3.9.13+
- pandas
- rich
- gspread
- google-auth
- google-api-python-client
- google-auth-httplib2
- google-auth-oauthlib
Install dependencies:
pip install -r requirements.txt
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tradesim_coptee-0.1.3.tar.gz.
File metadata
- Download URL: tradesim_coptee-0.1.3.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3cda25021d0693e366ff87e0afd8cc8f645c9c3cf0ce98a27e69d2c2fb5e3c65
|
|
| MD5 |
ea8d13a748d5c26e15f300520e0d8c9c
|
|
| BLAKE2b-256 |
74baf9cb1d714971b2e7185032ead308e85500985c456ab43008a9c2d2ad6af3
|
File details
Details for the file tradesim_coptee-0.1.3-py3-none-any.whl.
File metadata
- Download URL: tradesim_coptee-0.1.3-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f8f6762b645122bffddee3df26fea1b09b783e8b76b19124b541abfc4fd2fc3
|
|
| MD5 |
6b121f7448973930b33b9a64c5d7fd42
|
|
| BLAKE2b-256 |
8b2210dd1c8563ec3e9121fd993cdcf11d187d299945fd8f670de6e7ef285dad
|