added alerts endpoints

This commit is contained in:
itsdeka
2022-01-25 14:42:34 +01:00
parent 52a2d76379
commit 8ed2e51228
2 changed files with 43 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
2.0.1
-) Added User Settings Write/Read/Delete endpoints (REST)
-) Added Balance Available for Orders/Offers endpoint (REST)
-) Added Alerts endpoints (REST)
2.0.0
-) Implemented Movement endpoints (REST)

View File

@@ -1005,6 +1005,48 @@ class BfxRest:
message = await self.post(endpoint, payload)
return message
async def get_alerts(self):
"""
Retrieve a list of active price alerts
"""
endpoint = f"auth/r/alerts"
message = await self.post(endpoint, {})
return message
async def set_alert(self, type, symbol, price):
"""
Sets up a price alert at the given value
# Attributes
@param type string
@param symbol string
@param price float
"""
endpoint = f"auth/w/alert/set"
payload = {
"Settings": settings
}
message = await self.post(endpoint, payload)
return message
async def delete_alert(self, symbol, price):
"""
Delete an active alert
# Attributes
@param symbol string
@param price float
"""
endpoint = f"auth/w/alert/price:{symbol}:{price}/del"
payload = {
"Settings": settings
}
message = await self.post(endpoint, payload)
return message
async def calc_order_avail(self, symbol, type, lev, dir=None, rate=None):
"""
Calculate the balance available for orders/offers