API Authentication | Secure Access to PowerTrade Trading API
Learn how to generate & manage API keys. Secure authentication for safe automated trading on PowerTrade.
Generate an API Key and Private Key
Generate an access token - JWT
def generate_access_token(api_key, private_key):
now = utils.time.time_s()
return jwt.encode({"exp": now + 60, "iat": now,
"sub": api_key, "client": "api"}, private_key, algorithm="ES256")import rs from "jsrsasign";
const header = { alg: "ES256", typ: "JWT" };
const payload = {
sub: api_key,
iat: rs.KJUR.jws.IntDate.get("now"),
exp: getUnixTime(add(Date.now(), { days: 10 })),
client: "api",
nonce: getUnixTime(Date.now()),
};
const headerString = JSON.stringify(header);
const payloadString = JSON.stringify(payload);
return rs.KJUR.jws.JWS.sign("ES256", headerString, payloadString, private_key);Still have questions?
PreviousPowerTrade API Overview | Automate Crypto Options TradingNextOptions Trading on PowerTrade | Calls, Puts & Altcoin Strategies
Last updated
Was this helpful?