`binance`: facepalm, swap price/size_tick methods..
Wow not sure how that happened, but we should probably use the correct market precision info for the correct parameter.. Also, use `@lru_cache` on new `get_mkt_info()` ep, seems to work?rekt_pps
parent
10a39ca42c
commit
0d2e713e9a
|
@ -23,6 +23,7 @@ Binance backend
|
|||
"""
|
||||
from contextlib import asynccontextmanager as acm
|
||||
from datetime import datetime
|
||||
from functools import lru_cache
|
||||
from decimal import Decimal
|
||||
from typing import (
|
||||
Any, Union, Optional,
|
||||
|
@ -131,14 +132,16 @@ class Pair(Struct, frozen=True):
|
|||
permissions: list[str]
|
||||
|
||||
@property
|
||||
def size_tick(self) -> Decimal:
|
||||
def price_tick(self) -> Decimal:
|
||||
# XXX: lul, after manually inspecting the response format we
|
||||
# just directly pick out the info we need
|
||||
return Decimal(self.filters['PRICE_FILTER']['tickSize'].rstrip('0'))
|
||||
step_size: str = self.filters['PRICE_FILTER']['tickSize'].rstrip('0')
|
||||
return Decimal(step_size)
|
||||
|
||||
@property
|
||||
def price_tick(self) -> Decimal:
|
||||
return Decimal(self.filters['LOT_SIZE']['stepSize'].rstrip('0'))
|
||||
def size_tick(self) -> Decimal:
|
||||
step_size: str = self.filters['LOT_SIZE']['stepSize'].rstrip('0')
|
||||
return Decimal(step_size)
|
||||
|
||||
|
||||
class OHLC(Struct):
|
||||
|
@ -473,6 +476,7 @@ async def open_history_client(
|
|||
yield get_ohlc, {'erlangs': 3, 'rate': 3}
|
||||
|
||||
|
||||
@lru_cache
|
||||
async def get_mkt_info(
|
||||
fqme: str,
|
||||
|
||||
|
@ -481,7 +485,6 @@ async def get_mkt_info(
|
|||
async with open_cached_client('binance') as client:
|
||||
|
||||
pair: Pair = await client.exch_info(fqme.upper())
|
||||
|
||||
mkt = MktPair(
|
||||
dst=Asset(
|
||||
name=pair.baseAsset,
|
||||
|
|
Loading…
Reference in New Issue