Compare commits
No commits in common. "c2174b50818c587d48e3993f768e6f181d30c0ec" and "86f41d79345094030b847fc0ac196f3e525baaab" have entirely different histories.
c2174b5081
...
86f41d7934
|
@ -217,7 +217,8 @@ def run_auto_sell(config: AutoSellConfig) -> AutoSellRunResults:
|
||||||
logger.info('Attempting to sell %s %s', amount_to_sell, config.input_asset)
|
logger.info('Attempting to sell %s %s', amount_to_sell, config.input_asset)
|
||||||
|
|
||||||
order_details = config.seller.place_market_order(
|
order_details = config.seller.place_market_order(
|
||||||
fin_defs.AssetAmount(config.input_asset, amount_to_sell),
|
config.input_asset,
|
||||||
|
amount_to_sell,
|
||||||
config.output_asset,
|
config.output_asset,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -32,12 +32,4 @@ class CsvFileLogger:
|
||||||
# Write row in CSV file
|
# Write row in CSV file
|
||||||
with open(self.path, 'a') as f:
|
with open(self.path, 'a') as f:
|
||||||
writer = csv.DictWriter(f, fieldnames=fieldnames)
|
writer = csv.DictWriter(f, fieldnames=fieldnames)
|
||||||
d = trade_order.__dict__
|
writer.writerow(trade_order.__dict__)
|
||||||
d['input_asset'] = d['input'].asset
|
|
||||||
d['input_amount'] = d['input'].amount
|
|
||||||
d['output_asset'] = d['output'].asset
|
|
||||||
d['output_amount'] = d['output'].amount
|
|
||||||
d['fee_asset'] = d['fee'].asset
|
|
||||||
d['fee_amount'] = d['fee'].amount
|
|
||||||
del d['fee'], d['input'], d['output']
|
|
||||||
writer.writerow(d)
|
|
||||||
|
|
|
@ -2,11 +2,7 @@
|
||||||
|
|
||||||
from secret_loader import SecretLoader
|
from secret_loader import SecretLoader
|
||||||
|
|
||||||
__all__ = [
|
__all__ = ['KUCOIN_KEY', 'KUCOIN_SECRET', 'KUCOIN_PASS']
|
||||||
'KUCOIN_KEY',
|
|
||||||
'KUCOIN_PASS',
|
|
||||||
'KUCOIN_SECRET',
|
|
||||||
]
|
|
||||||
|
|
||||||
secret_loader = SecretLoader()
|
secret_loader = SecretLoader()
|
||||||
|
|
||||||
|
|
|
@ -23,19 +23,23 @@ class SellerMock(fin_depo.data.DepoFetcher):
|
||||||
|
|
||||||
def place_market_order(
|
def place_market_order(
|
||||||
self,
|
self,
|
||||||
input_: fin_defs.AssetAmount,
|
input_asset: fin_defs.Asset,
|
||||||
|
input_amount: Decimal,
|
||||||
output_asset: fin_defs.Asset,
|
output_asset: fin_defs.Asset,
|
||||||
) -> fin_depo.data.TradeOrderDetails:
|
) -> fin_depo.data.Depo:
|
||||||
assert input_.amount <= self.amount_left, 'Attempt to sell too much'
|
assert input_amount <= self.amount_left, 'Attempt to sell too much'
|
||||||
self.amount_left -= input_.amount
|
self.amount_left -= input_amount
|
||||||
|
|
||||||
executed_time = datetime.datetime.now(tz=datetime.UTC)
|
executed_time = datetime.datetime.now(tz=datetime.UTC)
|
||||||
|
|
||||||
return fin_depo.data.TradeOrderDetails(
|
return fin_depo.data.TradeOrderDetails(
|
||||||
executed_time=executed_time,
|
executed_time=executed_time,
|
||||||
input=input_,
|
input_asset=input_asset,
|
||||||
output=fin_defs.AssetAmount(output_asset, input_.amount),
|
input_amount=input_amount,
|
||||||
fee=fin_defs.AssetAmount(input_.asset, Decimal(0)),
|
output_asset=output_asset,
|
||||||
|
output_amount=input_amount,
|
||||||
|
fee_asset=input_asset,
|
||||||
|
fee_amount=Decimal(0),
|
||||||
order_id=10000000 - self.amount_left,
|
order_id=10000000 - self.amount_left,
|
||||||
raw_order_details={'TEST': 1, 'DATA': 2},
|
raw_order_details={'TEST': 1, 'DATA': 2},
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
def test_init_main():
|
|
||||||
import crypto_seller.__main__ # noqa: F401
|
|
|
@ -1,6 +1,7 @@
|
||||||
import pytest
|
|
||||||
|
|
||||||
|
|
||||||
def test_secrets():
|
def test_secrets():
|
||||||
with pytest.raises(ValueError, match='Failed to load secret with key:.*'):
|
try:
|
||||||
import crypto_seller.secrets_config # noqa: F401
|
import crypto_seller.secrets_config
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
raise
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
Loading…
Reference in New Issue
Block a user