45 lines
1.4 KiB
Python
45 lines
1.4 KiB
Python
# piker: trading gear for hackers
|
|
# Copyright (C) Guillermo Rodriguez (in stewardship for piker0)
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Affero General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Affero General Public License for more details.
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
'''
|
|
Order api and machinery
|
|
|
|
'''
|
|
|
|
from typing import Any, AsyncIterator
|
|
|
|
import tractor
|
|
|
|
|
|
@tractor.context
|
|
async def trades_dialogue(
|
|
ctx: tractor.Context,
|
|
loglevel: str = None,
|
|
|
|
) -> AsyncIterator[dict[str, Any]]:
|
|
|
|
# XXX: required to propagate ``tractor`` loglevel to piker logging
|
|
get_console_log(loglevel or tractor.current_actor().loglevel)
|
|
|
|
async with open_cached_client('deribit') as client:
|
|
if not client._key_id:
|
|
raise RuntimeError('Missing Deribit API key in `brokers.toml`!?!?')
|
|
|
|
acc_name = f'deribit.{client._key_id}'
|
|
|
|
await client.cache_symbols()
|
|
|
|
breakpoint()
|