Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
timkpaine committed May 20, 2019
1 parent 3591c3a commit bc7325a
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 7 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ test_verbose: ## run the tests with full output

lint: ## run linter
flake8 aat
yarn lint

annotate: ## MyPy type annotation check
mypy -s aat
Expand Down
2 changes: 1 addition & 1 deletion aat/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from _version import VERSION as __version__
from ._version import VERSION as __version__ # noqa: F401
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion aat/tests/test_backtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def setup(self):
'timestamp': '1558296780000',
'pair': 'USDBTC'
}])
df['timestamp'] = pd.to_datetime(df['timestamp'])
df['timestamp'] = pd.to_datetime(df['timestamp'], unit='ms')
df.set_index(['timestamp', 'pair'])
self.test_line = df.iloc[0]

Expand Down
2 changes: 1 addition & 1 deletion aat/tests/test_define.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ def test_exchange_endpoint(self):
assert EXCHANGE_MARKET_DATA_ENDPOINT(ExchangeType.POLONIEX, TradingType.SANDBOX) \
== ''
assert EXCHANGE_MARKET_DATA_ENDPOINT(ExchangeType.POLONIEX, TradingType.LIVE) \
== ''
== 'wss://api2.poloniex.com'
8 changes: 5 additions & 3 deletions aat/trading.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
from .structs import TradeRequest, TradeResponse
from .utils import ex_type_to_ex
from .logging import LOG as log, SLIP as sllog, TXNS as tlog
from .ui.server import ServerApplication


class TradingEngine(object):
def __init__(self, options: TradingEngineConfig) -> None:
def __init__(self, options: TradingEngineConfig, ui) -> None:
# running live?
self._live = options.type == TradingType.LIVE

Expand Down Expand Up @@ -84,6 +83,9 @@ def __init__(self, options: TradingEngineConfig) -> None:
# pending orders to process (partial fills)
self._pending = {OrderType.MARKET: [], OrderType.LIMIT: []} # TODO in progress

# save UI class for later
self._ui_clazz = ui

def exchanges(self):
return self._exchanges

Expand Down Expand Up @@ -121,7 +123,7 @@ def registerStrategy(self, strat: TradingStrategy):
def run(self):
if self._live or self._simulation or self._sandbox:
port = 8081
self.application = ServerApplication(self)
self.application = self._ui_clazz(self)
log.critical('')
log.critical('Server listening on port: %s', port)
log.critical('')
Expand Down

0 comments on commit bc7325a

Please sign in to comment.