Skip to content

Commit 6589086

Browse files
author
James Jia
authored
v1.0.14 Python client: Rewards endpoints (#65)
* rewards endpoints * newline at end of file * test * s/optional/required * version bump
1 parent 1a9a82b commit 6589086

3 files changed

Lines changed: 84 additions & 1 deletion

File tree

dydx3/modules/private.py

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def get_accounts(
217217
'''
218218
Get accounts
219219
220-
:returns: Arrat of accounts for a user
220+
:returns: Array of accounts for a user
221221
222222
:raises: DydxAPIError
223223
'''
@@ -912,6 +912,60 @@ def send_verification_email(
912912
{},
913913
)
914914

915+
def get_trading_rewards(
916+
self,
917+
epoch=None,
918+
):
919+
'''
920+
Get trading rewards
921+
922+
:param epoch: optional
923+
:type epoch: int
924+
925+
:returns: TradingRewards
926+
927+
:raises: DydxAPIError
928+
'''
929+
return self._get(
930+
'rewards/weight',
931+
{
932+
'epoch': epoch,
933+
},
934+
)
935+
936+
def get_liquidity_provider_rewards(
937+
self,
938+
epoch=None,
939+
):
940+
'''
941+
Get liquidity rewards
942+
943+
:param epoch: optional
944+
:type epoch: int
945+
946+
:returns: LiquidityRewards
947+
948+
:raises: DydxAPIError
949+
'''
950+
return self._get(
951+
'rewards/liquidity',
952+
{
953+
'epoch': epoch,
954+
},
955+
)
956+
957+
def get_retroactive_mining_rewards(
958+
self,
959+
):
960+
'''
961+
Get retroactive mining rewards
962+
963+
:returns: RetroactiveMiningRewards
964+
965+
:raises: DydxAPIError
966+
'''
967+
return self._get('rewards/retroactive-mining')
968+
915969
# ============ Signing ============
916970

917971
def sign(

dydx3/modules/public.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,10 @@ def get_candles(
208208
:param resolution: optional
209209
:type resolution: str in list [
210210
"1DAY",
211+
"4HOURS"
211212
"1HOUR",
213+
"5MINS",
214+
"1MIN",
212215
]
213216
214217
:param from_iso: optional
@@ -266,3 +269,24 @@ def verify_email(
266269
'token': token,
267270
}
268271
)
272+
273+
def get_public_retroactive_mining_rewards(
274+
self,
275+
ethereum_address,
276+
):
277+
'''
278+
Get public retroactive mining rewards
279+
280+
:param ethereumAddress: required
281+
:type ethereumAddress: str
282+
283+
:returns: PublicRetroactiveMiningRewards
284+
285+
:raises: DydxAPIError
286+
'''
287+
return self._get(
288+
'/v3/rewards/public-retroactive-mining',
289+
{
290+
'ethereumAddress': ethereum_address,
291+
},
292+
)

tests/test_public.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,8 @@ def test_verify_email(self):
6868
# No userId gotten with token: token so no verification
6969
# has occurred
7070
assert e.status_code == 400
71+
72+
def test_public_retroactive_mining(self):
73+
public = Client(API_HOST).public
74+
json = public.get_public_retroactive_mining_rewards(ADDRESS_1)
75+
assert json != {}

0 commit comments

Comments
 (0)