MyNixOS website logo
Description

Client for Coinbase Pro.

Client for Coinbase Pro REST and Websocket APIs

coinbase-pro

Client for Coinbase Pro REST and Websocket APIs.

Here is a list of implemented/unimplemented features:

  • Market Data
    • [x] Products
      • [x] Get Products
      • [x] Get Product Order Book
      • [x] Get Product Ticker
      • [x] Get Trades
      • [x] Get Historic Rates
      • [x] Get 24hr Stats
    • [x] Currencies
      • [x] Get Currencies
    • [x] Time
  • Private
    • [x] Accounts
      • [x] List Accounts
      • [x] Get An Account
      • [x] Get Account History
      • [x] Get Holds
    • [x] Orders
      • [x] Place a New Order
      • [x] Cancel an Order
      • [x] Cancel all
      • [x] List Orders
      • [x] Get an Order
    • [x] Fills
      • [x] List Fills
    • [x] Limits
      • [x] Get Current Exchange Limits
    • [x] Deposits
      • [x] List Deposits
      • [x] Single Deposit
      • [x] Payment Method
      • [x] Coinbase
      • [x] Generate a Crypto Deposit Address
    • [x] Withdrawals
      • [x] List Withdrawals
      • [x] Single Withdrawal
      • [x] Payment Method
      • [x] Coinbase
      • [x] Crypto
      • [x] Fee Estimate
    • [x] Stablecoin Conversions
      • [x] Create Conversion
    • [x] Payment Methods
      • [x] List Payment Methods
    • [x] Coinbase Accounts
      • [x] List Accounts
    • [x] Fees
      • [x] Get Current Fees
    • [x] Reports
      • [x] Create a new report
      • [x] Get report status
    • [x] Profiles
      • [x] List Profiles
      • [x] Get a Profile
      • [x] Create a Profile Transfer
    • [x] User Account
      • [x] Trailing Volume
    • [ ] Margin (Disabled)[https://blog.coinbase.com/coinbase-pro-disables-margin-trading-42f5862f8a66]
    • [x] Oracle
      • [x] Get Oracle
  • Websocket Feed
    • [x] Channels
      • [x] The heartbeat channel
      • [x] The status channel
      • [x] The ticker channel
      • [x] The level2 channel
      • [x] The user channel
      • [x] The matches channel
      • [x] The full channel
  • FIX API
    • [ ] Messages

Request API

Market Data Requests

run Sandbox (trades (ProductId "BTC-USD")) >>= print

Authenticated Private Requests

runDefCbAuthT Sandbox cpc $ do
    fills (Just btcusd) Nothing >>= liftIO . print
  where
    accessKey  = CBAccessKey "<access-key>"
    secretKey  = CBSecretKey "<secret-key>"
    passphrase = CBAccessPassphrase "<passphrase>"
    cpc        = CoinbaseProCredentials accessKey secretKey passphrase

Websocket API

To print out all of the full order book updates for BTC-USD:

main :: IO ()
main = do
    msgs <- subscribeToFeed [ProductId "BTC-USD"] [Ticker] Nothing
    forever $ Streams.read msgs >>= print

Example

Example execs can be found in src/example/

Run Example

To run any of the authenticated endpoints in test-request, the access key, secret key, and passphrase must be provided. See Authenticated Private Requests above.

Metadata

Version

0.9.3.2

License

Platforms (75)

    Darwin
    FreeBSD 13
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd13
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd13
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows