async def retrieveHistoricalPrices(marketId, startTime, endTime, limit):
base_url = os.getenv("API_SERVER_URL")
async with httpx.AsyncClient() as session:
client = PerpetualsClient(base_url=base_url, session=session)
try:
address = os.getenv("ACCOUNT")
startTimePB = Timestamp()
endTimePB = Timestamp()
startTimePB.FromDatetime(startTime)
endTimePB.FromDatetime(endTime)
candlestick = await client.get_historical_prices(
market=marketId,
startTime=startTimePB,
endTime=endTimePB,
limit=limit,
)
print(candlestick)
except Exception as e:
print(f"Error getting historical prices: {e}")
print("\nTroubleshooting:")
print(" - Is the server running?")
print(" - Does this address have orders in the database?")