AminHP / gym-anytrading

The most simple, flexible, and comprehensive OpenAI Gym trading environment (Approved by OpenAI Gym)
MIT License
2.1k stars 465 forks source link

no only buy and sell actions #36

Closed chris-the-wiz closed 3 years ago

chris-the-wiz commented 3 years ago

Hello, Thanks for the great work. With all due respect I believe your assumption is faulty and there needs to be a "do nothing" event. Imagine the market goes sideways and the price variance is smaller than spread for the time longer than the window. in that case no action is the best action.

samuel-white commented 3 years ago

I think the intention is that a buy action empties the balance (i.e. buys all that it can) and so subsequent buy actions are effectively 'hold' actions until a 'sell' action occurs.

I agree that including a 'hold ' action would make sense though. Particularly if a continuous action space was employed where not all of the stock is being bought or sold at once.

AminHP commented 3 years ago

Hi guys. I feel what you say. A Hold action in some aspects is required. However, depending on the situation, this action can be applied outside or inside of the RL structure. So, I decided to remove it from the environment and make the env as simple as possible especially for beginners. But, if you think it is required for your application, you can easily add this action in a day. I tried to make this env easy to extend and let users add their requirements quickly. Maybe you can find an env with Hold action in the forked repos.

QuantumCrazy commented 3 years ago

You can solve the issue of no "hold" by checking whether the previous signal is the same as the current signal, and if so generate a "hold" signal yourself. I prefer to ignore any cases when the previous signal and the current signal are the same, only making a trade when there is a difference.

AminHP commented 3 years ago

I just released a new project that supports the required feature. @chris-the-wiz @samuel-white

https://github.com/AminHP/gym-mtsim