### Start AKShare Local API (Shell) Source: https://github.com/banbox/banbot/blob/main/doc/cn_markets/readme.md This command initiates the local AKShare API server using the 'aktools' Python module. Running this command is necessary to access AKShare data locally via its API. ```shell python -m aktools ``` -------------------------------- ### Install protoc-gen-go Source: https://github.com/banbox/banbot/blob/main/orm/readme.md Go command to install the official Go plugin for the Protocol Buffers compiler (protoc) at the latest version. This plugin is necessary to generate Go code from .proto files. ```shell go install google.golang.org/protobuf/cmd/protoc-gen-go@latest ``` -------------------------------- ### Install TimescaleDB via Docker Source: https://github.com/banbox/banbot/blob/main/doc/timescaledb.md Provides shell commands to pull the TimescaleDB Docker image, run a container with port mapping and volume mounting, and execute commands inside the running container. ```shell docker pull timescale/timescaledb:latest-pg16 ``` ```shell docker run -d --name timescaledb -p 5432:5432 -v /opt/pgdata:/var/lib/postgresql/data -e POSTGRES_PASSWORD=Uf6CVdsZ3Dc timescale/timescaledb:latest-pg16 ``` ```shell docker exec -it timescaledb psql -U postgres -h localhost [-d bantd] ``` -------------------------------- ### Configure TimescaleDB in Docker Container Source: https://github.com/banbox/banbot/blob/main/doc/timescaledb.md SQL commands executed within the Docker container to create a database, install the TimescaleDB extension, and verify the installed version. ```sql CREATE database bantd; ``` ```sql CREATE EXTENSION IF NOT EXISTS timescaledb; ``` ```sql SELECT extversion FROM pg_extension where extname = 'timescaledb'; ``` -------------------------------- ### CTP API Library Files (DLLs) Source: https://github.com/banbox/banbot/blob/main/doc/cn_markets/ctp.md Lists the dynamic link library (DLL) files required for interacting with the CTP Market Data and Trading APIs. 'thostmduserapi.dll' is for market data, and 'thosttraderapi.dll' is for trading operations. ```shell thostmduserapi.dll # 行情库文件 thosttraderapi.dll # 交易库文件 ``` -------------------------------- ### Generate Go Code from .proto with protoc Source: https://github.com/banbox/banbot/blob/main/orm/readme.md Command using the protoc compiler to generate Go source code from a specified .proto file (kdata.proto). The --go_out=. flag specifies the output directory as the current directory, and --go_opt=paths=source_relative ensures the generated code uses relative import paths. ```shell protoc --go_out=. --go_opt=paths=source_relative kdata.proto ``` -------------------------------- ### Start TimescaleDB Docker Container Source: https://github.com/banbox/banbot/blob/main/README.md This bash command starts a Docker container for TimescaleDB. It creates a network, runs the container in detached mode, maps port 5432, mounts a volume for data persistence, sets the PostgreSQL password, and uses the latest TimescaleDB image. ```bash docker network create mynet docker run -d --name timescaledb --network mynet -p 127.0.0.1:5432:5432 \ -v /opt/pgdata:/var/lib/postgresql/data \ -e POSTGRES_PASSWORD=123 timescale/timescaledb:latest-pg17 ``` -------------------------------- ### Generate Database Code with sqlc (Docker) Source: https://github.com/banbox/banbot/blob/main/orm/readme.md Command to run sqlc within a Docker container, mounting the project's 'orm' directory to generate Go database access code from SQL files. Requires Docker Desktop to be running. ```shell docker run --rm -v "E:/trade/go/banbot/orm:/src" -w /src sqlc/sqlc generate ``` -------------------------------- ### Banbot Configuration File Example Source: https://github.com/banbox/banbot/blob/main/README.md This YAML configuration file defines account details for different exchanges (like Binance) including API keys and secrets, and specifies the database connection URL for TimescaleDB. ```yaml accounts: user1: # you can change this binance: prod: api_key: your_api_key_here api_secret: your_secret_here database: url: postgresql://postgres:123@[timescaledb]:5432/ban ``` -------------------------------- ### Start Banbot Docker Container Source: https://github.com/banbox/banbot/blob/main/README.md This bash command starts the banbot Docker container. It runs in detached mode, maps port 8000, connects to the 'mynet' network, mounts the local configuration file into the container, and specifies the path to the config file using the -config flag. ```bash docker run -d --name banbot -p 8000:8000 --network mynet -v /root:/root banbot/banbot:latest -config /root/config.yml ``` -------------------------------- ### Update Sequence After Data Sync (PostgreSQL/TimescaleDB) Source: https://github.com/banbox/banbot/blob/main/doc/timescaledb.md SQL command to update the sequence value for a primary key column ('tdsignal_id_seq') to the maximum existing ID in the table ('tdsignal'), resolving unique constraint violations after data synchronization. ```sql SELECT setval('tdsignal_id_seq', (SELECT max(id) FROM tdsignal)); ``` -------------------------------- ### Building the banbase Docker Image Source: https://github.com/banbox/banbot/blob/main/docker/base/README.md Builds the base Docker image for banbot using `base.Dockerfile`. This image contains common dependencies and only needs to be built once initially or after significant dependency upgrades. The image is then pushed to a Docker registry. ```shell docker build -f base.Dockerfile --no-cache -t banbot/banbase . docker push banbot/banbase ``` -------------------------------- ### Building the latest banbot Docker Image Source: https://github.com/banbox/banbot/blob/main/docker/base/README.md Builds the main banbot application Docker image. This step is typically performed after code updates. It is also automated via a GitHub Workflow. ```shell docker build --no-cache -t banbot/banbot . ``` -------------------------------- ### Building Banbot Docker Image - Shell Source: https://github.com/banbox/banbot/blob/main/docker/READMD.md This command builds the Docker image for the Banbot application. It uses the current directory as the build context and tags the resulting image as 'banbot/banbot'. The '--no-cache' flag ensures a fresh build without using cached layers. ```Shell docker build --no-cache -t banbot/banbot . ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.