Don't bother casting `AggTrade` values for now, just floatify the price/quantity
parent
06026ec661
commit
2dc8ee2b4e
|
@ -60,11 +60,11 @@ from ..accounting._mktinfo import (
|
||||||
MktPair,
|
MktPair,
|
||||||
digits_to_dec,
|
digits_to_dec,
|
||||||
)
|
)
|
||||||
from . import (
|
from .._cacheables import open_cached_client
|
||||||
|
from ._util import (
|
||||||
resproc,
|
resproc,
|
||||||
SymbolNotFound,
|
SymbolNotFound,
|
||||||
DataUnavailable,
|
DataUnavailable,
|
||||||
open_cached_client,
|
|
||||||
)
|
)
|
||||||
from ._util import (
|
from ._util import (
|
||||||
get_logger,
|
get_logger,
|
||||||
|
@ -288,6 +288,7 @@ class Client:
|
||||||
params: dict | OrderedDict,
|
params: dict | OrderedDict,
|
||||||
signed: bool = False,
|
signed: bool = False,
|
||||||
action: str = 'get'
|
action: str = 'get'
|
||||||
|
|
||||||
) -> dict[str, Any]:
|
) -> dict[str, Any]:
|
||||||
|
|
||||||
if signed:
|
if signed:
|
||||||
|
@ -296,7 +297,7 @@ class Client:
|
||||||
resp = await getattr(self._sesh, action)(
|
resp = await getattr(self._sesh, action)(
|
||||||
path=f'/api/v3/{method}',
|
path=f'/api/v3/{method}',
|
||||||
params=params,
|
params=params,
|
||||||
timeout=float('inf')
|
timeout=float('inf'),
|
||||||
)
|
)
|
||||||
|
|
||||||
return resproc(resp, log)
|
return resproc(resp, log)
|
||||||
|
@ -476,6 +477,7 @@ class Client:
|
||||||
async def get_positions(
|
async def get_positions(
|
||||||
self,
|
self,
|
||||||
recv_window: int = 60000
|
recv_window: int = 60000
|
||||||
|
|
||||||
) -> tuple:
|
) -> tuple:
|
||||||
positions = {}
|
positions = {}
|
||||||
volumes = {}
|
volumes = {}
|
||||||
|
@ -509,7 +511,8 @@ class Client:
|
||||||
return await self._sapi(
|
return await self._sapi(
|
||||||
'capital/deposit/hisrec',
|
'capital/deposit/hisrec',
|
||||||
params=params,
|
params=params,
|
||||||
signed=True)
|
signed=True,
|
||||||
|
)
|
||||||
|
|
||||||
async def get_withdrawls(
|
async def get_withdrawls(
|
||||||
self,
|
self,
|
||||||
|
@ -523,7 +526,8 @@ class Client:
|
||||||
return await self._sapi(
|
return await self._sapi(
|
||||||
'capital/withdraw/history',
|
'capital/withdraw/history',
|
||||||
params=params,
|
params=params,
|
||||||
signed=True)
|
signed=True,
|
||||||
|
)
|
||||||
|
|
||||||
async def submit_limit(
|
async def submit_limit(
|
||||||
self,
|
self,
|
||||||
|
@ -732,7 +736,7 @@ async def stream_messages(
|
||||||
# ``msgspec.Struct`` does not runtime-validate until you
|
# ``msgspec.Struct`` does not runtime-validate until you
|
||||||
# decode/encode, see:
|
# decode/encode, see:
|
||||||
# https://jcristharif.com/msgspec/structs.html#type-validation
|
# https://jcristharif.com/msgspec/structs.html#type-validation
|
||||||
msg = AggTrade(**msg)
|
msg = AggTrade(**msg) # TODO: should we .copy() ?
|
||||||
yield 'trade', {
|
yield 'trade', {
|
||||||
'symbol': msg.s,
|
'symbol': msg.s,
|
||||||
'last': msg.p,
|
'last': msg.p,
|
||||||
|
|
Loading…
Reference in New Issue