Datafeeder is a WebSocket-based tool written in Go for fetching candle data from Binance. It utilizes the go-binance library for WebSocket communication and PostgreSQL for efficient bulk data insertion.
- WebSocket integration with Binance for fetching candle data.
- Efficient bulk insertion of data into PostgreSQL database.
- Sanitization of data to ensure integrity.
- Future enhancements: retrieving Open Interest (OI) and Long/Short Ratio (LSR) data.
-
Clone the repository:
git clone https://github.com/siqueiraa/datafeeder-ws-binance-go.git cd datafeeder-ws-binance-go
-
Install dependencies:
go mod tidy
-
Set up the PostgreSQL database:
- Create a database and configure access in
config.yaml
.
- Create a database and configure access in
-
Run the program:
go run main.go
The configuration is managed through config.yaml
. Modify this file to set up database connections, API keys, and other settings.
Example config.yaml
:
user: user
password: password
host: locahost
port: 5432
dbname: dbname
sslmode: disable
logLevel: error # or "debug", "info", etc.
CREATE TABLE public.trades_binance (
time timestamptz NOT NULL,
maker bool NOT NULL,
symbol text NOT NULL,
price numeric NOT NULL,
size numeric NOT NULL,
qty_trades numeric NOT NULL,
id numeric NOT NULL
);
CREATE INDEX trades_symbol_idx ON public.trades_binance (symbol,id);
CREATE INDEX trades_event_symbol_idx ON public.trades_binance (symbol,time);
Feel free to contribute by opening issues or pull requests. Your feedback and suggestions are highly appreciated.
This project is licensed under the MIT License.