Skip to content
poloniex-sdk edited this page Jan 10, 2023 · 1 revision

Account Margin

get_margin

get_margin(account_type='SPOT')

Get account margin information

Args:

  • account_type (str, optional): The account type. Currently only SPOT is supported.

Returns:

Json objects with account margin information:

{
    'totalAccountValue': (str) The sum of the usd value of all balances plus unrealized pnl,
    'totalMargin': (str) Collateral that can be used for margin,
    'usedMargin': (str) Amount of margin that has been used,
    'freeMargin': (str) Available free margin,
    'maintenanceMargin': (str) Minimum amount needed to keep account in good standing; enters liquidation mode if total margin falls below this value,
    'marginRatio': (str) Is calculated as total margin / maintenance Margin; account enters liquidation mode if this value < 100%,
    'time': (int) Time the record was created
}

Raises:

  • RequestError: An error occurred communicating with trade engine.

Example:

response = client.accounts().get_margin()
print(response)

Borrow Status

get_borrow_status

get_borrow_status(**kwargs)

Get borrow status of currencies.

Keyword Args:

  • currency (str, optional): Currency name.

Returns:

List of json objects with borrow status for currency:

{
    'currency': (str) Currency name,
    'available': (str) Amount of available currency,
    'borrowed': (str) Borrowed amount,
    'hold': (str) Frozen amount,
    'maxAvailable': (str) Amount that can be withdrawn, including what's borrowable with margin,
    'hourlyBorrowRate': (str) Borrow rate per hour,
    'version': (str) Current version of the currency
}

Raises:

  • RequestError: An error occurred communicating with trade engine.

Example:

response = client.accounts().get_borrow_status()
print(response)

Maximum Buy/Sell Amount

get_margin_max

get_margin_max(symbol)

Get maximum and available buy/sell amount for a given symbol.

Args:

  • symbol (str, required): Symbol name.

Returns:

Json objects with maximum and available buy/sell amount for a given symbol:

{
    'symbol': (str) Symbol name,
    'maxLeverage': (int) Max leverage for the symbol,
    'availableBuy': (str) Available amount for the quote currency that can be bought,
    'maxAvailableBuy': (str) Maximum amount in quote currency that can be bought including margin,
    'availableSell': (str) Available amount for the base currency that can be sold,
    'maxAvailableSell': (str) Maximum amount in base currency that can be sold including margin
}

Raises:

  • RequestError: An error occurred communicating with trade engine.

Example:

response = client.accounts().get_margin_max('BTC_USDT')
print(response)