The correct way to resize images or tensors. For Numpy or Pytorch (differentiable).
Key parameters and specifications
Key parameters and specifications
Parameter
Value
Language
Python
Category
Model Development
Subcategory
Environments
Keywords
Finance, Trading
Stars
568
Forks
150
Contributors
3
Created date
2017-06-13
Updated date
2026-09-19
Stars in 1 day
0
Stars in 7 days
0
Rank
16,876
Previous rank
16,669
Rank change
-207
7-day stars rank
15,776
Previous 7-day stars rank
15,785
7-day stars rank change
9
Total stars rank
17,546
Previous total stars rank
17,515
Total stars rank change
-31
Country
UK
README summary
Trading Gym Trading Gym is an open-source project for the development of reinforcement learning algorithms in the context of trading. It is currently composed of a single environment and implements a generic way of feeding this trading environment different type of price data. Installation We strongly recommend using virtual environments. A very good guide can be found at The trading environment: is a trading environment allowing to trade a *spread* (see We feed the environment a time series of
prices (bid and ask) for *n* different products (with a ), as well as a list of *spread coefficients*. The possible actions are then buying, selling or holding the spread. Actions cannot be taken on one or several legs in isolation. The state of the environment is defined as: prices, entry price and position (whether long, short or flat). Create your own To create your own data generator, it must inherit from the base class which can be found in the
file 'tgym/core. Only the private method which defines the times series needs to be overridden. For only one product, the method **must** yield a tuple, one element at a time. For two or more products, you must return a tuple consisting of bid and ask prices for each product, concatenated. For instance for two products, the method should yield . The logic for the time series is encoded there. Compatibility with OpenAI gym Our environments API is strongly inspired by
OpenAI Gym. We aim to entirely base it upon OpenAI Gym architecture and propose Trading Gym as an additional OpenAI environment. Examples Some examples are available in To run the example, you will need to also install keras with . By default, the backend will be set to Theano. You can also run it with Tensorflow by installing it with . You then need to edit and make sure is specified.
Frequently asked questions
How many stars and forks are recorded?
thedimlebowski/Trading-Gym has 568 stars and 150 forks.
What is the repository rank?
thedimlebowski/Trading-Gym is ranked 16,876.
What language and category are recorded?
thedimlebowski/Trading-Gym has 568 stars, uses Python and belongs to Model Development.
Which repository is closest in rank?
thedimlebowski/Trading-Gym is compared with uber-research/PyTorch-NEAT, ranked 16,877 with 568 stars.
README
Trading Gym
Trading Gym is an open-source project for the development of reinforcement learning algorithms in the context of trading.
It is currently composed of a single environment and implements a generic way of feeding this trading environment different type of price data.
SpreadTrading is a trading environment allowing to trade a spread (see https://en.wikipedia.org/wiki/Spread_trade). We feed the environment a time series of prices (bid and ask) for n different products (with a DataGenerator), as well as a list of spread coefficients. The possible actions are then buying, selling or holding the spread. Actions cannot be taken on one or several legs in isolation. The state of the environment is defined as: prices, entry price and position (whether long, short or flat).
Create your own DataGenerator
To create your own data generator, it must inherit from the DataGenerator base class which can be found in the file 'tgym/core.py'. It consists of four methods. Only the private _generator method which defines the times series needs to be overridden. Example can be found at examples/generator_random.py. For only one product, the _generator method must yield a (bid, ask) tuple, one element at a time. For two or more products, you must return a tuple consisting of bid and ask prices for each product, concatenated. For instance for two products, the method should yield (bid_1, ask_1, bid_2, ask_2). The logic for the time series is encoded there.
Compatibility with OpenAI gym
Our environments API is strongly inspired by OpenAI Gym. We aim to entirely base it upon OpenAI Gym architecture and propose Trading Gym as an additional OpenAI environment.
Examples
Some examples are available in tgym/examples/
To run the dqn_agent.py example, you will need to also install keras with pip install keras. By default, the backend will be set to Theano. You can also run it with Tensorflow by installing it with pip install tensorflow. You then need to edit ~/.keras/keras.json and make sure "backend": "tensorflow" is specified.