1
0
fin-depo/test/test_kucoin.py

47 lines
1.1 KiB
Python
Raw Normal View History

2024-07-27 01:14:12 +00:00
import datetime
2024-07-20 18:19:52 +00:00
import pytest
2024-07-21 09:09:49 +00:00
import fin_depo
2024-07-20 18:19:52 +00:00
from . import secrets
TEST_MARKET_ORDERS = True
2024-07-20 18:19:52 +00:00
needs_secrets = pytest.mark.skipif(
not secrets.KUCOIN_KEY,
reason='Secret kucoin_USERNAME required',
)
2024-07-21 09:09:49 +00:00
fin_depo.defi_kucoin.logger.setLevel('INFO')
NOW = datetime.datetime.now(tz=datetime.UTC)
2024-07-20 18:21:50 +00:00
2024-11-27 23:45:46 +00:00
2024-11-27 20:56:13 +00:00
def get_fetcher() -> fin_depo.defi_kucoin.KucoinDepoFetcher:
return fin_depo.defi_kucoin.KucoinDepoFetcher(
2024-07-20 18:19:52 +00:00
secrets.KUCOIN_KEY,
secrets.KUCOIN_SECRET,
secrets.KUCOIN_PASS,
)
2024-11-27 23:45:46 +00:00
2024-11-27 20:56:13 +00:00
@needs_secrets
def test_get_depo():
2024-12-22 03:48:31 +00:00
"""Can inspect depository."""
2024-11-27 20:56:13 +00:00
depo = get_fetcher().get_depo()
2024-07-21 09:09:49 +00:00
assert isinstance(depo, fin_depo.data.DepoGroup)
for nested_depo in depo.nested:
assert isinstance(nested_depo, fin_depo.data.DepoSingle)
2024-11-27 23:45:46 +00:00
@needs_secrets
def test_get_double_registers():
double_registers = get_fetcher()._get_double_registers()
assert len(double_registers) > 0
2024-12-22 04:44:51 +00:00
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