Search code examples
gdax-api

GDAX API worked examples requested (signatures)


I am having trouble signing, writing this in a language you have probably never heard of (Phix).

I was spoilt by the binance docs which gave me an all important expected signature for some (fake) key/secret values - and that is now working fine.

Could anybody with some working code (in any language) show me some worked examples, with plenty of intermediate values, using either sandbox or completely fake keys. Obviously the prehash would help, other suspects include base64, digest, utf-8, and the exact content of "body". A couple of GET/POST etc variants would also be appreciated, whatever is possible in a couple of mins.


Solution

  • These were generated with the code that now works, maybe someone else might find them useful:

    passphrase = "fakethesebe"

    api_key = "217a56bdef0217342119e7g6384259df"

    api_secret = "16gHluC10HstUyQVmPeeFu0hsGVp7z7a+tf+SX19XZ2OR+CctbWz8LsTXp0/GIciPX7+STUED/4e+yyGfrrTlA==" (of course that is not a real one)

    a GET:

    prehash: "1516024143.575GET/accounts"

    hmac_sha256: "2C2726879312C0DD75FB2556645FEE05EB7133FEF74736B54E676F6E8E390C01"

    rev4: "8726272CDDC012935625FB7505EE5F64FE3371EBB53647F76E6F674E010C398E"

    sig: "LCcmh5MSwN11+yVWZF/uBetxM/73Rza1Tmdvbo45DAE="

    and a POST:

    prehash: "1516024238.173POST/orders{\"side\":\"buy\",\"product_id\":\"BTC-USD\",\"type\":\"market\",\"size\":\"0.01\"}"

    hmac_sha256: "149D5FFFA90B75DCD058F14221F13FA08282B4A3A24FFCA5D7B906E3303EC6CF"

    rev4: "FF5F9D14DC750BA942F158D0A03FF121A3B48282A5FC4FA2E306B9D7CFC63E30"

    sig: "FJ1f/6kLddzQWPFCIfE/oIKCtKOiT/yl17kG4zA+xs8="

    Obviously you would just get errors if you actually threw any of these at gdax, the point is/was to see whether they would match the output of my code.