1
0
fin-depo/test/test_kucoin.py

47 lines
1.1 KiB
Python

import datetime
import pytest
import fin_depo
from . import secrets
TEST_MARKET_ORDERS = True
needs_secrets = pytest.mark.skipif(
not secrets.KUCOIN_KEY,
reason='Secret kucoin_USERNAME required',
)
fin_depo.defi_kucoin.logger.setLevel('INFO')
NOW = datetime.datetime.now(tz=datetime.UTC)
def get_fetcher() -> fin_depo.defi_kucoin.KucoinDepoFetcher:
return fin_depo.defi_kucoin.KucoinDepoFetcher(
secrets.KUCOIN_KEY,
secrets.KUCOIN_SECRET,
secrets.KUCOIN_PASS,
)
@needs_secrets
def test_get_depo():
"""Can inspect depository."""
depo = get_fetcher().get_depo()
assert isinstance(depo, fin_depo.data.DepoGroup)
for nested_depo in depo.nested:
assert isinstance(nested_depo, fin_depo.data.DepoSingle)
@needs_secrets
def test_get_double_registers():
double_registers = get_fetcher()._get_double_registers()
assert len(double_registers) > 0
for item in double_registers:
print(item)
assert item.input.amount > 0 if item.input else None
assert item.output.amount > 0 if item.output else None