Authentication Module

Wrappers for authenticated Binance API requests via panzer.BinanceClient.

Credentials are managed by panzer’s CredentialManager (stored in ~/.panzer_creds).

Authenticated API requests module.

Public API requests are handled by panzer (BinancePublicClient). Signed requests are handled by panzer (BinanceClient) since panzer 2.1.0.

This module provides thin wrappers that add BinPan-specific type conversion (convert_response_type) on top of panzer’s signed_request().

Credentials are managed by panzer’s CredentialManager (~/.panzer_creds).

Functions:

convert_response_type(response_data, ...)

Infers types into api response and changes those.

signed_get(endpoint, decimal_mode[, params, ...])

Signed GET request via panzer BinanceClient.

signed_post(endpoint, decimal_mode[, ...])

Signed POST request via panzer BinanceClient.

signed_delete(endpoint, decimal_mode[, ...])

Signed DELETE request via panzer BinanceClient.

semi_signed_get(endpoint, decimal_mode[, params])

GET with API key header but no full signature (USER_STREAM / MARKET_DATA).

get_server_time()

Get time from server using panzer.

convert_response_type(response_data: dict | list, decimal_mode: bool) dict | list[source]

Infers types into api response and changes those.

Parameters:
  • response_data (dict or list) – API response json loaded.

  • decimal_mode (bool) – Sets numeric data type to decimal.

Return dict or list:

Typed API data in response.

signed_get(endpoint: str, decimal_mode: bool, params: dict | None = None, recv_window: int = 10000) dict | list[source]

Signed GET request via panzer BinanceClient.

Parameters:
  • endpoint (str) – API endpoint path.

  • decimal_mode (bool) – Sets numeric data format to decimal.

  • params (dict) – Params for the request.

  • recv_window (int) – Milliseconds of life for the request.

Return dict or list:

API response with type conversion applied.

signed_post(endpoint: str, decimal_mode: bool, params: dict | None = None, recv_window: int = 10000) dict | list[source]

Signed POST request via panzer BinanceClient.

Parameters:
  • endpoint (str) – API endpoint path.

  • decimal_mode (bool) – Sets numeric data format to decimal.

  • params (dict) – Params for the request.

  • recv_window (int) – Milliseconds of life for the request.

Return dict or list:

API response with type conversion applied.

signed_delete(endpoint: str, decimal_mode: bool, params: dict | None = None, recv_window: int = 10000) dict | list[source]

Signed DELETE request via panzer BinanceClient.

Parameters:
  • endpoint (str) – API endpoint path.

  • decimal_mode (bool) – Sets numeric data format to decimal.

  • params (dict) – Params for the request.

  • recv_window (int) – Milliseconds of life for the request.

Return dict or list:

API response with type conversion applied.

semi_signed_get(endpoint: str, decimal_mode: bool, params: dict | None = None) dict | list[source]

GET with API key header but no full signature (USER_STREAM / MARKET_DATA).

Parameters:
  • endpoint (str) – API endpoint path.

  • decimal_mode (bool) – Sets numeric data format to decimal.

  • params (dict) – Params for the request.

Return dict or list:

API response with type conversion applied.

get_server_time() int[source]

Get time from server using panzer.

Return int:

A linux timestamp in milliseconds.