SDK et CLI
Official client libraries for the Cryptohopper API in seven languages, and a command-line tool. They send your access token and build the requests for you, so you call ch.user.get() instead of writing HTTP calls.
The SDKs and the CLI are in alpha: their interfaces can still change between versions.
Packages
| Language | Registry | Package | Source |
|---|---|---|---|
| JavaScript / TypeScript | npm | @cryptohopper/sdk | GitHub |
| Python | PyPI | cryptohopper | GitHub |
| Go | Go modules | github.com/cryptohopper/cryptohopper-go-sdk | GitHub |
| PHP | Packagist | cryptohopper/sdk | GitHub |
| Ruby | RubyGems | cryptohopper | GitHub |
| Rust | crates.io | cryptohopper | GitHub |
| Swift | Swift Package Manager | cryptohopper-swift-sdk | GitHub |
Install
npm install @cryptohopper/sdkpip install --pre cryptohoppergo get github.com/cryptohopper/cryptohopper-go-sdk@latestcomposer require "cryptohopper/sdk:^0.1@alpha"gem install cryptohopper --precargo add [email protected].package(url: "https://github.com/cryptohopper/cryptohopper-swift-sdk.git", from: "0.1.0-alpha.2")First request
Every SDK takes the OAuth access token of a user. See Authentication for how your app gets one.
import { CryptohopperClient } from "@cryptohopper/sdk";
const ch = new CryptohopperClient({
apiKey: process.env.CRYPTOHOPPER_TOKEN,
});
const me = await ch.user.get();
console.log(me.email);import os
from cryptohopper import CryptohopperClient
with CryptohopperClient(api_key=os.environ["CRYPTOHOPPER_TOKEN"]) as ch:
me = ch.user.get()
print(me["email"])client, err := cryptohopper.NewClient(os.Getenv("CRYPTOHOPPER_TOKEN"))
if err != nil {
log.Fatal(err)
}
me, err := client.User.Get(context.Background())
if err != nil {
log.Fatal(err)
}
fmt.Println(me["email"])use Cryptohopper\Sdk\Client;
$client = new Client(apiKey: getenv('CRYPTOHOPPER_TOKEN'));
$me = $client->user->get();Command-line tool
The cryptohopper CLI manages your hoppers, positions and backtests from a terminal or a CI job. cryptohopper login opens your browser to authorize the CLI with OAuth; every command accepts --json for scripting. Standalone binaries for macOS, Linux and Windows are on the releases page.
npm install -g @cryptohopper/cli
cryptohopper login # authorize in your browser with OAuth
cryptohopper whoami
cryptohopper hoppers list
cryptohopper positions <hopper-id>
Prefer plain HTTP? Every endpoint is documented in the API reference with cURL, JavaScript, Python and PHP examples.