Skip to content

Commit

Permalink
basic bot: iter latest ticks first to decide new submission price per…
Browse files Browse the repository at this point in the history
… quote
  • Loading branch information
goodboy committed Jun 27, 2023
1 parent da07685 commit ad4847c
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions examples/basic_order_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@


# TODO: handle other statuses:
# - fills, errors, and
# - fills, errors, and position tracking
async def wait_for_order_status(
trades_stream: tractor.MsgStream,
oid: str,
Expand Down Expand Up @@ -156,18 +156,17 @@ async def trailer(

async for quotes in quote_stream:
for fqme, quote in quotes.items():
# print(quote['symbol'])
# print(
# f'{quote["symbol"]} -> {quote["ticks"]}\n'
# f'last 1s OHLC:\n{s_shm.array[-1]}\n'
# f'last 1m OHLC:\n{m_shm.array[-1]}\n'
# )

for tick in iterticks(
quote,

# default are already this
# types=('trade', 'dark_trade'),
reverse=True,
# types=('trade', 'dark_trade'), # defaults
):
# print(
# f'{fqme} ticks:\n{pformat(tick)}\n\n'
# # f'last 1s OHLC:\n{s_shm.array[-1]}\n'
# # f'last 1m OHLC:\n{m_shm.array[-1]}\n'
# )

await client.update(
uuid=order.oid,
Expand Down

0 comments on commit ad4847c

Please sign in to comment.