beYANG CCXT
Library for generalized REST and websocket connection to various centralized exchanges
Translations:
Supported Cryptocurrency Exchange Markets
Installation
go get github.com/beyang-crypto/CCXT_beYANG
Usage
Since the library is designed for different exchanges, all examples will be generalized. To get example for specific exchange, head to the specific exchange README.
1. Create a configuration for connection
Use config package to create a configuration. If you want to access private exchange endpoints, use the NewAuth function. Else - New.
- New - Create a configuration to connect without connecting to an account. This connection is necessary to receive public information.
Parameters:
- Endpoint: config.EndpointType (enum) - connection address, it can be found in the
enums.go
file.
- Debug mode: boolean - Whether it is necessary to output in the logger all the events during the connection to the exchange or not
import (
"github.com/beyang-crypto/CCXT_beYANG/config"
)
endpoint := exchangeEnums.<MainnetEndpoint>
debugMode := true
cfg := config.New(endpoint, debugMode)
- NewAuth - Creating configurations to connect to work with the account directly. You can interact with private endpoints only by using this configuration type.
Parameters:
- Config file: string - path to configuration file
- Exchange iterable in config: int - as yaml api field should be an array, provide position of a necessary exchange element in "api" array
- Endpoint: config.EndpointType (enum) - connection address, it can be found in the
enums.go
file.
- Debug: boolean - Whether it is necessary to output in the logger all the events during the connection to the exchange or not
import (
"github.com/beyang-crypto/CCXT_beYANG/config"
)
configFile := "./config-prod.yaml"
exchangeIterable := 0
endpoint := exchangeEnums.<MainnetEndpoint>
debugMode := true
cfg := config.NewAuth(configFile, exchangeIterable, endpoint, debugMode)
Before using NewAuth
method, it is necessary to prepare a *.yaml
configuration file, containing the authentication data for an exchange, as well as its name.
Configuration file template:
api:
- name: "Exchange name"
key: "public key"
secret: "secret key"
password: "Password (optional)"
2. Connecting
Call the New function of exchange client, providing previously created configuration as an argument.
Docker
To build Docker image for Grafana, run the following command:
docker-compose up -d
Grafana will be available at port 3000
.
Default login and password for Grafana: admin
.