Skip to content
Merged
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
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ export APTOS_NODE_API_KEY="your_aptos_node_api_key"

```python
import asyncio
from decibel import NETNA_CONFIG
from decibel import TESTNET_CONFIG
from decibel.read import DecibelReadDex

async def main():
read = DecibelReadDex(NETNA_CONFIG)
read = DecibelReadDex(TESTNET_CONFIG)

# Get all markets
markets = await read.markets.get_all()
Expand All @@ -73,7 +73,7 @@ import os
from aptos_sdk.account import Account
from aptos_sdk.ed25519 import PrivateKey
from decibel import (
NETNA_CONFIG,
TESTNET_CONFIG,
BaseSDKOptions,
DecibelWriteDex,
GasPriceManager,
Expand All @@ -87,15 +87,15 @@ async def main():
private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"])
account = Account.load_key(private_key.hex())

gas = GasPriceManager(NETNA_CONFIG)
gas = GasPriceManager(TESTNET_CONFIG)
await gas.initialize()

read = DecibelReadDex(NETNA_CONFIG)
read = DecibelReadDex(TESTNET_CONFIG)
markets = await read.markets.get_all()
btc = next(m for m in markets if m.market_name == "BTC/USD")

write = DecibelWriteDex(
NETNA_CONFIG,
TESTNET_CONFIG,
account,
opts=BaseSDKOptions(gas_price_manager=gas),
)
Expand Down Expand Up @@ -123,11 +123,11 @@ asyncio.run(main())

```python
import asyncio
from decibel import NETNA_CONFIG
from decibel import TESTNET_CONFIG
from decibel.read import DecibelReadDex

async def main():
read = DecibelReadDex(NETNA_CONFIG)
read = DecibelReadDex(TESTNET_CONFIG)

def on_price(msg):
price = msg.price
Expand Down Expand Up @@ -155,11 +155,10 @@ See the [examples](examples) directory for complete working examples:
### Network Configs

```python
from decibel import MAINNET_CONFIG, TESTNET_CONFIG, NETNA_CONFIG
from decibel import MAINNET_CONFIG, TESTNET_CONFIG

# MAINNET_CONFIG - Production network
# TESTNET_CONFIG - Test network
# NETNA_CONFIG - Dev network
```

### Read Client
Expand Down
4 changes: 2 additions & 2 deletions examples/read/get_account_overview.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import asyncio
import os

from decibel import NETNA_CONFIG
from decibel import TESTNET_CONFIG
from decibel.read import DecibelReadDex

SUB_ADDR = "0x456..."


async def main() -> None:
read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))
read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))

overview = await read.account_overview.get_by_addr(sub_addr=SUB_ADDR)

Expand Down
4 changes: 2 additions & 2 deletions examples/read/get_all_market_prices.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import asyncio
import os

from decibel import NETNA_CONFIG
from decibel import TESTNET_CONFIG
from decibel.read import DecibelReadDex


async def main() -> None:
read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))
read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))

prices = await read.market_prices.get_all()

Expand Down
4 changes: 2 additions & 2 deletions examples/read/get_all_markets.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import asyncio
import os

from decibel import NETNA_CONFIG
from decibel import TESTNET_CONFIG
from decibel.read import DecibelReadDex


async def main() -> None:
read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))
read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))

markets = await read.markets.get_all()

Expand Down
4 changes: 2 additions & 2 deletions examples/read/get_candlesticks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import os
from datetime import UTC, datetime

from decibel import NETNA_CONFIG
from decibel import TESTNET_CONFIG
from decibel.read import CandlestickInterval, DecibelReadDex


async def main() -> None:
read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))
read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))

market_name = "BTC/USD"
interval = CandlestickInterval.ONE_HOUR
Expand Down
4 changes: 2 additions & 2 deletions examples/read/get_delegations.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import asyncio
import os

from decibel import NETNA_CONFIG
from decibel import TESTNET_CONFIG
from decibel.read import DecibelReadDex

SUB_ADDR = "0x456..."


async def main() -> None:
read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))
read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))

delegations = await read.delegations.get_all(sub_addr=SUB_ADDR)

Expand Down
4 changes: 2 additions & 2 deletions examples/read/get_leaderboard.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import asyncio
import os

from decibel import NETNA_CONFIG
from decibel import TESTNET_CONFIG
from decibel.read import DecibelReadDex


async def main() -> None:
read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))
read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))

response = await read.leaderboard.get_leaderboard(limit=10, sort_key="realized_pnl")

Expand Down
4 changes: 2 additions & 2 deletions examples/read/get_market_contexts.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import asyncio
import os

from decibel import NETNA_CONFIG
from decibel import TESTNET_CONFIG
from decibel.read import DecibelReadDex


async def main() -> None:
read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))
read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))

contexts = await read.market_contexts.get_all()

Expand Down
4 changes: 2 additions & 2 deletions examples/read/get_market_depth.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import asyncio
import os

from decibel import NETNA_CONFIG
from decibel import TESTNET_CONFIG
from decibel.read import DecibelReadDex


async def main() -> None:
read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))
read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))

market_name = "BTC/USD"
depth = await read.market_depth.get_by_name(market_name, limit=10)
Expand Down
4 changes: 2 additions & 2 deletions examples/read/get_market_price.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import asyncio
import os

from decibel import NETNA_CONFIG
from decibel import TESTNET_CONFIG
from decibel.read import DecibelReadDex


async def main() -> None:
read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))
read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))

market_name = "BTC/USD"
prices = await read.market_prices.get_by_name(market_name)
Expand Down
4 changes: 2 additions & 2 deletions examples/read/get_market_trades.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import asyncio
import os

from decibel import NETNA_CONFIG
from decibel import TESTNET_CONFIG
from decibel.read import DecibelReadDex


async def main() -> None:
read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))
read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))

market_name = "BTC/USD"
trades = await read.market_trades.get_by_name(market_name, limit=10)
Expand Down
4 changes: 2 additions & 2 deletions examples/read/get_portfolio_chart.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import asyncio
import os

from decibel import NETNA_CONFIG
from decibel import TESTNET_CONFIG
from decibel.read import DecibelReadDex

SUB_ADDR = "0x456..."


async def main() -> None:
read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))
read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))

chart = await read.portfolio_chart.get_by_addr(
sub_addr=SUB_ADDR,
Expand Down
4 changes: 2 additions & 2 deletions examples/read/get_trading_points.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import asyncio
import os

from decibel import NETNA_CONFIG
from decibel import TESTNET_CONFIG
from decibel.read import DecibelReadDex

OWNER_ADDR = "0x123..."


async def main() -> None:
read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))
read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))

points = await read.trading_points.get_by_owner(owner_addr=OWNER_ADDR)

Expand Down
4 changes: 2 additions & 2 deletions examples/read/get_user_active_twaps.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import asyncio
import os

from decibel import NETNA_CONFIG
from decibel import TESTNET_CONFIG
from decibel.read import DecibelReadDex

SUB_ADDR = "0x456..."


async def main() -> None:
read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))
read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))

twaps = await read.user_active_twaps.get_by_addr(sub_addr=SUB_ADDR)

Expand Down
4 changes: 2 additions & 2 deletions examples/read/get_user_bulk_orders.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import asyncio
import os

from decibel import NETNA_CONFIG
from decibel import TESTNET_CONFIG
from decibel.read import DecibelReadDex

SUB_ADDR = "0x456..."


async def main() -> None:
read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))
read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))

bulk_orders = await read.user_bulk_orders.get_by_addr(sub_addr=SUB_ADDR)

Expand Down
4 changes: 2 additions & 2 deletions examples/read/get_user_fund_history.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import asyncio
import os

from decibel import NETNA_CONFIG
from decibel import TESTNET_CONFIG
from decibel.read import DecibelReadDex

SUB_ADDR = "0x456..."


async def main() -> None:
read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))
read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))

response = await read.user_fund_history.get_by_addr(sub_addr=SUB_ADDR, limit=10)

Expand Down
4 changes: 2 additions & 2 deletions examples/read/get_user_funding_history.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import asyncio
import os

from decibel import NETNA_CONFIG
from decibel import TESTNET_CONFIG
from decibel.read import DecibelReadDex

SUB_ADDR = "0x456..."


async def main() -> None:
read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))
read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))

response = await read.user_funding_history.get_by_addr(sub_addr=SUB_ADDR, limit=10)

Expand Down
4 changes: 2 additions & 2 deletions examples/read/get_user_open_orders.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import asyncio
import os

from decibel import NETNA_CONFIG
from decibel import TESTNET_CONFIG
from decibel.read import DecibelReadDex

SUB_ADDR = "0x456..."


async def main() -> None:
read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))
read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))

response = await read.user_open_orders.get_by_addr(sub_addr=SUB_ADDR, limit=10)

Expand Down
4 changes: 2 additions & 2 deletions examples/read/get_user_order_history.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import asyncio
import os

from decibel import NETNA_CONFIG
from decibel import TESTNET_CONFIG
from decibel.read import DecibelReadDex

SUB_ADDR = "0x456..."


async def main() -> None:
read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))
read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))

response = await read.user_order_history.get_by_addr(sub_addr=SUB_ADDR, limit=10)

Expand Down
4 changes: 2 additions & 2 deletions examples/read/get_user_positions.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import asyncio
import os

from decibel import NETNA_CONFIG
from decibel import TESTNET_CONFIG
from decibel.read import DecibelReadDex

SUB_ADDR = "0x456..."


async def main() -> None:
read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))
read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))

positions = await read.user_positions.get_by_addr(sub_addr=SUB_ADDR)

Expand Down
4 changes: 2 additions & 2 deletions examples/read/get_user_subaccounts.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import asyncio
import os

from decibel import NETNA_CONFIG
from decibel import TESTNET_CONFIG
from decibel.read import DecibelReadDex

OWNER_ADDR = "0x123..."


async def main() -> None:
read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))
read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))

subaccounts = await read.user_subaccounts.get_by_addr(owner_addr=OWNER_ADDR)

Expand Down
Loading