Tinkoff / invest-python

Tinkoff Invest Python gRPC client
https://tinkoff.github.io/invest-python/
Apache License 2.0
319 stars 90 forks source link

[Bug] Зависает на получении свечей #248

Open PavelKovL opened 1 year ago

PavelKovL commented 1 year ago

Что случилось?

Kernel restarting при получении данных. С сегодняшнего дня.

2023-08-08_142339

Воспроизведение

def base():
    with Client(APItoken) as client:
        settings = MarketDataCacheSettings(base_cache_dir=Path("market_data_cache"))
        market_data_cache = MarketDataCache(settings=settings, services=client)
        df = DataFrame([{
        'date': c.time,
        'volume': c.volume,
        'open': cast_money(c.open),
        'close': cast_money(c.close),
        'high': cast_money(c.high),
        'low': cast_money(c.low),
        } for c in market_data_cache.get_all_candles(
            figi="BBG004730N88",
            from_ = now() - timedelta(days=1),
            to= now(),
            #from_=now() - timedelta(days=14),
            interval=CandleInterval.CANDLE_INTERVAL_1_MIN,)])
    return df

print("tt1")

dfm = base()
#print(type(dfm))

print("tt2")

#dfm = create_df(candle_tmp)
# https://technical-analysis-library-in-python.readthedocs.io/en/latest/ta.html#ta.trend.ema_indicator
dfm['ema'] = ema_indicator(close=dfm['close'], window=9)
print(dfm[['date', 'close', 'ema']].tail(5))
dfm.to_csv(r"C:\csv_files\SBER-1m-data-big.csv", sep=',')

Tinkoff Invest Version

0.2.0-beta59

Python Version

3.11

OS

Windows

Логи

2023-08-08 14:21:23,779 DEBUG:Request [
2023-08-07 11:21:00+00:00
2023-08-08 11:21:00+00:00
]
tt1
2023-08-08 14:21:26,490 DEBUG:Returning from cache [
2023-08-07 11:21:00+00:00
2023-08-07 13:34:00+00:00
]
2023-08-08 14:21:26,625 DEBUG:Returning from cache [
2023-08-07 13:34:00+00:00
2023-08-08 10:16:00+00:00
]
2023-08-08 14:21:26,708 INFO:86861aac892ea624664eed2f166f09e2 GetCandles
PavelKovL commented 1 year ago

https://tinkoff.github.io/invest-python/examples/#_16

чистый пример отсюда, Загрузка и вывод всех минутных свечей по интрументу

дает такой же эффект.

2023-08-08_155120