コード例 #1
0
        "bestAskPrice": result_data.askPrice
    }

    #FIXME kraken returns a list of spreads over time
    #   think about how we want to merge this with kraken spread
    return tuple([
        parsed_spread,
    ])


# ============================================================
# FETCH
# ============================================================


@retry_request(retries=pydantic.PositiveInt(10),
               logger=lambda *args: print("===xxxxx>>>> : ", *args))
async def get_spread_binance(
    client: ntypes.CLIENT,
    symbol: ntypes.SYMBOL,
    symbols_resp: NoobitResponseSymbols,
    # prevent unintentional passing of following args
    *,
    logger: typing.Optional[typing.Callable] = None,
    base_url: pydantic.AnyHttpUrl = endpoints.BINANCE_ENDPOINTS.public.url,
    endpoint: str = endpoints.BINANCE_ENDPOINTS.public.endpoints.spread,
) -> Result[NoobitResponseSpread, ValidationError]:

    symbol_to_exchange = lambda x: {
        k: v.exchange_pair
        for k, v in symbols_resp.asset_pairs.items()
コード例 #2
0
        "prevHigh": None,
        "prevVwap": None,
        "prevVolume": None,
        "prevTrdCount": None,
    }
    return parsed_instrument




# ============================================================
# FETCH
# ============================================================


@retry_request(retries=pydantic.PositiveInt(10), logger=lambda *args: print("===xxxxx>>>> : ", *args))
async def get_instrument_binance(
        client: ntypes.CLIENT,
        symbol: ntypes.SYMBOL,
        symbols_resp: NoobitResponseSymbols,
        # prevent unintentional passing of following args
        *,
        logger: typing.Optional[typing.Callable] = None,
        base_url: pydantic.AnyHttpUrl = endpoints.BINANCE_ENDPOINTS.public.url,
        endpoint: str = endpoints.BINANCE_ENDPOINTS.public.endpoints.instrument,
    ) -> Result[NoobitResponseInstrument, ValidationError]:


    symbol_to_exchange = lambda x : {k: v.exchange_pair for k, v in symbols_resp.asset_pairs.items()}[x]
    
    req_url = urljoin(base_url, endpoint)