Skip to content

cryptohopper/code-samples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cryptohopper Code Samples

Practical, runnable examples for the Cryptohopper API. Pick what you need from the table — every directory has its own README with the run command.

Browse by purpose

Directory Purpose
quickstart/ A "hello world" per language — authenticate and make one API call. Pick this if you're new.
oauth/ Drive the three-leg OAuth2 consent flow end to end (server-side apps that need to obtain tokens for users).
webhooks/ Receive webhook events from Cryptohopper (order fills, signals).
recipes/ Cross-language patterns: poll a backtest, fan out positions, retry strategy, stream new fills.
cli/ Shell scripts that combine cryptohopper CLI commands with jq for ops automation.

Browse by language

Every official Cryptohopper SDK ships an alpha-quality "0.x" release on its native registry. Each SDK covers all 18 public API domains with the same error taxonomy and retry contract — the Comparison wiki shows the same operations side-by-side.

Language Quickstart OAuth flow Registry
Node.js quickstart/nodejs/ oauth/nodejs/ @cryptohopper/sdk
Python quickstart/python/ oauth/python/ cryptohopper
Go quickstart/go/ oauth/go/ cryptohopper-go-sdk
Ruby quickstart/ruby/ cryptohopper
Rust quickstart/rust/ cryptohopper
PHP quickstart/php/ oauth/php/ cryptohopper/sdk
Dart quickstart/dart/ (git: until pub.dev publish)
Swift quickstart/swift/ SwiftPM
Kotlin quickstart/kotlin/ (Maven Central pending)
curl quickstart/curl/ (no SDK — raw HTTP, language-agnostic reference)

Get a token

You'll need a 40-character OAuth bearer token to run any of these. Three ways to obtain one:

  1. CLI (easiest) — cryptohopper login from cryptohopper-cli walks you through the browser consent and stores the token at ~/.cryptohopper/config.json. cat it out from there.
  2. Manual OAuth flow — see the language-specific samples in oauth/ or the protocol-level walkthrough in quickstart/curl/.
  3. Long-lived dev token — for some app types you can issue one directly from the developer dashboard.

Once you have a token, set it in your shell:

export CRYPTOHOPPER_TOKEN=your-40-char-bearer

Every quickstart reads from that env var.

Auth-header gotcha

The Cryptohopper public API uses the access-token: <token> header, not Authorization: Bearer. The AWS API Gateway in front of api.cryptohopper.com rejects Authorization: Bearer with 405 Missing Authentication Token. Every official SDK in the table above sends the right header automatically. If you're hand-rolling HTTP, see the curl quickstart.

Other Cryptohopper resources

License

MIT — see LICENSE.