Skip to main content
Version: 1.1.2

CLI

CLI is for data scientist or software engineers to trigger a simulation run via bash

Requirement

  • Authenticated gcloud cli running
gcloud auth application-default login
  • Set the default project-id
gcloud config set project almanak-production

Installation

Add this to ~/.pypirc

[distutils]
index-servers =
almanak-py

[almanak-py]
repository: https://europe-west4-python.pkg.dev/almanak-production/almanak-py/

Make sure this is in the pip.conf file of which the location you can fine here. (If the file is in the wrong location it won't work, for me it's ~/.config/pip/pip.conf )

[global]
extra-index-url = https://europe-west4-python.pkg.dev/almanak-production/almanak-py/simple/

If this is set you can do

pip install keyrings.google-artifactregistry-auth
pip install simcli

Commands for simcli

Generate

Generate will create a local folder with the boilerplate setup for a simulation. It uses the lastest version of the simulation and gives you several files so you can get started quickly. It requires a folderName which is the name of the folder it will make and put the boilerplate files into.

simcli generate folderName

Create

When create command is ran

  • A UUID4 id will be generated for the simulation
  • Files such as configuration and models at the root of the where the create command is ran will be uploaded to Google cloud storage
  • Simulation meta data be added to Firestore.
simcli create

You can also specify parameters through an argument. These have to be passed in as a JSON object with a name and value paramater as an object. Has to be an array. An example would be:

simcli create '[{"name": "swapping_fees_ETH_1", "value": 0.002}]'

This will update the value of the parameter before creating the simulation.

Get

Expects the a uuid to be provided and will return the status and GCS url of the simulation if a simulation with that ID exists.

simcli get XXXX

Result

Expects the a uuid to be provided and will return the result of the simulation in plaintext. Usefull for automation purposes, prevents from having to parse the output of the get command.

simcli result XXXX

Logs

To make troubleshooting easier you can retreive the simulation logs using the logs command. It requires an id and will only return logs if the simulation started. It might take a few seconds for the simulation to start producing logs so be patient.

simcli logs XXXX