`ib`: deliver mkt precision info as `Decimal`
parent
d628b732b7
commit
901562cb6b
|
@ -20,6 +20,7 @@ Data feed endpoints pre-wrapped and ready for use with ``tractor``/``trio``.
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
import asyncio
|
import asyncio
|
||||||
from contextlib import asynccontextmanager as acm
|
from contextlib import asynccontextmanager as acm
|
||||||
|
from decimal import Decimal
|
||||||
from dataclasses import asdict
|
from dataclasses import asdict
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
@ -765,15 +766,19 @@ async def stream_quotes(
|
||||||
}:
|
}:
|
||||||
syminfo['no_vlm'] = True
|
syminfo['no_vlm'] = True
|
||||||
|
|
||||||
|
# XXX: pretty sure we don't need this any more right?
|
||||||
# for stocks it seems TWS reports too small a tick size
|
# for stocks it seems TWS reports too small a tick size
|
||||||
# such that you can't submit orders with that granularity?
|
# such that you can't submit orders with that granularity?
|
||||||
min_tick = 0.01 if atype == 'stock' else 0
|
# min_price_tick = Decimal('0.01') if atype == 'stock' else 0
|
||||||
|
# price_tick = max(price_tick, min_tick)
|
||||||
|
|
||||||
syminfo['price_tick_size'] = max(syminfo['minTick'], min_tick)
|
price_tick: Decimal = Decimal(str(syminfo['minTick']))
|
||||||
|
size_tick: Decimal = Decimal(str(syminfo['minSize']).rstrip('0'))
|
||||||
|
|
||||||
# for "legacy" assets, volume is normally discreet, not
|
syminfo['price_tick_size'] = price_tick
|
||||||
# a float
|
# NOTE: as you'd expect for "legacy" assets, the "volume
|
||||||
syminfo['lot_tick_size'] = 0.0
|
# precision" is normally discreet.
|
||||||
|
syminfo['lot_tick_size'] = size_tick
|
||||||
|
|
||||||
ibclient = proxy._aio_ns.ib.client
|
ibclient = proxy._aio_ns.ib.client
|
||||||
host, port = ibclient.host, ibclient.port
|
host, port = ibclient.host, ibclient.port
|
||||||
|
|
Loading…
Reference in New Issue