Giter Site home page Giter Site logo

asx_gym's Introduction

OpenAI Australia Stock Exchange (ASX) Gym Env

Open AI Gym Env for Australia Stock Exchange (ASX) Australia Stock Market Simulations

Historical stock data

Download the SQLite database and put in the asx_gym directory

this data contains 10 years historical stock data (updated till 2020-May)

.
├── LICENSE
├── README.md
├── asx_gym
│   ├── __init__.py
│   ├── db.sqlite3  <--- download db.sqlite3 and put here.
│   └── envs
│       ├── __init__.py

Update stock data and ASX index data

  python update_stock_data.py

This script retrieves new stock data and ASX index data. the data is updated weekly.

Update company Info

some time ,new companies may list on asx ,you may need to run this scripts to get new companies .

  python update_company_info.py

Installation

Install the OpenAI gym.

  pip install -r requirements.txt

Then install this package via

pip install -e .

Usage

from datetime import date
from logging import INFO

import gym
import asx_gym
# from agents.buy_and_keep_agent import BuyAndKeepAgent
from agents.random_agent import RandomAgent
from asx_gym.envs import AsxObservation

gym.logger.set_level(INFO)
start_date = date(2019, 5, 1)
simulate_company_list = [2, 3, 4, 5, 6, 44, 300, 67, 100, 200]
# simulate_company_list = [3]
env = gym.make("AsxGym-v0", start_date=start_date,
               simulate_company_list=simulate_company_list)
stock_agent = RandomAgent(env)
# stock_agent = RandomAgent(env, min_volume=100, max_volume=500)
# stock_agent = BuyAndKeepAgent(env, 3)

observation = env.reset()
for _ in range(200000 * 24):
    env.render()
    company_count = len(env.simulate_company_list)

    observation, reward, done, info = env.step(stock_agent.action())
    if done:
        env.insert_summary_images(30)
        observation = env.reset()
        stock_agent.reset()
    if observation is not None:
        asx_observation = AsxObservation(observation)
        print(asx_observation.to_json_obj())
        print(info)

env.close()

ASX GYM

asx gym rendering

Support us at Patreon

https://www.patreon.com/asx_gym

Tutorials

ASX Gym Action

ASX Gym Observations

ASX Gym Reward

ASX Gym Done Conditions

ASX Gym Info

ASX Gym Render Modes

ASX Gym Sample Agents

ASX Gym Configurations

View Stock data

ASX Simulations Youtube Channels

ASX Listed Companies

asx_gym's People

Contributors

guidebee avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.