{"id":41464137,"url":"https://github.com/coinbase-samples/prime-liquidator-go","last_synced_at":"2026-01-23T16:18:28.283Z","repository":{"id":155659322,"uuid":"630580327","full_name":"coinbase-samples/prime-liquidator-go","owner":"coinbase-samples","description":"Sample Prime application that monitors trading wallets and converts to fiat","archived":false,"fork":false,"pushed_at":"2024-08-23T16:30:22.000Z","size":32,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-08-23T18:26:43.670Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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}},"created_at":"2023-04-20T17:26:55.000Z","updated_at":"2024-08-23T16:29:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"83dfc16b-7097-4575-b642-f17ca53e33a7","html_url":"https://github.com/coinbase-samples/prime-liquidator-go","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/coinbase-samples/prime-liquidator-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase-samples%2Fprime-liquidator-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase-samples%2Fprime-liquidator-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase-samples%2Fprime-liquidator-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase-samples%2Fprime-liquidator-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coinbase-samples","download_url":"https://codeload.github.com/coinbase-samples/prime-liquidator-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase-samples%2Fprime-liquidator-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.503Z","updated_at":"2026-01-23T16:18:28.262Z","avatar_url":"https://github.com/coinbase-samples.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Coinbase Prime Liquidator\n\n\n[![GoDoc](https://godoc.org/github.com/coinbase-samples/prime-liquidator-go?status.svg)](https://godoc.org/github.com/coinbase-samples/prime-liquidator-go)\n[![Go Report Card](https://goreportcard.com/badge/coinbase-samples/prime-liquidator-go)](https://goreportcard.com/report/coinbase-samples/prime-liquidator-go)\n\n## Overview\n\nThe *Coinbase Prime Liquidator* sample application continuously monitors a [Coinbase Prime](https://prime.coinbase.com/) portfolio\nfor crypto assets in hot/trading wallets and places sell orders or converts to USD/fiat.\n\nSell orders deduct holds based on instrument, so if new assets are added while others are being liquidated, the\napplication continues to create new orders if there are enough assets to sell. Additionally, if for some reason an order\ncontinuously fails to execute, there is an ID generated (client_order_id) from the sell attributes that is used to\nreduce the amount of spam/failing orders sent to Prime. Prime treats the client_order_id as idempotent for open orders and\nthe ID is cached in-process too.\n\n## License\n\nThe *Coinbase Prime Liquidator* sample application is free and open source and released under the [Apache License, Version 2.0](LICENSE).\n\nThe application and code are only available for demonstration purposes.\n\n## Warning\n\n**Use of this sample application may cause a negative financial impact**\n\nWhen the application is running, it continuously monitors and converts crypto assets to USD.\nIf the application is accidentally left running or mistakenly pointed at an unintended portfolio,\nall of the assets in hot/trading wallets will be quickly liquidated.\n\nSell orders are created with a one hour TWAP with the lowest tolerance (limit price) set at 10% below the\ncurrent price of the asset price on the [Coinbase Exchange](https://exchange.coinbase.com/).\n\nIf the sample application is used to liquidate large positions, there is price action risk that may\nresult in trades executing up to 10% lower than the latest price check.\n\nIf this application is deployed using the sample AWS CloudFormation template, there will be new charges to your AWS account. For high throughput Prime portfolios, these charges may be significant. As always, continiously review your AWS bill to understand more.\n\n## Usage\n\n### Create Stack\n\nThe *Coinbase Prime Liquidator* has a [sample AWS CloudFormation](infra/aws.cfn.yml) (CFN) template that can be deployed to run the application in an Amazon Elastic Container Service (Amazon ECS) cluster. This template creates all of the required resources and can be customized to suit the deployers needs. To deploy the CFN stack, [initialize your AWS credentials](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) and then run:\n\n ```bash\nmake create-aws-stack ENV_NAME=dev PROFILE=default REGION=us-east-1\n```\n\nCustomize the values of the *ENV_NAME*, *PROFILE*, and *REGION* to match the needs of your environment. The *PROFILE* argument is the name of the AWS CLI profile configured and the *REGION* argument is the [AWS Region](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/) you would like to deploy to.\n\n### Prime Credentials\n\nOnce the CFN stack is deployed, configure your credentials in [AWS Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html). The name of the empty secret uses the following format:\n\n```\nprime-liquidator-ENV_NAME-prime-api-credentials\n```\n\nThe *ENV_NAME* will the same as what was passed to the *create-aws-stack* command (e.g., dev). The credentials use the following format:\n\n```\n{\n  \"accessKey\": \"\",\n  \"passphrase\": \"\",\n  \"signingKey\": \"\",\n  \"portfolioId\": \"\",\n  \"svcAccountId\": \"\"\n}\n```\n\nPrime API credentials can be created in the [Prime web application](https://prime.coinbase.com), once an account is opened.\n\n### Build/Deploy Container\n\nThe inital stack deploys the *public.ecr.aws/nginx/nginx:stable-perl-arm64v8* container as a placeholder. The ECS task definition/service requires a container and at this point, the ECR repository has not been created. Once the CFN stack is deployed, build the container image and deploy to the Amazon ECR (ECR) repository. To do this, execute:\n\n ```bash\nmake build-image ENV_NAME=dev PROFILE=default REGION=us-east-1 BUILD_ID=1\n```\n\nAgain, customize the values of the *ENV_NAME*, *PROFILE*, *BUILD_ID*, and *REGION* to match the needs of your environment. The *BUILD_ID* can be set to a value that matches your container tagging practices.\n\nAfter the build is deployed, update the *DockerImageUri* attribute in the [aws-dev.json](infra/aws-dev.json) file to the URI of your deployed build. The newly created ECR respository uses the following format:\n\n```\nAWS_ACCOUNT_ID.dkr.ecr.AWS_REGION.amazonaws.com/prime-liquidator-ENV_NAME:BUILD_ID\n```\n\nNote: If your environment is not named, *dev*, you will need to create a new environment configuration file. The environment name is defined by the *ENV_NAME* CLI argument. The format for the environment configuration file name is:\n\n```\ninfra/aws-ENV_NAME.json\n```\n\nThe CFN stack is configured to run ARM64 containers, so you must build on an ARM64 compatible computer.\n\n### Update Stack\n\nOnce the *DockerImageUri* attribute is updated, run the following command to update the CFN stack and run the *Coinbase Prime Liquidator*:\n\n ```bash\nmake update-aws-stack ENV_NAME=dev PROFILE=default REGION=us-east-1\n```\n\nThis command deploys the container image specified in the *DockerImageUri* and starts listening for new Prime activities.\n\n## Building\n\nTo build the sample application, ensure that [Go](https://go.dev/) 1.21+ is installed and then run:\n\n```bash\ngo build cmd/server/main.go\n```\n\nTo build the Docker container, login to the [Amazon ECR Public Gallery](https://gallery.ecr.aws/):\n\n```bash\naws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws\n```\n\nRun the docker build:\n\n```bash\ndocker build .\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoinbase-samples%2Fprime-liquidator-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoinbase-samples%2Fprime-liquidator-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoinbase-samples%2Fprime-liquidator-go/lists"}