Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sprint33 34 #29

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions orderly_evm_connector/rest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ def __init__(
from orderly_evm_connector.rest._rewards import get_valor_pool_info
from orderly_evm_connector.rest._rewards import get_valor_redeem_info
from orderly_evm_connector.rest._rewards import get_wallet_trading_rewards_history
from orderly_evm_connector.rest._rewards import get_market_making_rewards_leaderboard


class RestAsync(AsyncAPI):
Expand Down
2 changes: 1 addition & 1 deletion orderly_evm_connector/rest/_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def get_account_details(self, account_id: str):
https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-account-details

"""
check_required_parameters([[account_id, "address"]])
check_required_parameters([[account_id, "account_id"]])
payload = {"account_id": account_id}
return self._request("GET", "/v1/public/account", payload=payload)

Expand Down
2 changes: 2 additions & 0 deletions orderly_evm_connector/rest/_liquidation.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ def get_liquidated_positions_of_account(self, **kwargs):
end_t(timestamp)
page(number)
size(number)
sort_by(string)
liquidation_id(number)
https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-liquidated-positions-of-account
"""
payload = {**kwargs}
Expand Down
21 changes: 19 additions & 2 deletions orderly_evm_connector/rest/_rewards.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def get_current_epoch_estimate_broker(self):



def get_parameters_of_each_mm_epoch(self):
def get_parameters_of_each_mm_epoch(self, epoch: str, market: str):
"""
Get Parameters of Each MM Epoch of All MM Epochs

Expand All @@ -116,7 +116,24 @@ def get_parameters_of_each_mm_epoch(self):
https://docs.orderly.network/build-on-evm/evm-api/restful-api/public/get-parameters-of-each-mm-epoch-for-all-mm-epochs
"""

return self._request("GET", "/v1/public/market_making_rewards/epoch_info")
check_required_parameters([[epoch, "epoch"], [market, "market"]])
payload = {"epoch": epoch, "market": market}
return self._request("GET", "/v1/public/market_making_rewards/leaderboard", payload=payload)



def get_market_making_rewards_leaderboard(self):
"""
Get Market Making Rewards Leaderboard

Limit: 10 requests per 1 second

GET /v1/public/market_making_rewards/market_making_rewards/leaderboard

https://docs.orderly.network/build-on-evm/evm-api/restful-api/public/get-market-making-rewards-leaderboard
"""

return self._request("GET", "/v1/market_making_rewards/market_making_rewards/leaderboard")


def get_wallet_group_mm_rewards_history(self, address: str, symbol: str = None):
Expand Down
40 changes: 40 additions & 0 deletions orderly_evm_connector/websocket/websocket_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ def __init__(
get_liquidation_push,
)

from orderly_evm_connector.websocket.websocket_api._stream import get_price_changes
from orderly_evm_connector.websocket.websocket_api._stream import get_history_charts_1m
from orderly_evm_connector.websocket.websocket_api._stream import get_maintenance_status
from orderly_evm_connector.websocket.websocket_api._stream import get_announcements

class WebsocketPublicAPIClientAsync(OrderlyWebsocketClient):
def __init__(
self,
Expand Down Expand Up @@ -180,6 +185,41 @@ async def get_liquidation_push(self, *args, **kwargs):
await asyncio.sleep(0)


async def get_price_changes(self, *args, **kwargs):
from orderly_evm_connector.websocket.websocket_api._stream import (
get_price_changes,
)
get_price_changes(self, *args, **kwargs)
await asyncio.sleep(0)


async def get_history_charts_1m(self, *args, **kwargs):
from orderly_evm_connector.websocket.websocket_api._stream import (
get_history_charts_1m,
)
get_history_charts_1m(self, *args, **kwargs)
await asyncio.sleep(0)


async def get_maintenance_status(self, *args, **kwargs):
from orderly_evm_connector.websocket.websocket_api._stream import (
get_maintenance_status,
)
get_maintenance_status(self, *args, **kwargs)
await asyncio.sleep(0)


async def get_announcements(self, *args, **kwargs):
from orderly_evm_connector.websocket.websocket_api._stream import (
get_announcements,
)
get_announcements(self, *args, **kwargs)
await asyncio.sleep(0)





class WebsocketPrivateAPIClient(OrderlyWebsocketClient):
def __init__(
self,
Expand Down
20 changes: 20 additions & 0 deletions orderly_evm_connector/websocket/websocket_api/_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,23 @@ def get_liquidation_push(self):
"""
_message = {"id": self.wss_id, "event": "subscribe", "topic": "liquidation"}
self.send_message_to_server(_message)


def get_price_changes(self):
_message = {"id": self.wss_id, "event": "subscribe", "topic": "price_changes"}
self.send_message_to_server(_message)


def get_history_charts_1m(self):
_message = {"id": self.wss_id, "event": "subscribe", "topic": "history_charts_1m"}
self.send_message_to_server(_message)


def get_maintenance_status(self):
_message = {"id": self.wss_id, "event": "subscribe", "topic": "maintenance_status"}
self.send_message_to_server(_message)


def get_announcements(self):
_message = {"id": self.wss_id, "event": "subscribe", "topic": "announcement"}
self.send_message_to_server(_message)
1 change: 0 additions & 1 deletion tests/rest/test_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
200
)
def test_get_account():

client = Client(
orderly_key=orderly_key,
orderly_secret=orderly_secret,
Expand Down