NOTE: Currently, the project supports Python 3.10.9+. It is recommended to use a virtual environment or install a python supported version Python 3.10.9 Release
pip install -r requirements.txt
By default variables.env
will try to retrieve an OPENAI_API_KEY set on the local device. If you named your key differently or do not have it
set up as an environment variable, you can manually set the API key in variables.env
.
Running the system with docker-compose will create a couple of clients and a Continuous Double Auction exchange. This option is recommended to conduct experiments as it uses all components of the system.
https://www.docker.com/get-started/ After installing Docker Dekstop, make sure it is running while performing any docker commands
The docker-compose file requires the images project
and app
to be built.
build project
image
cd
docker build -t project .
build app
image
cd user-interface
docker build -t app .
Note: You can skip these steps by running build.sh
; however, it currently only works on linux
Make sure you're in the home directory where the docker-compose.yaml file is located. To start the system enter:
docker-compose up
This will create two clients:
client_0 is at http://localhost:5070
client_1 is at http://localhost:5071
To add more clients, update the docker-compose.yml by following the pattern for client_0 and client_1
To stop the system enter:
docker-compose down
The following run methods are recommended approaches to debug/test the system in isolated modules.
To run the system without docker, you must manually start the Continuous Double Auction
and clients. This option is recommended to test/debug flask_client.py
without having to deal with
the react frontend. Additionally, it is recommended to use this for a single client due to the structure of the logging system.
python ./run_market_server.py
Since the CDA Exchange is running locally on localhost:8090, you must specify that the host(CDA Exchange) is localhost and change the port of the client to one other than 8090. An example would look like of correctly running a client locally looks like:
python ./run_market_client.py --port 5001 --host localhost
If you want to run multiple CDA clients, run the same command in a different terminal and change the --local argument to a different unused port.
To see the clients, visit http://localhost:<port>
. In this example you can reach the client's Flask Endpoints by visiting http://localhost:5001
.
If you want to use the React frontend with this run option run:
npm run dev
Note: You must manually check if the React frontend fetches from the correct client's Flask port
This option is a recommended way to test/debug the client.py
. This does not run client's Flask endpoint or the React frontend; it only
establishes a simple client-exchange interaction. run_market_client.py
has an argument '--mode' or '-m' that's used to specify the mode to run a client.
Using the term 'dev' will run a client in development mode. For more information on client configuration arguments visit: run_market_client.py
.
Similarly, visit run_market_server.py
for Exchange configuration information.
python ./run_market_server.py
Creating a client this way will allow you to manually place orders without ChatGPT and Flask. As mentioned earlier, the CDA Exchange is running locally on localhost:8090 so we must specify the --host as localhost
python ./run_market_client.py -m dev --host localhost
- Contains
llama_rag.py
which currently asks for prompts and generates code based on them. - Contains
/system_data
where we store descriptions of functions. - Contains
/helper_functions
where the executable helper functions are stored.
Folder: /market_client
- Contains
client.py
which is the client class used inflask_client.py
. - Contains
flask_client.py
that connects a client to the market and with generated strategies.
Folder: /exchange_logging
- Contains
exchange_loggers.py
which contains the logging classes used by the client and the exchange server inclient.py
andexchange.py
.
This project is based on the previous work from Leeps-Lab/exchange_server.