Skip to content

Commit

Permalink
fix query oracle prices return type
Browse files Browse the repository at this point in the history
  • Loading branch information
zakir-code committed Oct 11, 2023
1 parent acfde0b commit f3f0af1
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 368 deletions.
9 changes: 6 additions & 3 deletions fxsdk/client/marginx.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from fxsdk.client.grpc import Client
from fxsdk.dec import dec_from_str
from fxsdk.msg.dex import new_position_from_proto, new_order_from_proto, Order, Position, \
from fxsdk.msg.marginx import new_position_from_proto, new_order_from_proto, Order, Position, \
new_pair_funding_rate_from_proto, PairFundingRate, OrderDepths, PairPrice, new_order_depths_from_proto

from fxsdk.x.marginx.oracle.v1.query_pb2 import QueryPriceRequest, QueryMarketRequest
Expand All @@ -24,9 +24,12 @@ def query_oracle_price(self, pair_id: str) -> Decimal:
response = OracleClient(self.channel).Price(QueryPriceRequest(pair_id=pair_id))
return dec_from_str(response.price)

def query_oracle_prices(self): # TODO: need fix return type
def query_oracle_prices(self) -> [PairPrice]:
response = OracleClient(self.channel).Prices(QueryPriceRequest())
return response.prices
pair_prices = []
for price in response.prices:
pair_prices.append(PairPrice(price.pair_id, dec_from_str(price.price)))
return pair_prices

def query_oracle_market(self, pair_id: str) -> Market:
response = OracleClient(self.channel).Market(QueryMarketRequest(pair_id=pair_id))
Expand Down
File renamed without changes.
73 changes: 0 additions & 73 deletions fxsdk/x/fx/dex/v1/genesis_pb2.py

This file was deleted.

59 changes: 0 additions & 59 deletions fxsdk/x/fx/dex/v1/genesis_pb2.pyi

This file was deleted.

4 changes: 0 additions & 4 deletions fxsdk/x/fx/dex/v1/genesis_pb2_grpc.py

This file was deleted.

Loading

0 comments on commit f3f0af1

Please sign in to comment.