Skip to content

Commit

Permalink
Merge pull request #295 from InjectiveLabs/fix/update_oracle_price_ex…
Browse files Browse the repository at this point in the history
…amples

(fix) Updated examples for oracle price requests
  • Loading branch information
aarmoa authored Jan 17, 2024
2 parents c389b5b + aa4d92c commit 1ef9948
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
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

0 comments on commit 1ef9948

Please sign in to comment.