Coder Social home page Coder Social logo

aevo-sdk's Introduction

Aevo SDK

This repo hosts Aevo's Python SDK, which simplifies the common operations around signing and creating orders.

Please see the documentation for more details:

REST API docs

Websocket API docs

Signing and API Keys can be generated through the Aevo UI:

Signing Keys: https://app.aevo.xyz/settings or https://testnet.aevo.xyz/settings

API Keys: https://app.aevo.xyz/settings/api-keys or https://testnet.aevo.xyz/settings/api-keys

NOTE: For security purposes, signing keys automatically expire 1 week after generation

Getting Started

It is recommended that you use a virtual environment to install the dependencies. The code has specifically been tested on Python 3.11.4.

virtualenv -p python3 .venv
source .venv/bin/activate

Then, install the dependencies for the Python SDK.

pip install -r requirements.txt

Next, create an AevoClient instance with your credentials.

from client import AevoClient

client = AevoClient(
    signing_key="",
    wallet_address="",
    api_key="",
    api_secret="",
    env="testnet",
)
markets = aevo.get_markets("ETH")
print(markets) # This should work if your client is setup right

The variables that you have to pass into AevoClient are:

signing_key - The private key of the signing key, used to sign orders.

wallet_address - Ethereum address of the account.

api_key - API key for the account. Used for private operations.

api_secret - API secret for the account.

env - Either testnet or mainnet.

Subscribing to realtime Websocket channels

Subscribing to orderbook updates

async def main():
    aevo = AevoClient(
        signing_key="",
        wallet_address="",
        api_key="",
        api_secret="",
        env="testnet",
    )

    await aevo.open_connection() # need to do this first to open wss connections
    await aevo.subscribe_ticker("ticker:ETH:PERPETUAL")

    async for msg in aevo.read_messages():
        print(msg)

if __name__ == "__main__":
    asyncio.run(main())

Subscribing to index price

await aevo.open_connection()
await aevo.subscribe_index(asset="ETH")

(Authenticated) Subscribing to private trades

await aevo.open_connection()
await aevo.subscribe_fills()

Websocket Order Flow

See order_ws_example.py for an example flow of how to create, edit and cancel an order via websocket. Due to the use of websockets library it is recommended that you implement your code using asyncio as well.

It can be tested by running python order_ws_example.py.

REST API Order Flow

See order_rest_example.py for an example flow of how to create and cancel an order via REST API.

It can be tested by running python order_rest_example.py.

Generating infinite expiry signing key

Normally signing keys generated via the UI expire after 1 week. However, you can generate a signing key that never expires by using the generate_infinite_expiry_signing_key.py script.

You will need to extract your private key from your wallet and paste it into the code in the section indicated before running it.

NOTE: Be very careful with this as anyone with your private key will have complete access to your funds. Remember to delete the key from the code straight after generating the signing key.

aevo-sdk's People

Contributors

alexchen314 avatar kelreel avatar kenchangh avatar levbeta avatar sammrai avatar stevenwal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

aevo-sdk's Issues

OverflowError: int too big to convert when I use rest_create_market_order(is_buy=True)

instrument_id = 1 #ETH-PERP
amount_eth = 0.01
res = client.rest_create_market_order(instrument_id=instrument_id, is_buy=True, quantity=amount_eth)

lib/python3.10/site-packages/eip712_structs/types.py", line 189, in _encode_value
value.to_bytes(self.length // 8, byteorder='big', signed=False) # For validation
OverflowError: int too big to convert

When is_buy=False code works

Signing key renewal

Hey there,

Is the only way to renew signing keys through the UI?

Would like to set-and-forget my bot and not have to re-generate keys to post orders every week.

Can orders be posted simply with the api keys?

example code

"from client import AevoClient" maybe is "from aevo import AevoClient"

sdk is outdated

The sdk is outdated and requires changes on many locations. Are the dependencies still safe?

aevo’s future upgrades and improvements

Hello, aevo workers. I am an early user of aevo. I would like to make some suggestions for the future development of the aevo community. I hope that aevo’s token economic model can be improved. In the future, project revenue can be launched to buy back tokens for destruction because of token circulation. The total amount is too large. In the future, aevo should launch a staking ecosystem. Aevo holders should enjoy the dividend rights of the aevo platform and move closer to the next generation modular blockchain as soon as possible to increase platform traffic. The old generation defi is outdated and aevo should break the The concept of the first generation of defi has become the benchmark for the next generation of defi. Thank you for your reference. I also hope that the sooner aevo is available, the better. 0x79c0798257D76E5c8198A019FaEAce7673E51001

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.