Files

29 lines
796 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import os
from datetime import timedelta
from t_tech.invest import Client
from t_tech.invest.schemas import (
GetAssetReportsRequest,
GetConsensusForecastsRequest,
GetForecastRequest,
InstrumentIdType,
Page,
)
from t_tech.invest.utils import now
TOKEN = os.environ["INVEST_TOKEN"]
def main():
with Client(TOKEN) as client:
instrument = client.instruments.find_instrument(
query="Сбер Банк - привилегированные акции"
).instruments[0]
request = GetForecastRequest(instrument_id=instrument.uid)
response = client.instruments.get_forecast_by(request=request)
print(instrument.name, response.consensus.recommendation.name)
if __name__ == "__main__":
main()