This repository contains a lightweight Java-based FIX client that connects to Coinbase Prime's FIX gateway. It provides an interactive REPL to:
- Create new orders (Market, Limit, VWAP)
- Look up existing orders (using a local
orders.jsoncache) - Cancel orders
Under the hood, QuickFIX/J is used to handle FIX message encoding/decoding and session management.
- Java 17+ installed (https://adoptium.net/)
- Maven 3.6+ for building (https://maven.apache.org/)
- A valid **Coinbase Prime account ** with read-write API key credentials
mvn clean compileOr to create an executable JAR:
mvn clean packageCoinbase Prime FIX supports native TLS, so no stunnel or proxy is required.
To generate a local CA certificate bundle from your system trust store, run:
# macOS
security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain > ~/system-roots.pem
# Linux (Ubuntu/Debian)
cat /etc/ssl/certs/ca-certificates.crt > ~/system-roots.pemEdit the fix.cfg file at the project root. Replace the SenderCompID with your actual service account ID, and adjust the path to your CA file:
SSLCAFile=/Users/yourname/system-roots.pem
SenderCompID=YOUR_SVC_ACCOUNT_ID
This configuration enables QuickFIX/J to connect directly over TLS without relying on external proxies like stunnel.
Your Java FIX client requires environment variables to sign the FIX Logon. Set the following in your shell before running:
export PRIME_ACCESS_KEY="your_api_access_key"
export PRIME_SIGNING_KEY="your_api_secret_key"
export PRIME_PASSPHRASE="your_api_passphrase"
export PRIME_PORTFOLIO_ID="your_portfolio_id"
export PRIME_SVC_ACCOUNT_ID="your_service_account_id"Run the client directly with Maven:
mvn exec:java -Dexec.mainClass="com.coinbase.prime.fix.Main"Or with the compiled JAR:
java -jar target/prime-fix-java-0.1.0.jarOn successful FIX Logon, you'll see:
✓ FIX logon SessionID[YOUR_SENDER->COIN]
Commands: new, status, cancel, list, version, exitOnce the client is running, type one of the following at the FIX> prompt:
FIX> new <symbol> <MARKET|LIMIT|VWAP> <BUY|SELL> <BASE|QUOTE> <qty> [price] [start_time] [participation_rate] [expire_time]- BASE: Quantity specified in base currency (e.g., BTC for BTC-USD)
- QUOTE: Quantity specified in quote currency (e.g., USD for BTC-USD)
Market Orders:
# Buy 0.1 BTC (base currency)
FIX> new BTC-USD MARKET BUY BASE 0.1
# Buy $1000 worth of BTC (quote currency)
FIX> new BTC-USD MARKET BUY QUOTE 1000Limit Orders:
# Buy 0.1 BTC at $30000 (base currency)
FIX> new BTC-USD LIMIT BUY BASE 0.1 30000
# Buy $3000 worth of BTC at $30000 (quote currency)
FIX> new BTC-USD LIMIT BUY QUOTE 3000 30000VWAP Orders: You can specify VWAP orders with various combinations of optional parameters:
# Basic VWAP with just price (base currency)
FIX> new BTC-USD VWAP BUY BASE 1.0 50000
# VWAP with start time (quote currency)
FIX> new BTC-USD VWAP BUY QUOTE 50000 50000 2025-08-01T10:00:00Z
# VWAP with start time and participation rate (10%)
FIX> new BTC-USD VWAP BUY BASE 1.0 50000 2025-08-01T10:00:00Z 0.1
# VWAP with all parameters (start, participation rate, and expire time)
FIX> new BTC-USD VWAP BUY BASE 1.0 50000 2025-08-01T10:00:00Z 0.1 2025-08-01T16:00:00ZVWAP Parameters:
start_time: When execution should begin (ISO 8601 format)participation_rate: Execution aggressiveness (0.0-1.0, e.g., 0.1 = 10%)expire_time: When the order should expire (ISO 8601 format)
The order is sent, and the ExecReport (fill/cancel information) will be stored in orders.json.
FIX> status <ClOrdId> [OrderId] [Side] [Symbol]This application automatically generates a unique ClOrdId (Client Order ID) using System.nanoTime(). This value can be collected from orders.json, or from FIX responses sent by the server. OrderId, Side, and Symbol are required, however this app will automatically import these to the request based on the provided ClOrdId.
Example:
FIX> status 1685727281712345678If orders.json contains that ClOrdId, its OrderId, Side, and Symbol are filled in automatically.
FIX> cancel <ClOrdID>This request looks up an order by ClOrdId and attempts to cancel it.
FIX> listThis command lists out all stored orders from orders.json.
FIX> version # Show application version
FIX> help # Show command help
FIX> exit # Exit the application