Skip to content

krakenfx/api-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kraken Logo

Kraken Go API Connector

A Go module for interacting with the Kraken Spot and Derivatives APIs, offering both REST and WebSocket access to spot and futures exchanges. This library includes utilities for fixed-point arithmetic, callback handlers, and API helpers.

Key features include:

  • Trading operations: add, amend, and cancel orders

  • Real-time market data streams

  • Book builders for L2 and L3 order books with checksum validation

  • Access to private account data such as balances and execution reports

  • Retrieval of instruments and assets

  • Utility functions for asset name normalization and price derivation

🚀 Installation

To install the module in your Go project:

go get github.com/krakenfx/api-go/...

If you're interested in running examples or contributing to development, clone the repo and install dependencies:

git clone https://github.com/krakenfx/api-go.git
cd api-go
go mod download

📂 Examples & Scripts

Example packages using the module are located in the examples directory.

🌐 Environment Configuration

Before running the scripts, you'll need to set the following environment variables to configure API endpoints and authentication keys:

# REST and WebSocket URLs for Kraken Spot API
export KRAKEN_API_SPOT_REST_URL="https://api.kraken.com"
export KRAKEN_API_SPOT_WS_URL="wss://ws.kraken.com/v2"
export KRAKEN_API_SPOT_WS_AUTH_URL="wss://ws-auth.kraken.com/v2"
export KRAKEN_API_SPOT_PUBLIC=""    # Insert your Spot public API key
export KRAKEN_API_SPOT_SECRET=""    # Insert your Spot secret API key

# REST and WebSocket URLs for Kraken Futures API
export KRAKEN_API_FUTURES_REST_URL="https://futures.kraken.com"
export KRAKEN_API_FUTURES_WS_URL="wss://futures.kraken.com/ws/v1"
export KRAKEN_API_FUTURES_PUBLIC=""  # Insert your Futures public API key
export KRAKEN_API_FUTURES_SECRET=""  # Insert your Futures secret API key

🔐 Running Authenticated Examples

To simplify execution of authenticated example scripts, use the provided helper script:

./scripts/run prod ./examples/spotrest/recenttrades

This command sets the correct environment and runs the selected script with authentication enabled.

🧱 Dependencies

This module uses the following third-party packages:

📫 Contributing

Feel free to open issues, suggest features, or submit PRs.

About

A Go module for interacting with the Kraken Spot and Derivatives APIs

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 5