Skip to content
Advertisement

How to define an array of action spaces?

I am trying to create a crypto trading bot that can trade multiple crypto coins simulatenously. So for example if I have n=4 coins (e.g. : 0-BTC, 1-ETH, 2-DOT, 3-SOL), then an example of action space would be something like:

JavaScript

Where:

  • BUY if action > 0
  • HOLD if action == 0
  • Sell if action < 0

So, in the given example the actions would be:

  • Index 0: Buy btc worth 1000 USDT
  • Index 1: Hold eth
  • Index 2: Sell DOT worth 3000 USDT
  • Index 3: Buy SOL worth of 2300 USDT

So for an n = x with crypto list: [crypto0, crypto1, crypto2, ..., cryptoX] how can I define an action space that has the form: action_space = [action0, action1, action2, ..., actionX]

Advertisement

Answer

I will suggest go with dictionaries. suppose you are having crypto list: [crypto0, crypto1, crypto2, ..., cryptoX] and action space [action0, action1, action2, ..., actionX].

JavaScript

which will give output like

JavaScript

from here you can iterate on each coin and action using items method.

JavaScript

REMEMBER crypto_list and action_space are 2 separate lists and both should have same length.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement