From a28b26323875b321bdb5614a601a4c64c73605f1 Mon Sep 17 00:00:00 2001 From: itsdeka Date: Mon, 21 Jun 2021 21:45:50 +0200 Subject: [PATCH] added claim_position to bfx_rest.py --- bfxapi/rest/bfx_rest.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/bfxapi/rest/bfx_rest.py b/bfxapi/rest/bfx_rest.py index ba7d9b9..fba9b60 100644 --- a/bfxapi/rest/bfx_rest.py +++ b/bfxapi/rest/bfx_rest.py @@ -940,6 +940,28 @@ class BfxRest: raw_notification = await self.post(endpoint, payload) return Notification.from_raw_notification(raw_notification) + async def claim_position(self, position_id, amount): + """ + The claim feature allows the use of funds you have in your Margin Wallet + to settle a leveraged position as an exchange buy or sale + + # Attributes + @param position_id: id of the position + @param amount: amount to claim + @return Array [ MTS, TYPE, MESSAGE_ID, null, [SYMBOL, POSITION_STATUS, + AMOUNT, BASE_PRICE, MARGIN_FUNDING, MARGIN_FUNDING_TYPE, PLACEHOLDER, + PLACEHOLDER, PLACEHOLDER, PLACEHOLDER, PLACEHOLDER, POSITION_ID, MTS_CREATE, + MTS_UPDATE, PLACEHOLDER, POS_TYPE, PLACEHOLDER, COLLATERAL, MIN_COLLATERAL, + META], CODE, STATUS, TEXT] + """ + payload = { + "id": position_id, + "amount": f"{amount * -1}" + } + endpoint = "auth/w/position/claim" + message = await self.post(endpoint, payload) + return message + async def get_auth_pulse_hist(self, is_public=None): """ Allows you to retrieve your private pulse history or the public pulse history with an additional UID_LIKED field.