1
0
fin-depo/test/test_kucoin.py

61 lines
1.3 KiB
Python
Raw Permalink 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():
"""Can inspect kucoin depository."""
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
2024-11-27 20:56:13 +00:00
def test_get_withdrawals():
withdrawals = get_fetcher()._get_withdrawals()
assert len(withdrawals) > 0
2024-07-27 01:14:12 +00:00
2024-11-27 23:45:46 +00:00
@needs_secrets
2024-11-27 20:56:13 +00:00
def test_get_deposits():
deposits = get_fetcher()._get_deposits()
assert len(deposits) > 0
2024-11-27 23:45:46 +00:00
@needs_secrets
def test_get_historic_spot_orders():
orders = get_fetcher()._get_historic_spot_orders()
assert next(orders)
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