This commit is contained in:
parent
5a7c1f3a65
commit
677e2af74c
|
@ -37,7 +37,14 @@ __all__ = [
|
|||
'defi_partisia_blockchain',
|
||||
'investbank_nordnet',
|
||||
'__version__',
|
||||
'data',
|
||||
]
|
||||
|
||||
from . import defi_kraken, defi_kucoin, defi_partisia_blockchain, investbank_nordnet
|
||||
from . import (
|
||||
data,
|
||||
defi_kraken,
|
||||
defi_kucoin,
|
||||
defi_partisia_blockchain,
|
||||
investbank_nordnet,
|
||||
)
|
||||
from ._version import __version__
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import pytest
|
||||
import requests
|
||||
|
||||
from fin_depo import defi_kraken
|
||||
import fin_depo
|
||||
|
||||
from . import secrets
|
||||
|
||||
|
@ -14,10 +14,10 @@ needs_secrets = pytest.mark.skipif(
|
|||
@needs_secrets
|
||||
def test_get_depo():
|
||||
session = requests.Session()
|
||||
fetcher = defi_kraken.KrakenDepoFetcher(
|
||||
fetcher = fin_depo.defi_kraken.KrakenDepoFetcher(
|
||||
secrets.KRAKEN_KEY,
|
||||
secrets.KRAKEN_SECRET,
|
||||
)
|
||||
|
||||
depo = fetcher.get_depo()
|
||||
assert depo is not None
|
||||
assert isinstance(depo, fin_depo.data.DepoSingle)
|
||||
|
|
|
@ -3,7 +3,7 @@ from decimal import Decimal
|
|||
import fin_defs
|
||||
import pytest
|
||||
|
||||
from fin_depo import defi_kucoin
|
||||
import fin_depo
|
||||
|
||||
from . import secrets
|
||||
|
||||
|
@ -14,26 +14,29 @@ needs_secrets = pytest.mark.skipif(
|
|||
reason='Secret kucoin_USERNAME required',
|
||||
)
|
||||
|
||||
defi_kucoin.logger.setLevel('INFO')
|
||||
fin_depo.defi_kucoin.logger.setLevel('INFO')
|
||||
|
||||
|
||||
@needs_secrets
|
||||
def test_get_depo():
|
||||
"""Can inspect kucoin depository."""
|
||||
fetcher = defi_kucoin.KucoinDepoFetcher(
|
||||
fetcher = fin_depo.defi_kucoin.KucoinDepoFetcher(
|
||||
secrets.KUCOIN_KEY,
|
||||
secrets.KUCOIN_SECRET,
|
||||
secrets.KUCOIN_PASS,
|
||||
)
|
||||
|
||||
depo = fetcher.get_depo()
|
||||
assert depo is not None
|
||||
|
||||
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_place_market_order_requires_allow_trades():
|
||||
"""Client fails if allow_trades is not enabled when doing market orders."""
|
||||
fetcher = defi_kucoin.KucoinDepoFetcher(
|
||||
fetcher = fin_depo.defi_kucoin.KucoinDepoFetcher(
|
||||
secrets.KUCOIN_KEY,
|
||||
secrets.KUCOIN_SECRET,
|
||||
secrets.KUCOIN_PASS,
|
||||
|
@ -49,7 +52,7 @@ def test_place_market_order_requires_allow_trades():
|
|||
@needs_secrets
|
||||
def test_place_buy_side_order():
|
||||
"""Client can place buy side market orders."""
|
||||
fetcher = defi_kucoin.KucoinDepoFetcher(
|
||||
fetcher = fin_depo.defi_kucoin.KucoinDepoFetcher(
|
||||
secrets.KUCOIN_KEY,
|
||||
secrets.KUCOIN_SECRET,
|
||||
secrets.KUCOIN_PASS,
|
||||
|
@ -83,7 +86,7 @@ def test_place_buy_side_order():
|
|||
@needs_secrets
|
||||
def test_place_sell_side_order():
|
||||
"""Client can place sell side market orders."""
|
||||
fetcher = defi_kucoin.KucoinDepoFetcher(
|
||||
fetcher = fin_depo.defi_kucoin.KucoinDepoFetcher(
|
||||
secrets.KUCOIN_KEY,
|
||||
secrets.KUCOIN_SECRET,
|
||||
secrets.KUCOIN_PASS,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import pytest
|
||||
import requests
|
||||
|
||||
from fin_depo import data, investbank_nordnet
|
||||
import fin_depo
|
||||
|
||||
from . import secrets
|
||||
|
||||
|
@ -11,7 +11,7 @@ needs_secrets = pytest.mark.skipif(
|
|||
)
|
||||
|
||||
|
||||
def print_pretty(depo: data.Depo):
|
||||
def print_pretty(depo: fin_depo.data.Depo):
|
||||
for asset in depo.assets():
|
||||
amount = depo.get_amount_of_asset(asset)
|
||||
print(f'{str(asset):15} : {amount:10}')
|
||||
|
@ -21,7 +21,7 @@ def print_pretty(depo: data.Depo):
|
|||
@needs_secrets
|
||||
def test_get_depo():
|
||||
session = requests.Session()
|
||||
fetcher = investbank_nordnet.NordnetDepoFetcher(
|
||||
fetcher = fin_depo.investbank_nordnet.NordnetDepoFetcher(
|
||||
session,
|
||||
secrets.NORDNET_USERNAME,
|
||||
secrets.NORDNET_PASSWORD,
|
||||
|
@ -29,4 +29,4 @@ def test_get_depo():
|
|||
|
||||
depo = fetcher.get_depo()
|
||||
print_pretty(depo)
|
||||
assert depo is not None
|
||||
assert isinstance(depo, fin_depo.data.DepoGroup)
|
||||
|
|
|
@ -1,22 +1,28 @@
|
|||
import fin_defs
|
||||
import requests
|
||||
|
||||
from fin_depo import defi_partisia_blockchain
|
||||
import fin_depo
|
||||
|
||||
|
||||
def test_get_depo():
|
||||
session = requests.Session()
|
||||
fetcher = defi_partisia_blockchain.PartisiaBlockchainAccountDepoFetcher(
|
||||
fetcher = fin_depo.defi_partisia_blockchain.PartisiaBlockchainAccountDepoFetcher(
|
||||
session,
|
||||
'00f3a778fbcf663e4f0d47b41aa4ec51e0f9d39d60',
|
||||
)
|
||||
|
||||
depo = fetcher.get_depo()
|
||||
assert depo is not None
|
||||
|
||||
# Check layout
|
||||
assert isinstance(depo, fin_depo.data.DepoGroup)
|
||||
assert depo.name == 'Partisia Blockchain'
|
||||
assert depo.updated_time is not None
|
||||
|
||||
assert isinstance(depo.nested[0], fin_depo.data.DepoSingle)
|
||||
assert depo.nested[0].name == 'Native'
|
||||
assert depo.nested[0].updated_time == depo.updated_time
|
||||
|
||||
assert isinstance(depo.nested[0], fin_depo.data.DepoSingle)
|
||||
assert depo.nested[1].name == 'Bring Your Own Coin'
|
||||
assert depo.nested[1].updated_time == depo.updated_time
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user