RussianInvestments / invest-python

Invest Python gRPC client
https://russianinvestments.github.io/invest-python/
Apache License 2.0
66 stars 21 forks source link

cannot import name 'PostOrderAsyncRequest' from 'tinkoff.invest.schemas' #49

Closed mmvchel closed 4 months ago

mmvchel commented 4 months ago

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

В библиотеке tinkoff.invest.schemas не находит PostOrderAsyncRequest (examples/async_post_order_async.py)

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

import asyncio
import os
from uuid import uuid4

from tinkoff.invest import AsyncClient
from tinkoff.invest.schemas import OrderDirection, OrderType, PostOrderAsyncRequest

TOKEN = os.environ["INVEST_TOKEN"]

async def main():
    async with AsyncClient(TOKEN) as client:
        accounts = await client.users.get_accounts()
        account_id = accounts.accounts[0].id
        request = PostOrderAsyncRequest(
            order_type=OrderType.ORDER_TYPE_MARKET,
            direction=OrderDirection.ORDER_DIRECTION_BUY,
            instrument_id="BBG004730ZJ9",
            quantity=1,
            account_id=account_id,
            order_id=str(uuid4()),
        )
        response = await client.orders.post_order_async(request=request)
        print(response)

if __name__ == "__main__":
    asyncio.run(main())

Tinkoff Invest Version

0.2.0-beta103

Python Version

Другая

OS

Windows

Логи

import pandas as pd
Traceback (most recent call last):
  File "c:\Python_projects\Tinkoff_bots\functions async.py", line 8, in <module>
    from tinkoff.invest.schemas import OrderDirection, OrderType, PostOrderAsyncRequest
ImportError: cannot import name 'PostOrderAsyncRequest' from 'tinkoff.invest.schemas' (C:\Users\mmvch\AppData\Local\Programs\Python\Python312\Lib\site-packages\tinkoff\invest\schemas.py). Did you mean: 'PostOrderRequest'?
python-invest commented 4 months ago

Поддержка появляется в версии 0.2.0-beta104