{"id":41464140,"url":"https://github.com/coinbase-samples/prime-fix-go","last_synced_at":"2026-01-23T16:18:28.417Z","repository":{"id":307744621,"uuid":"992787317","full_name":"coinbase-samples/prime-fix-go","owner":"coinbase-samples","description":"Sample application showcasing Coinbase Prime connectivity","archived":false,"fork":false,"pushed_at":"2025-09-17T13:42:08.000Z","size":64,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-17T15:32:04.886Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.cdp.coinbase.com/prime/docs/fix-connectivity","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coinbase-samples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-29T17:59:01.000Z","updated_at":"2025-09-17T13:41:18.000Z","dependencies_parsed_at":"2025-08-02T00:34:20.320Z","dependency_job_id":"7811cb27-5b90-436a-af29-5871b9936141","html_url":"https://github.com/coinbase-samples/prime-fix-go","commit_stats":null,"previous_names":["coinbase-samples/prime-fix-go"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/coinbase-samples/prime-fix-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase-samples%2Fprime-fix-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase-samples%2Fprime-fix-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase-samples%2Fprime-fix-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase-samples%2Fprime-fix-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coinbase-samples","download_url":"https://codeload.github.com/coinbase-samples/prime-fix-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase-samples%2Fprime-fix-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28695529,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T15:57:05.722Z","status":"ssl_error","status_checked_at":"2026-01-23T15:56:27.656Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-23T16:18:27.540Z","updated_at":"2026-01-23T16:18:28.382Z","avatar_url":"https://github.com/coinbase-samples.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go FIX Client for Coinbase Prime\n\n## Introduction\nThis repository contains a lightweight Go-based FIX client that connects to Coinbase Prime's FIX gateway. It provides an interactive REPL to:\n- Create new orders\n- Look up existing orders (using a local `orders.json` cache)  \n- Cancel orders\n- View tabular formatted FIX messages\n\nUnder the hood, [QuickFIX/Go](https://github.com/quickfixgo/quickfix) is used to handle FIX message encoding/decoding and session management.\n\n## Prerequisites\n- **Go 1.23+** installed (https://golang.org/dl/)\n- A valid **Coinbase Prime service account certificate** (PEM format) with private key\n- A CA certificate bundle (e.g., `system-roots.pem`) to validate the TLS connection\n\n---\n\n## 1. Configure `fix.cfg` for Native TLS\n\nCoinbase Prime FIX supports **native TLS**, so no stunnel or proxy is required.\n\n### Quick Setup\nCopy the example configuration file and rename it:\n```bash\ncp fix.cfg.example fix.cfg\n```\n\nThen edit `fix.cfg` to replace placeholder values with your actual credentials:\n- Replace `YOUR_SVC_ACCOUNT_ID` with your service account ID\n- Update the `SSLCAFile` path to point to your system's CA certificate bundle\n\n### Generating CA Certificate Bundle\nTo generate a local CA certificate bundle from your system trust store, run:\n\n```bash\nsecurity find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain \u003e ~/system-roots.pem\n```\n\nThis configuration enables QuickFIX/Go to connect directly over TLS without relying on external proxies like stunnel.\n\n## 3. API credentials\n\nYour Go FIX client also requires a few environment variables to sign the FIX Logon. Set the following in your shell before running:\n\n```bash\nexport ACCESS_KEY=\"your_api_access_key\"\nexport SIGNING_KEY=\"your_api_secret_key\"\nexport PASSPHRASE=\"your_api_passphrase\"\nexport TARGET_COMP_ID=\"COIN\"\nexport PORTFOLIO_ID=\"your_portfolio_id\"\nexport SVC_ACCOUNT_ID=\"your_service_account_id\"\n```\n\n## 4. Build \u0026 Run the Go FIX Client\n\nRun the client:\n```bash\ngo run cmd/main.go\n```\n\nOn successful FIX Logon, you'll see:\n\n```bash\nFIX logon SessionID[YOUR_SENDER-\u003eCOIN]\nCommands: new, status, cancel, list, exit\n```\n\n## 5. REPL Commands\n\nOnce the client is running, type one of the following at the `FIX\u003e` prompt:\n\n### Create a New Order\n\n```bash\nFIX\u003e new \u003csymbol\u003e \u003cMARKET|LIMIT|VWAP\u003e \u003cBUY|SELL\u003e \u003cBASE|QUOTE\u003e \u003cqty\u003e [price] [start_time] [participation_rate] [expire_time]\n```\n\n#### Quantity Types\n- **BASE**: Quantity specified in base currency (e.g., BTC for BTC-USD)\n- **QUOTE**: Quantity specified in quote currency (e.g., USD for BTC-USD)\n\n#### Examples\n\n**Market Orders:**\n```bash\n# Buy 0.1 BTC (base currency)\nFIX\u003e new BTC-USD MARKET BUY BASE 0.1\n\n# Buy $1000 worth of BTC (quote currency)\nFIX\u003e new BTC-USD MARKET BUY QUOTE 1000\n```\n\n**Limit Orders:**\n```bash\n# Buy 0.1 BTC at $30000 (base currency)\nFIX\u003e new BTC-USD LIMIT BUY BASE 0.1 30000\n\n# Buy $3000 worth of BTC at $30000 (quote currency)\nFIX\u003e new BTC-USD LIMIT BUY QUOTE 3000 30000\n```\n\n**VWAP/TWAP Orders:**\nYou can specify VWAP orders with various combinations of optional parameters:\n\n```bash\n# Basic VWAP with just price (base currency)\nFIX\u003e new BTC-USD VWAP BUY BASE 1.0 50000\n\n# VWAP with start time (quote currency)\nFIX\u003e new BTC-USD VWAP BUY QUOTE 50000 50000 2025-08-01T10:00:00Z\n\n# VWAP with start time and participation rate (10%)\nFIX\u003e new BTC-USD VWAP BUY BASE 1.0 50000 2025-08-01T10:00:00Z 0.1\n\n# VWAP with all parameters (start, participation rate, and expire time)\nFIX\u003e new BTC-USD VWAP BUY BASE 1.0 50000 2025-08-01T10:00:00Z 0.1 2025-08-01T16:00:00Z\n```\n\n**VWAP Parameters:**\n- `start_time`: When execution should begin (ISO 8601 format)\n- `participation_rate`: Execution aggressiveness (0.0-1.0, e.g., 0.1 = 10%)\n- `expire_time`: When the order should expire (ISO 8601 format)\n\nThe order is sent, and the ExecReport (fill/cancel information) will be stored in `orders.json`.\n\n### Look Up an Existing Order\n\n```bash\nFIX\u003e status \u003cClOrdId\u003e [OrderId] [Side] [Symbol]\n```\n\nThis application automatically generates a unique `ClOrdId` (Client Order ID) using `UnixNano`. 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`. \n\nExample:\n\n```bash\nFIX\u003e status 1685727281712345678\n```\nIf `orders.json` contains that `ClOrdId`, its `OrderId`, `Side`, and `Symbol` are filled in automatically.\n\n### Cancel an order\n\n```bash\nFIX\u003e cancel \u003cClOrdID\u003e\n```\n\nThis request looks up an order by `ClOrdId` and attempts to cancel it.\n\n### List All Cached Orders\n\n```bash\nFIX\u003e list\n```\n\nThis command lists out all stored orders from `orders.json`.\n\n### Request for Quote (RFQ)\n\nThe client supports RFQ (Request for Quote) functionality for obtaining quotes before executing trades:\n\n```bash\nFIX\u003e rfq \u003csymbol\u003e \u003cBUY|SELL\u003e \u003cBASE|QUOTE\u003e \u003cqty\u003e \u003cprice\u003e\n```\n\n**Example:**\n```bash\n# Request quote to buy $15 worth of SOL-USD with limit price of $250\nFIX\u003e rfq SOL-USD BUY QUOTE 15 250\n```\n\n#### ⚠️ **Important RFQ Warning**\n\n**The current implementation automatically accepts any RFQ quote that is received.** This is designed for demonstration purposes only. In a production environment, you would want to implement proper quote evaluation logic.\n\nBy providing a required limit price, the system sets a worst-case price and helps control the potential risks associated with auto-accepting quotes.\n\n**Use caution when testing with real funds**, as the system will automatically execute trades upon receiving quotes.\n\n### CSV Logging\n\nThe client supports logging all FIX messages to a CSV file for analysis and record-keeping:\n\n```bash\n# Start CSV logging\nFIX\u003e csv start\n\n# Stop CSV logging\nFIX\u003e csv stop\n\n# Check CSV logging status\nFIX\u003e csv\n```\n\nWhen started, messages are written to a timestamped file (e.g., `fix_messages_20250609_143022.csv`) in the current directory.\n\n**CSV Output Format:**\n- **Direction**: `OUTGOING` or `INCOMING`\n- **Timestamp**: RFC3339Nano format\n- **FIX Fields**: Common fields in fixed columns (ClOrdID, OrderID, Symbol, Side, OrdStatus, etc.)\n- **Other Fields**: Any additional fields not in predefined columns\n\nThis feature is useful for:\n- Post-trade analysis and reconciliation\n- Debugging message flow\n- Audit trails and compliance\n- Importing FIX data into spreadsheet applications\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoinbase-samples%2Fprime-fix-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoinbase-samples%2Fprime-fix-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoinbase-samples%2Fprime-fix-go/lists"}