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
10 changes: 7 additions & 3 deletions examples/exchange_client/oracle_rpc/1_StreamPrices.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ async def main() -> None:
# select network: local, testnet, mainnet
network = Network.testnet()
client = AsyncClient(network)
base_symbol = "INJ"
quote_symbol = "USDT"
oracle_type = "bandibc"
market = (await client.all_derivative_markets())[
"0x17ef48032cb24375ba7c2e39f384e56433bcab20cbee9a7357e4cba2eb00abe6"
]

base_symbol = market.oracle_base
quote_symbol = market.oracle_quote
oracle_type = market.oracle_type

task = asyncio.get_event_loop().create_task(
client.listen_oracle_prices_updates(
Expand Down
13 changes: 8 additions & 5 deletions examples/exchange_client/oracle_rpc/2_Price.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ async def main() -> None:
# select network: local, testnet, mainnet
network = Network.testnet()
client = AsyncClient(network)
base_symbol = "BTC"
quote_symbol = "USDT"
oracle_type = "bandibc"
oracle_scale_factor = 6
market = (await client.all_derivative_markets())[
"0x17ef48032cb24375ba7c2e39f384e56433bcab20cbee9a7357e4cba2eb00abe6"
]

base_symbol = market.oracle_base
quote_symbol = market.oracle_quote
oracle_type = market.oracle_type

oracle_prices = await client.fetch_oracle_price(
base_symbol=base_symbol,
quote_symbol=quote_symbol,
oracle_type=oracle_type,
oracle_scale_factor=oracle_scale_factor,
)
print(oracle_prices)

Expand Down