RAPTOR v18.4: Исправлена отчетность, активированы выходные
This commit is contained in:
28
invest-python-master/examples/async_post_order_async.py
Normal file
28
invest-python-master/examples/async_post_order_async.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import asyncio
|
||||
import os
|
||||
from uuid import uuid4
|
||||
|
||||
from t_tech.invest import AsyncClient
|
||||
from t_tech.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())
|
||||
Reference in New Issue
Block a user