Skip to main content

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

tradesim_coptee-0.1.5.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tradesim_coptee-0.1.5-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file tradesim_coptee-0.1.5.tar.gz.

File metadata

  • Download URL: tradesim_coptee-0.1.5.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for tradesim_coptee-0.1.5.tar.gz
Algorithm Hash digest
SHA256 5ec6c2d3a8e97e2b21328f130522c963e3a3b7e7c5c6482239b2faabba9939b6
MD5 b651488cb82abf50d61be0b417a84646
BLAKE2b-256 164cdf62e4adac3833ebbcd7e5b9eaf52cbd79824d50b93bcce21d97be4c95eb

See more details on using hashes here.

File details

Details for the file tradesim_coptee-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for tradesim_coptee-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 555bd17bd56f27bd2756d9661cbf4956d5a0ee87425e67f040227e76b4c324c6
MD5 60306e7fcdcf278ef5bcc985747bb896
BLAKE2b-256 90d2a5542622b759eed16d5352b7a29f708077eb09f0a77823f03284c55c1a7d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page