Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Get Bitget Market Data

A lightweight Go utility to fetch historical candle data (OHLCV) from the Bitget USDT-Futures exchange and save it directly to CSV files for analysis, backtesting, or record-keeping.

Highlights

  • Fetches high-granularity market data (1H and 4H timeframes).
  • Automatically exports to structured CSV files.
  • Supports custom trading pairs via command-line flags.
  • Built-in utility to verify and format Unix timestamps.
  • Zero external dependencies (uses standard library only).

Overview

This project provides a simple interface to the Bitget V2 API. It targets the USDT-MIX (Futures) market to retrieve Open, High, Low, Close, Base Volume, and Quote Volume data.

The application is designed for speed and reliability. It fetches the last 90 days of 4-hour candles and the last 1,000 hourly candles in a single execution. The data is stored in a local data/ directory, making it immediately available for tools like Excel, Python/Pandas, or R.

Installation

Ensure you have Go 1.26 or later installed on your system.

  1. Clone the repository:

    git clone https://github.com/zam/get-bitget-market-data.git
    cd get-bitget-market-data
  2. Build | run the main application:

  go run main.go    
 go build -o get-bitget-data main.go

Usage

Run the compiled binary. By default, it fetches data for BTCUSDT.

./get-bitget-data

Custom Symbols

You can specify any valid Bitget USDT-Futures symbol using the -symbol flag:

./get-bitget-data -symbol ETHUSDT

Output

The program creates a data/ folder and populates it with:

  • 1H.csv: Hourly candle data.
  • 4H.csv: 4-hour candle data.

The CSV format follows this structure: UnixMS, Open, High, Low, Close, BaseVol, QuoteVol

Verification Utility

The project includes a secondary tool to verify the integrity of the downloaded data and convert Unix milliseconds into human-readable RFC3339 timestamps.

To run the verification tool:

go run cmd/unix-verify.go

This will output the total row count and the start/end dates for each CSV file in the data/ directory.

Technical Details

  • API Endpoint: api.bitget.com/api/v2/mix/market/candles
  • Product Type: USDT-FUTURES
  • Limit: Maximum of 1,000 candles per request.
  • Storage: Data is overwritten on each run to ensure the latest market information is captured.

About

Go tool to fetch historical OHLCV and volume data from Bitget USDT-Futures (MIX) using the v2 API, exporting 1H and 4H candles to CSV with built-in timestamp verification.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages