Skip to content

kangG718/trading_simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Trading Simulation Repository

This repository provides a complete pipeline for simulating trading strategies based on real-time stock data using the Korea Investment & Securities API. The focus is on analyzing Samsung Electronics' intraday stock data and implementing a moving average crossover strategy.


Overview

  1. Access Token Generation

    • Obtain an API access token from Korea Investment & Securities to interact with their real-time data services.
  2. Data Retrieval

    • Request 330-minute interval data for Samsung Electronics (005930.KQ) for the current trading day.
  3. Data Visualization

    • Use pandas and matplotlib to visualize stock trends, including candlestick patterns and moving averages.
  4. Trading Strategy Simulation

    • Simulate a trading strategy based on moving average crossovers.
    • Generate buy/sell signals and evaluate performance.
  5. Results Export

    • Save the simulation results as a CSV file for further analysis.

File Description

  • trading_simul.ipynb
    • A Jupyter Notebook that consolidates all functionalities:
      • Authenticates with the API and fetches stock data.
      • Visualizes stock trends and moving averages.
      • Implements a moving average crossover strategy.
      • Simulates trades and evaluates the strategy.
      • Exports simulation results to a CSV file.

Example Output

Below is a sample of the CSV file generated by the simulation:

Date Price Signal Profit/Loss
2025-01-16 70000 BUY 0
2025-01-16 71000 SELL 1000

Reference

The tools in this repository are developed using the Korea Investment & Securities API, which helps automate investment processes and provides access to real-time stock data for analysis.

About

mini projects for Python skill development(3)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published