basic bot: set unix fileformat, add KBI handling to cancel order submission
parent
63a6c6efde
commit
5690595064
|
@ -79,14 +79,14 @@ async def bot_main():
|
||||||
|
|
||||||
# init and sync actor-service runtime
|
# init and sync actor-service runtime
|
||||||
maybe_open_pikerd(
|
maybe_open_pikerd(
|
||||||
registry_addr=reg_addr,
|
# registry_addr=reg_addr,
|
||||||
loglevel=ll,
|
loglevel=ll,
|
||||||
debug_mode=False,
|
debug_mode=False,
|
||||||
|
|
||||||
),
|
),
|
||||||
tractor.wait_for_actor(
|
tractor.wait_for_actor(
|
||||||
'pikerd',
|
'pikerd',
|
||||||
arbiter_sockaddr=reg_addr,
|
# arbiter_sockaddr=reg_addr,
|
||||||
),
|
),
|
||||||
|
|
||||||
open_ems(
|
open_ems(
|
||||||
|
@ -104,7 +104,7 @@ async def bot_main():
|
||||||
):
|
):
|
||||||
print(f'Loaded binance accounts: {accounts}')
|
print(f'Loaded binance accounts: {accounts}')
|
||||||
|
|
||||||
price: float = 10e3 # non-clearable
|
price: float = 30e3 # non-clearable
|
||||||
size: float = 0.01
|
size: float = 0.01
|
||||||
oid: str = str(uuid4())
|
oid: str = str(uuid4())
|
||||||
|
|
||||||
|
@ -129,6 +129,10 @@ async def bot_main():
|
||||||
assert not pps
|
assert not pps
|
||||||
assert msgs[-1].oid == oid
|
assert msgs[-1].oid == oid
|
||||||
|
|
||||||
|
try:
|
||||||
|
# wait for ctl-c from user..
|
||||||
|
await trio.sleep_forever()
|
||||||
|
except KeyboardInterrupt:
|
||||||
# cancel the open order
|
# cancel the open order
|
||||||
await client.cancel(oid)
|
await client.cancel(oid)
|
||||||
msgs, pps = await wait_for_order_status(
|
msgs, pps = await wait_for_order_status(
|
||||||
|
@ -138,6 +142,5 @@ async def bot_main():
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
trio.run(bot_main)
|
trio.run(bot_main)
|
||||||
|
|
Loading…
Reference in New Issue