Skip to content

Commit 8ed2e51

Browse files
committed
added alerts endpoints
1 parent 52a2d76 commit 8ed2e51

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
2.0.1
22
-) Added User Settings Write/Read/Delete endpoints (REST)
33
-) Added Balance Available for Orders/Offers endpoint (REST)
4+
-) Added Alerts endpoints (REST)
45

56
2.0.0
67
-) Implemented Movement endpoints (REST)

bfxapi/rest/bfx_rest.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,48 @@ async def claim_position(self, position_id, amount):
10051005
message = await self.post(endpoint, payload)
10061006
return message
10071007

1008+
async def get_alerts(self):
1009+
"""
1010+
Retrieve a list of active price alerts
1011+
"""
1012+
endpoint = f"auth/r/alerts"
1013+
1014+
message = await self.post(endpoint, {})
1015+
return message
1016+
1017+
async def set_alert(self, type, symbol, price):
1018+
"""
1019+
Sets up a price alert at the given value
1020+
1021+
# Attributes
1022+
@param type string
1023+
@param symbol string
1024+
@param price float
1025+
"""
1026+
endpoint = f"auth/w/alert/set"
1027+
payload = {
1028+
"Settings": settings
1029+
}
1030+
1031+
message = await self.post(endpoint, payload)
1032+
return message
1033+
1034+
async def delete_alert(self, symbol, price):
1035+
"""
1036+
Delete an active alert
1037+
1038+
# Attributes
1039+
@param symbol string
1040+
@param price float
1041+
"""
1042+
endpoint = f"auth/w/alert/price:{symbol}:{price}/del"
1043+
payload = {
1044+
"Settings": settings
1045+
}
1046+
1047+
message = await self.post(endpoint, payload)
1048+
return message
1049+
10081050
async def calc_order_avail(self, symbol, type, lev, dir=None, rate=None):
10091051
"""
10101052
Calculate the balance available for orders/offers

0 commit comments

Comments
 (0)